2023-10-17 07:41:10 +00:00
|
|
|
#![feature(coverage_attribute)]
|
2024-01-12 06:12:45 +00:00
|
|
|
//@ edition: 2021
|
2023-10-17 07:41:10 +00:00
|
|
|
|
|
|
|
// Regression test for inconsistent handling of function signature spans that
|
|
|
|
// are followed by code using the `?` operator.
|
|
|
|
//
|
|
|
|
// For each of these similar functions, the line containing the function
|
|
|
|
// signature should be handled in the same way.
|
|
|
|
|
|
|
|
fn a() -> Option<i32>
|
2024-01-16 03:12:10 +00:00
|
|
|
//
|
2023-10-17 07:41:10 +00:00
|
|
|
{
|
|
|
|
Some(7i32);
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn b() -> Option<i32>
|
2024-01-16 03:12:10 +00:00
|
|
|
//
|
2023-10-17 07:41:10 +00:00
|
|
|
{
|
|
|
|
Some(7i32)?;
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn c() -> Option<i32>
|
2024-01-16 03:12:10 +00:00
|
|
|
//
|
2023-10-17 07:41:10 +00:00
|
|
|
{
|
|
|
|
let _ = Some(7i32)?;
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn d() -> Option<i32>
|
2024-01-16 03:12:10 +00:00
|
|
|
//
|
2023-10-17 07:41:10 +00:00
|
|
|
{
|
|
|
|
let _: () = ();
|
|
|
|
Some(7i32)?;
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[coverage(off)]
|
|
|
|
fn main() {
|
|
|
|
a();
|
|
|
|
b();
|
|
|
|
c();
|
|
|
|
d();
|
|
|
|
}
|