rust/tests/coverage/assert-ne.rs
Zalathar dc6def3042 coverage: Add tests/coverage/assert-ne.rs
This test extracts a fragment of `issue-84561.rs` that has historically proven
troublesome when trying to modify how spans are extracted from MIR.
2024-06-12 22:38:16 +10:00

23 lines
486 B
Rust

//@ edition: 2021
use core::hint::black_box;
#[derive(Debug, PartialEq)]
struct Foo(u32);
fn main() {
assert_ne!(
Foo(5), // Make sure this expression's span isn't lost.
if black_box(false) {
Foo(0) //
} else {
Foo(1) //
}
);
()
}
// This test is a short fragment extracted from `issue-84561.rs`, highlighting
// a particular span of code that can easily be lost if overlapping spans are
// processed incorrectly.