From 58202ef9c485223603582c63325f553da230fcb9 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Fri, 13 Aug 2021 17:47:08 -0700 Subject: [PATCH] Add doc_cfg for annotations on nightly Signed-off-by: Joe Richey --- Cargo.toml | 3 ++- src/instructions/interrupts.rs | 2 +- src/instructions/mod.rs | 2 +- src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1bc113a86..e476b63d7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,10 +37,11 @@ cc = { version = "1.0.37", optional = true } default = [ "nightly", "instructions" ] instructions = [] external_asm = [ "cc" ] -nightly = [ "inline_asm", "const_fn", "abi_x86_interrupt" ] +nightly = [ "inline_asm", "const_fn", "abi_x86_interrupt", "doc_cfg" ] inline_asm = [] abi_x86_interrupt = [] const_fn = [] +doc_cfg = [] [package.metadata.release] no-dev-version = true diff --git a/src/instructions/interrupts.rs b/src/instructions/interrupts.rs index f1d171cf8..6b6fe4769 100644 --- a/src/instructions/interrupts.rs +++ b/src/instructions/interrupts.rs @@ -153,7 +153,7 @@ pub fn int3() { /// immediate. This macro will be replaced by a generic function when support for /// const generics is implemented in Rust. #[cfg(feature = "inline_asm")] -#[cfg_attr(docsrs, doc(cfg(any(feature = "nightly", feature = "inline_asm"))))] +#[cfg_attr(feature = "doc_cfg", doc(cfg(any(feature = "nightly", feature = "inline_asm"))))] #[macro_export] macro_rules! software_interrupt { ($x:expr) => {{ diff --git a/src/instructions/mod.rs b/src/instructions/mod.rs index de1c4c3fa..875291571 100644 --- a/src/instructions/mod.rs +++ b/src/instructions/mod.rs @@ -54,7 +54,7 @@ pub fn bochs_breakpoint() { /// Gets the current instruction pointer. Note that this is only approximate as it requires a few /// instructions to execute. #[cfg(feature = "inline_asm")] -#[cfg_attr(docsrs, doc(cfg(any(feature = "nightly", feature = "inline_asm"))))] +#[cfg_attr(feature = "doc_cfg", doc(cfg(any(feature = "nightly", feature = "inline_asm"))))] #[inline(always)] pub fn read_rip() -> crate::VirtAddr { let rip: u64; diff --git a/src/lib.rs b/src/lib.rs index cf146e31a..73a6c5061 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ #![cfg_attr(feature = "const_fn", feature(const_fn_trait_bound))] // PageSize marker trait #![cfg_attr(feature = "inline_asm", feature(asm))] #![cfg_attr(feature = "abi_x86_interrupt", feature(abi_x86_interrupt))] -#![cfg_attr(docsrs, feature(doc_cfg))] +#![cfg_attr(feature = "doc_cfg", feature(doc_cfg))] #![warn(missing_docs)] #![deny(missing_debug_implementations)]