Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the cfg_doc feature on docs.rs #4064

Merged
merged 3 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ jobs:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.MSRV }}
toolchain: nightly
target: x86_64-unknown-linux-gnu
- run: cargo install toml-cli # toml-cli is required to run `make test-build-docs-rs`
- name: make test-build-docs-rs
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -454,10 +454,10 @@ test-build-docs-rs:
fi; \
printf "*** Building doc for package with manifest $$manifest_path ***\n\n"; \
if [ -z "$$features" ]; then \
$(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" || exit 1; \
RUSTDOCFLAGS="--cfg=docsrs" $(CARGO_BINARY) +nightly doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" || exit 1; \
else \
printf "Following features are inferred from Cargo.toml: $$features\n\n\n"; \
$(CARGO_BINARY) doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --features "$$features" || exit 1; \
RUSTDOCFLAGS="--cfg=docsrs" $(CARGO_BINARY) +nightly doc $(CARGO_TARGET_FLAG) --manifest-path "$$manifest_path" --features "$$features" || exit 1; \
fi; \
fi; \
done
Expand Down
1 change: 1 addition & 0 deletions lib/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,4 @@ features = [
"wasmer-artifact-create",
"wasmer-artifact-load",
]
rustc-args = ["--cfg", "docsrs"]
Michael-F-Bryan marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions lib/c-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
// Because this crate exposes a lot of C APIs which are unsafe by definition,
// we allow unsafe without explicit safety documentation for each of them.
#![allow(clippy::missing_safety_doc)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod error;
pub mod wasm_c_api;
1 change: 1 addition & 0 deletions lib/cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ blake3-pure = ["blake3/pure"]

[package.metadata.docs.rs]
features = ["wasmer/sys"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 1 addition & 1 deletion lib/cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
#![cfg_attr(
feature = "cargo-clippy",
Expand All @@ -17,6 +16,7 @@
clippy::use_self
)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod cache;
mod filesystem;
Expand Down
3 changes: 3 additions & 0 deletions lib/cli-compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ cranelift = [
debug = ["fern", "log"]
disable-all-logging = []
jit = []

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
4 changes: 2 additions & 2 deletions lib/cli-compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns,
unstable_features
unreachable_patterns
)]
#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[macro_use]
extern crate anyhow;
Expand Down
3 changes: 3 additions & 0 deletions lib/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -188,3 +188,6 @@ bin-dir = "bin/{ bin }"
[package.metadata.binstall.overrides.x86_64-pc-windows-msvc]
pkg-url = "{ repo }/releases/download/v{ version }/wasmer-windows-amd64.{ archive-format }"
bin-dir = "bin/{ bin }.exe"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
Michael-F-Bryan marked this conversation as resolved.
Show resolved Hide resolved
4 changes: 2 additions & 2 deletions lib/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
unused_mut,
unused_variables,
unused_unsafe,
unreachable_patterns,
unstable_features
unreachable_patterns
)]
#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[macro_use]
extern crate anyhow;
Expand Down
3 changes: 3 additions & 0 deletions lib/compiler-cranelift/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ wasm = ["std", "unwind"]
unwind = ["cranelift-codegen/unwind", "gimli"]
std = ["cranelift-codegen/std", "cranelift-frontend/std", "wasmer-compiler/std", "wasmer-types/std"]
core = ["hashbrown", "cranelift-codegen/core", "cranelift-frontend/core"]

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/compiler-cranelift/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
clippy::use_self
)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(not(feature = "std"))]
#[macro_use]
Expand Down
3 changes: 3 additions & 0 deletions lib/compiler-llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,6 @@ rustc_version = "0.4"

[features]
test = []

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/compiler-llvm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)]
#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod abi;
mod compiler;
Expand Down
3 changes: 3 additions & 0 deletions lib/compiler-singlepass/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ core = ["hashbrown", "wasmer-types/core"]
unwind = ["gimli"]
sse = []
avx = []

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/compiler-singlepass/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
//! runtime performance.

#![allow(clippy::unnecessary_cast)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod address_map;
mod arm64_decl;
Expand Down
1 change: 1 addition & 0 deletions lib/compiler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ features = [
"wasmer-artifact-create",
"wasmer-artifact-load",
]
rustc-args = ["--cfg", "docsrs"]
2 changes: 1 addition & 1 deletion lib/compiler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(
feature = "cargo-clippy",
Expand All @@ -25,6 +24,7 @@
clippy::use_self
)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(all(feature = "std", feature = "core"))]
compile_error!(
Expand Down
1 change: 1 addition & 0 deletions lib/emscripten/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ getrandom = "0.2"

[package.metadata.docs.rs]
features = ["wasmer/sys"]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/emscripten/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#![allow(clippy::type_complexity, clippy::unnecessary_cast)]
#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[macro_use]
extern crate log;
Expand Down
3 changes: 3 additions & 0 deletions lib/middlewares/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,6 @@ wasmer = { path = "../api", version = "=4.0.0", features = ["compiler"] }

[badges]
maintenance = { status = "actively-developed" }

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions lib/middlewares/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod metering;

// The most commonly used symbol are exported at top level of the
Expand Down
3 changes: 3 additions & 0 deletions lib/object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ version.workspace = true
wasmer-types = { path = "../types", version = "=4.0.0" }
object = { version = "0.28.3", default-features = false, features = ["write"] }
thiserror = "1.0"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/object/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
clippy::use_self
)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod error;
mod module;
Expand Down
4 changes: 4 additions & 0 deletions lib/registry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,7 @@ whoami = "1.2.3"

[dev-dependencies]
pretty_assertions = "1.3.0"

[package.metadata.docs.rs]
features = ["build-package"]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//! $ make update-graphql-schema
//! curl -sSfL https://registry.wasmer.io/graphql/schema.graphql > lib/registry/graphql/schema.graphql
//! ```
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod api;
mod client;
Expand Down
3 changes: 3 additions & 0 deletions lib/sys-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ wasmer-wasix = { path = "../wasix", version = "0.9.0" }
wasmer = { path = "../api", version = "=4.0.0", default-features = false, features = ["sys", "compiler", "cranelift"] }
tracing-subscriber = { version = "0.3.16", features = ["fmt"] }
tracing = "0.1.37"

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/sys-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
pub mod memory;
3 changes: 3 additions & 0 deletions lib/types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ default = ["std"]
std = []
core = []
enable-serde = ["serde", "serde/std", "serde_bytes", "indexmap/serde-1"]

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
2 changes: 1 addition & 1 deletion lib/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#![deny(missing_docs, unused_extern_crates)]
#![warn(unused_import_braces)]
#![cfg_attr(feature = "std", deny(unstable_features))]
#![cfg_attr(not(feature = "std"), no_std)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
#![cfg_attr(
Expand All @@ -21,6 +20,7 @@
clippy::use_self
)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(all(feature = "std", feature = "core"))]
compile_error!(
Expand Down
3 changes: 3 additions & 0 deletions lib/virtual-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ enable-serde = ["typetag"]
no-time = []
# Enables memory tracking/limiting functionality for the in-memory filesystem.
tracking = []

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions lib/virtual-fs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(test)]
#[macro_use]
extern crate pretty_assertions;
Expand Down
4 changes: 4 additions & 0 deletions lib/virtual-net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ libc = { version = "0.2.139", optional = true }

[features]
host-net = [ "tokio", "libc" ]

[package.metadata.docs.rs]
features = ["host-net"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions lib/virtual-net/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

use std::fmt;
use std::mem::MaybeUninit;
use std::net::IpAddr;
Expand Down
3 changes: 3 additions & 0 deletions lib/vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,6 @@ maintenance = { status = "actively-developed" }
[features]
default = []
enable-serde = ["serde", "indexmap/serde-1", "wasmer-types/enable-serde" ]

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
clippy::use_self
)
)]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

mod export;
mod extern_ref;
Expand Down
1 change: 1 addition & 0 deletions lib/wai-bindgen-wasmer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ llvm = ["wasmer/llvm"]

[package.metadata.docs.rs]
features = ["wasmer/sys"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions lib/wai-bindgen-wasmer/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub use wai_bindgen_wasmer_impl::{export, import};

#[cfg(feature = "async")]
Expand Down
1 change: 1 addition & 0 deletions lib/wasi-experimental-io-devices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ link_external_libs = [

[package.metadata.docs.rs]
features = ["wasmer/sys"]
rustc-args = ["--cfg", "docsrs"]
2 changes: 2 additions & 0 deletions lib/wasi-experimental-io-devices/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

#[cfg(feature = "link_external_libs")]
#[path = "link-ext.rs"]
pub mod link_ext;
Expand Down
1 change: 1 addition & 0 deletions lib/wasi-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ enable-serde = ["serde", "wasmer-types/serde"]

[package.metadata.docs.rs]
features = ["wasmer/sys"]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/wasi-types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod asyncify;
pub mod types;
Expand Down
6 changes: 5 additions & 1 deletion lib/wasix/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,8 @@ disable-all-logging = ["tracing/release_max_level_off", "tracing/max_level_off"]
enable-serde = ["typetag", "virtual-fs/enable-serde", "wasmer-wasix-types/enable-serde"]

[package.metadata.docs.rs]
features = ["wasmer/sys"]
features = [
"wasmer/sys", "webc_runner", "webc_runner_rt_wasi", "webc_runner_rt_wcgi",
"webc_runner_rt_emscripten", "sys-default",
]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/wasix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#![doc(html_favicon_url = "https://wasmer.io/images/icons/favicon-32x32.png")]
#![doc(html_logo_url = "https://github.com/wasmerio.png?size=200")]
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

//! Wasmer's WASI implementation
//!
Expand Down
3 changes: 3 additions & 0 deletions lib/wasm-interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ wat = "1.0"
validation = ["wasmparser"]
binary_encode = ["bincode"]
default = ["validation"]

[package.metadata.docs.rs]
rustc-args = ["--cfg", "docsrs"]
1 change: 1 addition & 0 deletions lib/wasm-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//!
//! wasm interfaces ensure wasm modules conform to a specific shape
//! they do this by asserting on the imports and exports of the module.
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]

pub mod interface;
pub mod interface_matcher;
Expand Down
1 change: 0 additions & 1 deletion tests/lib/wast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
#![warn(unused_import_braces)]
#![deny(unstable_features)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::new_without_default))]
#![cfg_attr(
feature = "cargo-clippy",
Expand Down