Merge pull request #374 from dtolnay/docsrs
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Rely on docs.rs to define --cfg=docsrs by default
authored by David Tolnay · committed by GitHub · parents 8ea1819, 004e701 · Browse files · 4 files·+9 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+9 added−10 removed
- other:+9 added−10 removed
Provenance
- Commit
e6c730e- Tree
06afc28- Author
David Tolnay <dtolnay@gmail.com>- Committer
GitHub <noreply@github.com>- Parent 1
8ea1819- Parent 2
004e701
4 files changed+9 added−10 removed
modified:src/error.rs+6 added-6 removed
24 unmodified lines25 ///26 /// If the error type does not provide a backtrace, a backtrace will be27 /// created here to ensure that a backtrace exists.28 #[cfg(feature = "std")]29- #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]29+ #[cfg_attr(docsrs, doc(cfg(feature = "std")))]30 #[cold]31 #[must_use]32 pub fn new<E>(error: E) -> Self33 where365 unmodified lines399 /// None400 /// }401 /// ```402 #[cfg(feature = "std")]403- #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]403+ #[cfg_attr(docsrs, doc(cfg(feature = "std")))]404 #[cold]405 pub fn chain(&self) -> Chain {406 unsafe { ErrorImpl::chain(self.inner.by_ref()) }407 }3 unmodified lines411 ///412 /// The root cause is the last error in the iterator produced by413 /// [`chain()`][Error::chain].414 #[cfg(feature = "std")]415- #[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]415+ #[cfg_attr(docsrs, doc(cfg(feature = "std")))]416 pub fn root_cause(&self) -> &(dyn StdError + 'static) {417 self.chain().last().unwrap()418 }419 134 unmodified lines554 }555 }556 557 #[cfg(feature = "std")]558-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]558+#[cfg_attr(docsrs, doc(cfg(feature = "std")))]559 impl<E> From<E> for Error560 where561 E: StdError + Send + Sync + 'static,562 {4 unmodified lines567 }568 }569 570 #[cfg(feature = "std")]571-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]571+#[cfg_attr(docsrs, doc(cfg(feature = "std")))]572 impl Deref for Error {573 type Target = dyn StdError + Send + Sync + 'static;574 575 fn deref(&self) -> &Self::Target {1 unmodified line577 }578 }579 580 #[cfg(feature = "std")]581-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]581+#[cfg_attr(docsrs, doc(cfg(feature = "std")))]582 impl DerefMut for Error {583 fn deref_mut(&mut self) -> &mut Self::Target {584 unsafe { ErrorImpl::error_mut(self.inner.by_mut()) }585 }439 unmodified linesmodified:src/lib.rs+2 added-2 removed
206 unmodified lines207 //! non-Anyhow error type inside a function that returns Anyhow's error type.208 209 #![doc(html_root_url = "https://docs.rs/anyhow/1.0.85")]210 #![cfg_attr(error_generic_member_access, feature(error_generic_member_access))]211-#![cfg_attr(doc_cfg, feature(doc_cfg))]211+#![cfg_attr(docsrs, feature(doc_cfg))]212 #![no_std]213 #![deny(dead_code, unused_imports, unused_mut)]214 #![cfg_attr(215 not(anyhow_no_unsafe_op_in_unsafe_fn_lint),191 unmodified lines407 /// None408 /// }409 /// ```410 #[cfg(feature = "std")]411-#[cfg_attr(doc_cfg, doc(cfg(feature = "std")))]411+#[cfg_attr(docsrs, doc(cfg(feature = "std")))]412 #[derive(Clone)]413 pub struct Chain<'a> {414 state: crate::chain::ChainState<'a>,415 }315 unmodified linesmodified:build.rs-1 removed
68 unmodified lines69 println!("cargo:rustc-check-cfg=cfg(anyhow_nightly_testing)");70 println!("cargo:rustc-check-cfg=cfg(anyhow_no_fmt_arguments_as_str)");71 println!("cargo:rustc-check-cfg=cfg(anyhow_no_ptr_addr_of)");72 println!("cargo:rustc-check-cfg=cfg(anyhow_no_unsafe_op_in_unsafe_fn_lint)");73- println!("cargo:rustc-check-cfg=cfg(doc_cfg)");73 println!("cargo:rustc-check-cfg=cfg(error_generic_member_access)");74 println!("cargo:rustc-check-cfg=cfg(std_backtrace)");75 }76 102 unmodified linesmodified:Cargo.toml+1 added-1 removed
32 unmodified lines33343536373732 unmodified linesdoc-scrape-examples = false
[package.metadata.docs.rs]targets = ["x86_64-unknown-linux-gnu"]rustdoc-args = ["--cfg", "doc_cfg", "--generate-link-to-definition"]rustdoc-args = ["--generate-link-to-definition"]