From 935fc09e1b0f0461708c2fa51deafe53cf6d72dc Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Mon, 10 Jul 2023 12:58:06 +0800 Subject: [PATCH 1/3] Enable the doc_cfg feature when running on docs.rs --- lib/c-api/src/lib.rs | 1 + lib/cache/src/lib.rs | 2 +- lib/cli-compiler/src/lib.rs | 3 +-- lib/cli/src/lib.rs | 4 ++-- lib/compiler-cranelift/src/lib.rs | 1 + lib/compiler-llvm/src/lib.rs | 1 + lib/compiler-singlepass/src/lib.rs | 1 + lib/compiler/src/lib.rs | 2 +- lib/emscripten/src/lib.rs | 1 + lib/middlewares/src/lib.rs | 2 ++ lib/object/src/lib.rs | 1 + lib/registry/src/lib.rs | 1 + lib/sys-utils/src/lib.rs | 1 + lib/types/src/lib.rs | 2 +- lib/virtual-fs/src/lib.rs | 2 ++ lib/virtual-net/src/lib.rs | 2 ++ lib/vm/src/lib.rs | 1 + lib/wai-bindgen-wasmer/src/lib.rs | 2 ++ lib/wasi-experimental-io-devices/src/lib.rs | 2 ++ lib/wasi-types/src/lib.rs | 1 + lib/wasix/src/lib.rs | 1 + lib/wasm-interface/src/lib.rs | 1 + tests/lib/wast/src/lib.rs | 1 - 23 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/c-api/src/lib.rs b/lib/c-api/src/lib.rs index 0c0fae224e4..5b59ab71a35 100644 --- a/lib/c-api/src/lib.rs +++ b/lib/c-api/src/lib.rs @@ -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; diff --git a/lib/cache/src/lib.rs b/lib/cache/src/lib.rs index 2441bd086e0..b15503e8464 100644 --- a/lib/cache/src/lib.rs +++ b/lib/cache/src/lib.rs @@ -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", @@ -17,6 +16,7 @@ clippy::use_self ) )] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod cache; mod filesystem; diff --git a/lib/cli-compiler/src/lib.rs b/lib/cli-compiler/src/lib.rs index 17b1d4ca248..01b36df4c91 100644 --- a/lib/cli-compiler/src/lib.rs +++ b/lib/cli-compiler/src/lib.rs @@ -7,8 +7,7 @@ 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")] diff --git a/lib/cli/src/lib.rs b/lib/cli/src/lib.rs index 82d9641d290..485e3e53916 100644 --- a/lib/cli/src/lib.rs +++ b/lib/cli/src/lib.rs @@ -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; diff --git a/lib/compiler-cranelift/src/lib.rs b/lib/compiler-cranelift/src/lib.rs index 0bfc35f102e..bb644035c76 100644 --- a/lib/compiler-cranelift/src/lib.rs +++ b/lib/compiler-cranelift/src/lib.rs @@ -22,6 +22,7 @@ clippy::use_self ) )] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/lib/compiler-llvm/src/lib.rs b/lib/compiler-llvm/src/lib.rs index c1d8dc0accb..49231b7324f 100644 --- a/lib/compiler-llvm/src/lib.rs +++ b/lib/compiler-llvm/src/lib.rs @@ -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; diff --git a/lib/compiler-singlepass/src/lib.rs b/lib/compiler-singlepass/src/lib.rs index 67c6c055b56..2ea4cf72629 100644 --- a/lib/compiler-singlepass/src/lib.rs +++ b/lib/compiler-singlepass/src/lib.rs @@ -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; diff --git a/lib/compiler/src/lib.rs b/lib/compiler/src/lib.rs index fbf9d369a65..212cf5057f7 100644 --- a/lib/compiler/src/lib.rs +++ b/lib/compiler/src/lib.rs @@ -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", @@ -25,6 +24,7 @@ clippy::use_self ) )] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #[cfg(all(feature = "std", feature = "core"))] compile_error!( diff --git a/lib/emscripten/src/lib.rs b/lib/emscripten/src/lib.rs index 5c92b9dfb36..3a3e6446238 100644 --- a/lib/emscripten/src/lib.rs +++ b/lib/emscripten/src/lib.rs @@ -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; diff --git a/lib/middlewares/src/lib.rs b/lib/middlewares/src/lib.rs index 15ef8204d06..5d914647ff2 100644 --- a/lib/middlewares/src/lib.rs +++ b/lib/middlewares/src/lib.rs @@ -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 diff --git a/lib/object/src/lib.rs b/lib/object/src/lib.rs index aa0cfc362fc..e14f6051202 100644 --- a/lib/object/src/lib.rs +++ b/lib/object/src/lib.rs @@ -18,6 +18,7 @@ clippy::use_self ) )] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod error; mod module; diff --git a/lib/registry/src/lib.rs b/lib/registry/src/lib.rs index 88ce6b5948f..9015a320431 100644 --- a/lib/registry/src/lib.rs +++ b/lib/registry/src/lib.rs @@ -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; diff --git a/lib/sys-utils/src/lib.rs b/lib/sys-utils/src/lib.rs index eb291915fd2..d0e931c7fd7 100644 --- a/lib/sys-utils/src/lib.rs +++ b/lib/sys-utils/src/lib.rs @@ -1 +1,2 @@ +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] pub mod memory; diff --git a/lib/types/src/lib.rs b/lib/types/src/lib.rs index 5b3f13af09a..062eb2420c6 100644 --- a/lib/types/src/lib.rs +++ b/lib/types/src/lib.rs @@ -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( @@ -21,6 +20,7 @@ clippy::use_self ) )] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] #[cfg(all(feature = "std", feature = "core"))] compile_error!( diff --git a/lib/virtual-fs/src/lib.rs b/lib/virtual-fs/src/lib.rs index 3a9b4d1cde8..c10991a0399 100644 --- a/lib/virtual-fs/src/lib.rs +++ b/lib/virtual-fs/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + #[cfg(test)] #[macro_use] extern crate pretty_assertions; diff --git a/lib/virtual-net/src/lib.rs b/lib/virtual-net/src/lib.rs index 1116867c24a..341f8c7e72e 100644 --- a/lib/virtual-net/src/lib.rs +++ b/lib/virtual-net/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + use std::fmt; use std::mem::MaybeUninit; use std::net::IpAddr; diff --git a/lib/vm/src/lib.rs b/lib/vm/src/lib.rs index 3d32b497917..581bdea6577 100644 --- a/lib/vm/src/lib.rs +++ b/lib/vm/src/lib.rs @@ -19,6 +19,7 @@ clippy::use_self ) )] +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] mod export; mod extern_ref; diff --git a/lib/wai-bindgen-wasmer/src/lib.rs b/lib/wai-bindgen-wasmer/src/lib.rs index 5f146b4a3aa..aadf7ff7772 100644 --- a/lib/wai-bindgen-wasmer/src/lib.rs +++ b/lib/wai-bindgen-wasmer/src/lib.rs @@ -1,3 +1,5 @@ +#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] + pub use wai_bindgen_wasmer_impl::{export, import}; #[cfg(feature = "async")] diff --git a/lib/wasi-experimental-io-devices/src/lib.rs b/lib/wasi-experimental-io-devices/src/lib.rs index 8b6e3050b60..d9c44f686f9 100644 --- a/lib/wasi-experimental-io-devices/src/lib.rs +++ b/lib/wasi-experimental-io-devices/src/lib.rs @@ -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; diff --git a/lib/wasi-types/src/lib.rs b/lib/wasi-types/src/lib.rs index d6a9956fe3c..344e9a903a7 100644 --- a/lib/wasi-types/src/lib.rs +++ b/lib/wasi-types/src/lib.rs @@ -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; diff --git a/lib/wasix/src/lib.rs b/lib/wasix/src/lib.rs index d1e72b24798..9b3015a7242 100644 --- a/lib/wasix/src/lib.rs +++ b/lib/wasix/src/lib.rs @@ -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 //! diff --git a/lib/wasm-interface/src/lib.rs b/lib/wasm-interface/src/lib.rs index 06fab2d3731..9dea4482b38 100644 --- a/lib/wasm-interface/src/lib.rs +++ b/lib/wasm-interface/src/lib.rs @@ -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; diff --git a/tests/lib/wast/src/lib.rs b/tests/lib/wast/src/lib.rs index 4cca798b795..54e38db3300 100644 --- a/tests/lib/wast/src/lib.rs +++ b/tests/lib/wast/src/lib.rs @@ -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", From c4541be53bcf4fde5b4b344657ae3a5b90cc7b26 Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Mon, 10 Jul 2023 13:07:40 +0800 Subject: [PATCH 2/3] Make sure docs.rs enables #[cfg(docsrs)] when building docs --- lib/api/Cargo.toml | 1 + lib/cache/Cargo.toml | 1 + lib/cli-compiler/Cargo.toml | 3 +++ lib/cli-compiler/src/lib.rs | 1 + lib/cli/Cargo.toml | 3 +++ lib/compiler-cranelift/Cargo.toml | 3 +++ lib/compiler-llvm/Cargo.toml | 3 +++ lib/compiler-singlepass/Cargo.toml | 3 +++ lib/compiler/Cargo.toml | 1 + lib/emscripten/Cargo.toml | 1 + lib/middlewares/Cargo.toml | 3 +++ lib/object/Cargo.toml | 3 +++ lib/registry/Cargo.toml | 4 ++++ lib/sys-utils/Cargo.toml | 3 +++ lib/types/Cargo.toml | 3 +++ lib/virtual-fs/Cargo.toml | 3 +++ lib/virtual-net/Cargo.toml | 4 ++++ lib/vm/Cargo.toml | 3 +++ lib/wai-bindgen-wasmer/Cargo.toml | 1 + lib/wasi-experimental-io-devices/Cargo.toml | 1 + lib/wasi-types/Cargo.toml | 1 + lib/wasix/Cargo.toml | 6 +++++- lib/wasm-interface/Cargo.toml | 3 +++ 23 files changed, 57 insertions(+), 1 deletion(-) diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml index e30526f0f3f..b2d6359880d 100644 --- a/lib/api/Cargo.toml +++ b/lib/api/Cargo.toml @@ -162,3 +162,4 @@ features = [ "wasmer-artifact-create", "wasmer-artifact-load", ] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/cache/Cargo.toml b/lib/cache/Cargo.toml index 1fddc0f7f0c..9b0e11d35ba 100644 --- a/lib/cache/Cargo.toml +++ b/lib/cache/Cargo.toml @@ -32,3 +32,4 @@ blake3-pure = ["blake3/pure"] [package.metadata.docs.rs] features = ["wasmer/sys"] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/cli-compiler/Cargo.toml b/lib/cli-compiler/Cargo.toml index 3d7fabc02ea..aa43c01b583 100644 --- a/lib/cli-compiler/Cargo.toml +++ b/lib/cli-compiler/Cargo.toml @@ -78,3 +78,6 @@ cranelift = [ debug = ["fern", "log"] disable-all-logging = [] jit = [] + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/cli-compiler/src/lib.rs b/lib/cli-compiler/src/lib.rs index 01b36df4c91..7ee91dacca0 100644 --- a/lib/cli-compiler/src/lib.rs +++ b/lib/cli-compiler/src/lib.rs @@ -11,6 +11,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))] #[macro_use] extern crate anyhow; diff --git a/lib/cli/Cargo.toml b/lib/cli/Cargo.toml index 87e23d8d231..4940375eec5 100644 --- a/lib/cli/Cargo.toml +++ b/lib/cli/Cargo.toml @@ -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"] diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml index b7b9f7c3077..9d14b234a17 100644 --- a/lib/compiler-cranelift/Cargo.toml +++ b/lib/compiler-cranelift/Cargo.toml @@ -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"] diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml index 1c08666cc7b..22b23dcbd95 100644 --- a/lib/compiler-llvm/Cargo.toml +++ b/lib/compiler-llvm/Cargo.toml @@ -42,3 +42,6 @@ rustc_version = "0.4" [features] test = [] + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml index 7ad7b62b9f8..1612225a4e3 100644 --- a/lib/compiler-singlepass/Cargo.toml +++ b/lib/compiler-singlepass/Cargo.toml @@ -43,3 +43,6 @@ core = ["hashbrown", "wasmer-types/core"] unwind = ["gimli"] sse = [] avx = [] + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml index fe5d869bc3d..385b571267e 100644 --- a/lib/compiler/Cargo.toml +++ b/lib/compiler/Cargo.toml @@ -64,3 +64,4 @@ features = [ "wasmer-artifact-create", "wasmer-artifact-load", ] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/emscripten/Cargo.toml b/lib/emscripten/Cargo.toml index 9eeabf1042e..01c5f72be8f 100644 --- a/lib/emscripten/Cargo.toml +++ b/lib/emscripten/Cargo.toml @@ -26,3 +26,4 @@ getrandom = "0.2" [package.metadata.docs.rs] features = ["wasmer/sys"] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/middlewares/Cargo.toml b/lib/middlewares/Cargo.toml index 5e2ac50d98c..e6962491d75 100644 --- a/lib/middlewares/Cargo.toml +++ b/lib/middlewares/Cargo.toml @@ -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"] diff --git a/lib/object/Cargo.toml b/lib/object/Cargo.toml index f330cd2cc1b..bfb4dfd9a35 100644 --- a/lib/object/Cargo.toml +++ b/lib/object/Cargo.toml @@ -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"] diff --git a/lib/registry/Cargo.toml b/lib/registry/Cargo.toml index 1221e6967cc..101ab8ab0e5 100644 --- a/lib/registry/Cargo.toml +++ b/lib/registry/Cargo.toml @@ -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"] diff --git a/lib/sys-utils/Cargo.toml b/lib/sys-utils/Cargo.toml index eb6d78f768e..de011754373 100644 --- a/lib/sys-utils/Cargo.toml +++ b/lib/sys-utils/Cargo.toml @@ -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"] diff --git a/lib/types/Cargo.toml b/lib/types/Cargo.toml index e09895efd01..9a073aa0b2c 100644 --- a/lib/types/Cargo.toml +++ b/lib/types/Cargo.toml @@ -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"] diff --git a/lib/virtual-fs/Cargo.toml b/lib/virtual-fs/Cargo.toml index d315020f907..4c84ee99ee6 100644 --- a/lib/virtual-fs/Cargo.toml +++ b/lib/virtual-fs/Cargo.toml @@ -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"] diff --git a/lib/virtual-net/Cargo.toml b/lib/virtual-net/Cargo.toml index 556e1675555..17bb4e8c41c 100644 --- a/lib/virtual-net/Cargo.toml +++ b/lib/virtual-net/Cargo.toml @@ -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"] diff --git a/lib/vm/Cargo.toml b/lib/vm/Cargo.toml index 2bf6a7da2e5..de5bbd90f3c 100644 --- a/lib/vm/Cargo.toml +++ b/lib/vm/Cargo.toml @@ -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"] diff --git a/lib/wai-bindgen-wasmer/Cargo.toml b/lib/wai-bindgen-wasmer/Cargo.toml index cc1eb2059ac..a79635f0547 100644 --- a/lib/wai-bindgen-wasmer/Cargo.toml +++ b/lib/wai-bindgen-wasmer/Cargo.toml @@ -43,3 +43,4 @@ llvm = ["wasmer/llvm"] [package.metadata.docs.rs] features = ["wasmer/sys"] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/wasi-experimental-io-devices/Cargo.toml b/lib/wasi-experimental-io-devices/Cargo.toml index 24a4b59ca9f..92c0fca6961 100644 --- a/lib/wasi-experimental-io-devices/Cargo.toml +++ b/lib/wasi-experimental-io-devices/Cargo.toml @@ -43,3 +43,4 @@ link_external_libs = [ [package.metadata.docs.rs] features = ["wasmer/sys"] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/wasi-types/Cargo.toml b/lib/wasi-types/Cargo.toml index 973ce746784..8f0cf5be468 100644 --- a/lib/wasi-types/Cargo.toml +++ b/lib/wasi-types/Cargo.toml @@ -39,3 +39,4 @@ enable-serde = ["serde", "wasmer-types/serde"] [package.metadata.docs.rs] features = ["wasmer/sys"] +rustc-args = ["--cfg", "docsrs"] diff --git a/lib/wasix/Cargo.toml b/lib/wasix/Cargo.toml index c931552d885..f3ffe2ecc66 100644 --- a/lib/wasix/Cargo.toml +++ b/lib/wasix/Cargo.toml @@ -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"] diff --git a/lib/wasm-interface/Cargo.toml b/lib/wasm-interface/Cargo.toml index 44b36b986fe..479fd1bd68c 100644 --- a/lib/wasm-interface/Cargo.toml +++ b/lib/wasm-interface/Cargo.toml @@ -24,3 +24,6 @@ wat = "1.0" validation = ["wasmparser"] binary_encode = ["bincode"] default = ["validation"] + +[package.metadata.docs.rs] +rustc-args = ["--cfg", "docsrs"] From a4946a42e041cbe01c8fb57855348aab1d83a3ea Mon Sep 17 00:00:00 2001 From: Michael-F-Bryan Date: Mon, 10 Jul 2023 13:39:52 +0800 Subject: [PATCH 3/3] Update "make test-build-docs-rs" to use a nightly compiler so we get the doc_cfg feature --- .github/workflows/test.yaml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 154c02db566..39713f07abf 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -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 diff --git a/Makefile b/Makefile index 7b24b974080..c71343af017 100644 --- a/Makefile +++ b/Makefile @@ -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