diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-06-11 22:13:40 +1000 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-06-12 22:38:16 +1000 |
| commit | dc6def3042074f38e7c6bdaba3038fb2b1f0e2aa (patch) | |
| tree | 025116663fb5b47eff78ba2c777901ad205fc81e /tests/coverage/assert-ne.rs | |
| parent | 02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1 (diff) | |
| download | rust-dc6def3042074f38e7c6bdaba3038fb2b1f0e2aa.tar.gz rust-dc6def3042074f38e7c6bdaba3038fb2b1f0e2aa.zip | |
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.
Diffstat (limited to 'tests/coverage/assert-ne.rs')
| -rw-r--r-- | tests/coverage/assert-ne.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/coverage/assert-ne.rs b/tests/coverage/assert-ne.rs new file mode 100644 index 00000000000..8a8fe089804 --- /dev/null +++ b/tests/coverage/assert-ne.rs @@ -0,0 +1,22 @@ +//@ 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. |
