Open
Description
In the following example, both doctests pass, even though they are identical except for the annotation (one of them is no_run
, the other compile_fail
).
Command to run: cargo test --doc -Zdoctest-xcompile -Zbuild-std=core,panic_abort --target riscv32imac-unknown-none-elf
[package]
name = "rustdoc-issue"
version = "0.1.0"
edition = "2024"
[dependencies]
esp-hal = { version = "1.0.0-beta.0", features = ["esp32c6", "unstable"] }
#![no_std]
#[macro_export]
macro_rules! pre {
() => {
r#"
# #![no_std]
# #![no_main]
#
# use esp_hal as _;
#
# #[panic_handler]
# fn panic(_ : &core::panic::PanicInfo) -> ! {
# loop {}
# }
# fn example() {
"#
};
}
/// ```rust,compile_fail
#[doc = crate::pre!()]
/// let mut x = 5;
/// x += 2;
/// }
/// ```
fn _foo() {}
/// ```rust,no_run
#[doc = crate::pre!()]
/// let mut x = 5;
/// x += 2;
/// }
/// ```
fn _foo2() {}
Since the no_run test case compiles, I would expect the compile_fail example to fail. I can only trigger this behaviour if I reference esp_hal
- I'm not sure if other third party dependencies would trigger it. Without the external dependency, the annotation works as expected.
rustc --version
rustc 1.88.0-nightly (092a284ba 2025-04-13)
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status