Use doc_cfg to mark Error::new

This commit is contained in:
David Tolnay 2020-03-30 16:15:30 -07:00
parent e46df9f4a5
commit d65ec5ed2f
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
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,