rust/tests/coverage/assert-ne.rs
Zalathar e80a3e2232 coverage: Tweak tests/coverage/assert-ne.rs
This test is intended to demonstrate that a particular macro-argument span
doesn't get lost during span-refinement, but it turns out that span-extraction
currently doesn't yield any MIR spans for this position.

This patch therefore tweaks the test to add a function call in that position,
so that it still remains relevant to span refinement.
2025-04-01 13:07:33 +11:00

22 lines
497 B
Rust

//@ edition: 2021
use core::hint::black_box;
#[derive(Debug, PartialEq)]
struct Foo(u32);
fn main() {
assert_ne!(
black_box(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.