Merge pull request #78 from dtolnay/cfg

Use doc_cfg to mark Error::new
This commit is contained in:
David Tolnay 2020-03-30 16:20:09 -07:00 committed by GitHub
commit e2eb1f5263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 0 deletions

View File

@ -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"]

View File

@ -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<E>(error: E) -> Self
where
E: StdError + Send + Sync + 'static,

View File

@ -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,