Closed
Description
Code
I tried this code:
/// ```
/// # if cfg!(miri) { return; }
/// use playground::my_func;
///
/// fn main() {
/// println!("Hi!");
/// my_func();
/// }
/// ```
pub fn my_func() {
}
On stable, running this doctest succeeds. On beta, it triggers this error:
running 1 test
test src/lib.rs - my_func (line 2) ... FAILED
failures:
---- src/lib.rs - my_func (line 2) stdout ----
error: expected item, found keyword `if`
--> src/lib.rs:4:1
|
4 | if cfg!(miri) { return; }
| ^^ expected item
|
= note: for a full list of items that can appear in modules, see <https://doc.rust-lang.org/reference/items.html>
error: aborting due to 1 previous error
Couldn't compile the test.
failures:
src/lib.rs - my_func (line 2)
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
Version it worked on
It most recently worked on: Latest stable (i.e. rustc 1.86.0)
Version with regression
rustc --version --verbose
:
rustc 1.87.0-beta.5 (386abeb93 2025-04-19)
binary: rustc
commit-hash: 386abeb93ab8e683357f54ffe76ae53861b2d984
commit-date: 2025-04-19
host: x86_64-unknown-linux-gnu
release: 1.87.0-beta.5
LLVM version: 20.1.1
@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Done