Closed
Description
[INFO] [stdout] error: module should be marked with the `#[cfg(test)]` attribute
[INFO] [stdout]
[INFO] [stdout] = help: add `#[cfg(test)]` to the module
[INFO] [stdout]
[INFO] [stdout] --> crates/after-test_test/src/lib.rs:3:1
[INFO] [stdout] |
[INFO] [stdout] 3 | / mod panics {
[INFO] [stdout] 4 | | fn panic_with_message() {
[INFO] [stdout] 5 | | panic!("This is a panic message");
[INFO] [stdout] ... |
[INFO] [stdout] 10 | | fn test_should_panic() {}
[INFO] [stdout] 11 | | }
[INFO] [stdout] | |_^
(and several more like that)
That particular error message comes from their own proc-macro. The module does have the expected attribute, but I suppose something must have changed in how we provide that to the macro.
#[after_test::cleanup(panic_with_message)]
#[cfg(test)]
mod panics {
fn panic_with_message() {
panic!("This is a panic message");
}
#[test]
#[should_panic(expected = "This is a panic message")]
fn test_should_panic() {}
}
Version it worked on
It most recently worked on: 1.86.0
Version with regression
rustc 1.87.0-beta.5 (386abeb93 2025-04-19)
in crater #139827.
@rustbot modify labels: +regression-from-stable-to-beta -regression-untriaged
Metadata
Metadata
Assignees
Labels
Area: Attributes (`#[…]`, `#![…]`)Area: `cfg` conditional compilationArea: Procedural macrosCategory: This is a bug.Status: A bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issuePerformance or correctness regression from stable to beta.