summaryrefslogtreecommitdiffstats
path: root/tests/coverage/fn_sig_into_try.coverage
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /tests/coverage/fn_sig_into_try.coverage
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/coverage/fn_sig_into_try.coverage')
-rw-r--r--tests/coverage/fn_sig_into_try.coverage45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/coverage/fn_sig_into_try.coverage b/tests/coverage/fn_sig_into_try.coverage
new file mode 100644
index 000000000..f1ddb1da7
--- /dev/null
+++ b/tests/coverage/fn_sig_into_try.coverage
@@ -0,0 +1,45 @@
+ LL| |#![feature(coverage_attribute)]
+ LL| |// compile-flags: --edition=2021
+ LL| |
+ LL| |// Regression test for inconsistent handling of function signature spans that
+ LL| |// are followed by code using the `?` operator.
+ LL| |//
+ LL| |// For each of these similar functions, the line containing the function
+ LL| |// signature should be handled in the same way.
+ LL| |
+ LL| 1|fn a() -> Option<i32>
+ LL| 1|{
+ LL| 1| Some(7i32);
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| 1|fn b() -> Option<i32>
+ LL| 1|{
+ LL| 1| Some(7i32)?;
+ ^0
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| 1|fn c() -> Option<i32>
+ LL| 1|{
+ LL| 1| let _ = Some(7i32)?;
+ ^0
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| 1|fn d() -> Option<i32>
+ LL| 1|{
+ LL| 1| let _: () = ();
+ LL| 1| Some(7i32)?;
+ ^0
+ LL| 1| Some(0)
+ LL| 1|}
+ LL| |
+ LL| |#[coverage(off)]
+ LL| |fn main() {
+ LL| | a();
+ LL| | b();
+ LL| | c();
+ LL| | d();
+ LL| |}
+