diff --git a/Cargo.toml b/Cargo.toml index 3891e39..e4bac0e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,3 +25,4 @@ trybuild = { version = "1.0.19", features = ["diff"] } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] +rustdoc-args = ["--cfg", "doc_cfg"] diff --git a/src/error.rs b/src/error.rs index fbb8379..80d879f 100644 --- a/src/error.rs +++ b/src/error.rs @@ -19,6 +19,7 @@ impl Error { /// If the error type does not provide a backtrace, a backtrace will be /// created here to ensure that a backtrace exists. #[cfg(feature = "std")] + #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))] pub fn new(error: E) -> Self where E: StdError + Send + Sync + 'static, diff --git a/src/lib.rs b/src/lib.rs index 436dec6..5d72288 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -191,6 +191,7 @@ #![doc(html_root_url = "https://docs.rs/anyhow/1.0.27")] #![cfg_attr(backtrace, feature(backtrace))] +#![cfg_attr(doc_cfg, feature(doc_cfg))] #![cfg_attr(not(feature = "std"), no_std)] #![allow( clippy::needless_doctest_main,