Skip to content

Commit 8f7e5d6

Browse files
committed
Don't use compile_error!
Also, update the docs attrube to point to both relevant features. Signed-off-by: Joe Richey <[email protected]>
1 parent 951d2ba commit 8f7e5d6

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

src/instructions/interrupts.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,11 @@ pub fn int3() {
152152
/// This currently needs to be a macro because the `int` argument needs to be an
153153
/// immediate. This macro will be replaced by a generic function when support for
154154
/// const generics is implemented in Rust.
155-
#[cfg_attr(docsrs, doc(cfg(feature = "nightly")))]
155+
#[cfg(feature = "inline_asm")]
156+
#[cfg_attr(docsrs, doc(cfg(any(feature = "nightly", feature = "inline_asm"))))]
156157
#[macro_export]
157158
macro_rules! software_interrupt {
158159
($x:expr) => {{
159-
#[cfg(feature = "inline_asm")]
160160
asm!("int {id}", id = const $x, options(nomem, nostack));
161-
162-
#[cfg(not(feature = "inline_asm"))]
163-
compile_error!("software_interrupt!() requires \"nightly\" feature");
164161
}};
165162
}

src/instructions/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,13 @@ pub fn bochs_breakpoint() {
5353

5454
/// Gets the current instruction pointer. Note that this is only approximate as it requires a few
5555
/// instructions to execute.
56-
#[cfg_attr(docsrs, doc(cfg(feature = "nightly")))]
56+
#[cfg(feature = "inline_asm")]
57+
#[cfg_attr(docsrs, doc(cfg(any(feature = "nightly", feature = "inline_asm"))))]
5758
#[inline(always)]
5859
pub fn read_rip() -> crate::VirtAddr {
5960
let rip: u64;
60-
#[cfg(feature = "inline_asm")]
6161
unsafe {
6262
asm!("lea {}, [rip]", out(reg) rip, options(nostack, nomem, preserves_flags));
6363
}
64-
65-
#[cfg(not(feature = "inline_asm"))]
66-
compile_error!("read_rip() requires \"nightly\" feature");
6764
crate::VirtAddr::new(rip)
6865
}

0 commit comments

Comments
 (0)