about summary refs log tree commit diff
path: root/tests/coverage/assert-ne.coverage
diff options
context:
space:
mode:
authorZalathar <Zalathar@users.noreply.github.com>2024-06-11 22:13:40 +1000
committerZalathar <Zalathar@users.noreply.github.com>2024-06-12 22:38:16 +1000
commitdc6def3042074f38e7c6bdaba3038fb2b1f0e2aa (patch)
tree025116663fb5b47eff78ba2c777901ad205fc81e /tests/coverage/assert-ne.coverage
parent02c7a5921e3de5c2b3ecb2e0082c1dafce0729a1 (diff)
downloadrust-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.coverage')
-rw-r--r--tests/coverage/assert-ne.coverage23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/coverage/assert-ne.coverage b/tests/coverage/assert-ne.coverage
new file mode 100644
index 00000000000..236a8fd1385
--- /dev/null
+++ b/tests/coverage/assert-ne.coverage
@@ -0,0 +1,23 @@
+   LL|       |//@ edition: 2021
+   LL|       |
+   LL|       |use core::hint::black_box;
+   LL|       |
+   LL|       |#[derive(Debug, PartialEq)]
+   LL|       |struct Foo(u32);
+   LL|       |
+   LL|      1|fn main() {
+   LL|      1|    assert_ne!(
+   LL|      1|        Foo(5), // Make sure this expression's span isn't lost.
+   LL|      1|        if black_box(false) {
+   LL|      0|            Foo(0) //
+   LL|       |        } else {
+   LL|      1|            Foo(1) //
+   LL|       |        }
+   LL|       |    );
+   LL|      1|    ()
+   LL|      1|}
+   LL|       |
+   LL|       |// This test is a short fragment extracted from `issue-84561.rs`, highlighting
+   LL|       |// a particular span of code that can easily be lost if overlapping spans are
+   LL|       |// processed incorrectly.
+