2023-10-17 02:41:10 -05:00
|
|
|
#![feature(coverage_attribute)]
|
2024-01-12 00:12:45 -06:00
|
|
|
// edition: 2021
|
2023-10-17 02:41:10 -05: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-15 21:12:10 -06:00
|
|
|
//
|
2023-10-17 02:41:10 -05:00
|
|
|
{
|
|
|
|
Some(7i32);
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn b() -> Option<i32>
|
2024-01-15 21:12:10 -06:00
|
|
|
//
|
2023-10-17 02:41:10 -05:00
|
|
|
{
|
|
|
|
Some(7i32)?;
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn c() -> Option<i32>
|
2024-01-15 21:12:10 -06:00
|
|
|
//
|
2023-10-17 02:41:10 -05:00
|
|
|
{
|
|
|
|
let _ = Some(7i32)?;
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn d() -> Option<i32>
|
2024-01-15 21:12:10 -06:00
|
|
|
//
|
2023-10-17 02:41:10 -05:00
|
|
|
{
|
|
|
|
let _: () = ();
|
|
|
|
Some(7i32)?;
|
|
|
|
Some(0)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[coverage(off)]
|
|
|
|
fn main() {
|
|
|
|
a();
|
|
|
|
b();
|
|
|
|
c();
|
|
|
|
d();
|
|
|
|
}
|