coverage: Handle fn signature spans more consistently near ?

This commit is contained in:
Zalathar 2023-10-17 18:58:35 +11:00
parent dca42959bc
commit a17ff82aae
6 changed files with 23 additions and 21 deletions

View File

@ -80,7 +80,7 @@ impl CoverageSpan {
expn_span: fn_sig_span,
current_macro_or_none: Default::default(),
bcb: START_BCB,
merged_spans: vec![],
merged_spans: vec![fn_sig_span],
is_closure: false,
}
}

View File

@ -7,30 +7,30 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 10, 1) to (start + 4, 2)
Function name: fn_sig_into_try::b
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 12, 05, 00, 0f, 00, 00, 0f, 00, 10, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 10, 01, 02, 0f, 00, 02, 0f, 00, 10, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 18, 5) to (start + 0, 15)
- Code(Zero) at (prev + 0, 15) to (start + 0, 16)
- Code(Counter(0)) at (prev + 16, 1) to (start + 2, 15)
- Code(Zero) at (prev + 2, 15) to (start + 0, 16)
- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)
= (c1 + (c0 - c1))
Function name: fn_sig_into_try::c
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 18, 0d, 00, 17, 00, 00, 17, 00, 18, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
Raw bytes (28): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 16, 01, 02, 17, 00, 02, 17, 00, 18, 02, 01, 05, 00, 0c, 07, 01, 01, 00, 02]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 24, 13) to (start + 0, 23)
- Code(Zero) at (prev + 0, 23) to (start + 0, 24)
- Code(Counter(0)) at (prev + 22, 1) to (start + 2, 23)
- Code(Zero) at (prev + 2, 23) to (start + 0, 24)
- Code(Expression(0, Sub)) at (prev + 1, 5) to (start + 0, 12)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 1) to (start + 0, 2)

View File

@ -31,13 +31,15 @@ Number of file 0 mappings: 2
- Code(Counter(0)) at (prev + 7, 6) to (start + 2, 2)
Function name: inline_dead::main::{closure#0}
Raw bytes (16): 0x[01, 01, 01, 01, 05, 02, 00, 09, 0d, 00, 0e, 03, 02, 05, 00, 06]
Raw bytes (23): 0x[01, 01, 02, 09, 06, 01, 05, 03, 01, 07, 17, 00, 18, 00, 02, 0d, 00, 0e, 03, 02, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 1
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
Number of file 0 mappings: 2
- Code(Zero) at (prev + 9, 13) to (start + 0, 14)
Number of expressions: 2
- expression 0 operands: lhs = Counter(2), rhs = Expression(1, Sub)
- expression 1 operands: lhs = Counter(0), rhs = Counter(1)
Number of file 0 mappings: 3
- Code(Counter(0)) at (prev + 7, 23) to (start + 0, 24)
- Code(Zero) at (prev + 2, 13) to (start + 0, 14)
- Code(Expression(0, Add)) at (prev + 2, 5) to (start + 0, 6)
= (c0 + c1)
= (c2 + (c0 - c1))

View File

@ -7,15 +7,15 @@ Number of file 0 mappings: 1
- Code(Counter(0)) at (prev + 4, 10) to (start + 0, 19)
Function name: <issue_84561::Foo as core::fmt::Debug>::fmt
Raw bytes (29): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 89, 01, 09, 00, 25, 05, 00, 25, 00, 26, 02, 01, 09, 00, 0f, 07, 01, 05, 00, 06]
Raw bytes (29): 0x[01, 01, 02, 01, 05, 05, 02, 04, 01, 88, 01, 05, 01, 25, 05, 01, 25, 00, 26, 02, 01, 09, 00, 0f, 07, 01, 05, 00, 06]
Number of files: 1
- file 0 => global file 1
Number of expressions: 2
- expression 0 operands: lhs = Counter(0), rhs = Counter(1)
- expression 1 operands: lhs = Counter(1), rhs = Expression(0, Sub)
Number of file 0 mappings: 4
- Code(Counter(0)) at (prev + 137, 9) to (start + 0, 37)
- Code(Counter(1)) at (prev + 0, 37) to (start + 0, 38)
- Code(Counter(0)) at (prev + 136, 5) to (start + 1, 37)
- Code(Counter(1)) at (prev + 1, 37) to (start + 0, 38)
- Code(Expression(0, Sub)) at (prev + 1, 9) to (start + 0, 15)
= (c0 - c1)
- Code(Expression(1, Add)) at (prev + 1, 5) to (start + 0, 6)

View File

@ -13,15 +13,15 @@
LL| 1| Some(0)
LL| 1|}
LL| |
LL| |fn b() -> Option<i32>
LL| |{
LL| 1|fn b() -> Option<i32>
LL| 1|{
LL| 1| Some(7i32)?;
^0
LL| 1| Some(0)
LL| 1|}
LL| |
LL| |fn c() -> Option<i32>
LL| |{
LL| 1|fn c() -> Option<i32>
LL| 1|{
LL| 1| let _ = Some(7i32)?;
^0
LL| 1| Some(0)

View File

@ -135,7 +135,7 @@
LL| 0|}
LL| |
LL| |impl std::fmt::Debug for Foo {
LL| | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
LL| 7| fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
LL| 7| write!(f, "try and succeed")?;
^0
LL| 7| Ok(())