forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#126630 - GuillaumeGomez:rollup-hlwbpa2, r=Gui…
…llaumeGomez Rollup of 5 pull requests Successful merges: - rust-lang#125988 (Migrate `run-make/used` to `rmake.rs`) - rust-lang#126500 (Migrate `error-found-staticlib-instead-crate`, `output-filename-conflicts-with-directory`, `output-filename-overwrites-input`, `native-link-modifier-verbatim-rustc` and `native-link-verbatim-linker` `run-make` tests to `rmake.rs` format) - rust-lang#126583 (interpret: better error when we ran out of memory) - rust-lang#126587 (coverage: Add debugging flag `-Zcoverage-options=no-mir-spans`) - rust-lang#126621 (More thorough status-quo tests for `#[coverage(..)]`) r? `@ghost` `@rustbot` modify labels: rollup
- Loading branch information
Showing
34 changed files
with
992 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
Function name: <<<nested::MyOuter as nested::MyTrait>::trait_method::MyMiddle as nested::MyTrait>::trait_method::MyInner as nested::MyTrait>::trait_method (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 39, 15, 02, 16] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 57, 21) to (start + 2, 22) | ||
|
||
Function name: <<<nested::MyOuter>::outer_method::MyMiddle>::middle_method::MyInner>::inner_method (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 23, 15, 02, 16] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 35, 21) to (start + 2, 22) | ||
|
||
Function name: <<nested::MyOuter as nested::MyTrait>::trait_method::MyMiddle as nested::MyTrait>::trait_method (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 36, 0d, 08, 0e] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 54, 13) to (start + 8, 14) | ||
|
||
Function name: <<nested::MyOuter>::outer_method::MyMiddle>::middle_method (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 20, 0d, 08, 0e] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 32, 13) to (start + 8, 14) | ||
|
||
Function name: nested::closure_expr | ||
Raw bytes (14): 0x[01, 01, 00, 02, 01, 44, 01, 01, 0f, 01, 0b, 05, 01, 02] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 2 | ||
- Code(Counter(0)) at (prev + 68, 1) to (start + 1, 15) | ||
- Code(Counter(0)) at (prev + 11, 5) to (start + 1, 2) | ||
|
||
Function name: nested::closure_expr::{closure#0}::{closure#0} (unused) | ||
Raw bytes (14): 0x[01, 01, 00, 02, 00, 47, 1a, 01, 17, 00, 04, 0d, 01, 0a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 2 | ||
- Code(Zero) at (prev + 71, 26) to (start + 1, 23) | ||
- Code(Zero) at (prev + 4, 13) to (start + 1, 10) | ||
|
||
Function name: nested::closure_expr::{closure#0}::{closure#0}::{closure#0} (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 48, 1d, 02, 0e] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 72, 29) to (start + 2, 14) | ||
|
||
Function name: nested::closure_tail | ||
Raw bytes (14): 0x[01, 01, 00, 02, 01, 53, 01, 01, 0f, 01, 11, 05, 01, 02] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 2 | ||
- Code(Counter(0)) at (prev + 83, 1) to (start + 1, 15) | ||
- Code(Counter(0)) at (prev + 17, 5) to (start + 1, 2) | ||
|
||
Function name: nested::closure_tail::{closure#0}::{closure#0} (unused) | ||
Raw bytes (14): 0x[01, 01, 00, 02, 00, 58, 14, 01, 1f, 00, 06, 15, 01, 12] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 2 | ||
- Code(Zero) at (prev + 88, 20) to (start + 1, 31) | ||
- Code(Zero) at (prev + 6, 21) to (start + 1, 18) | ||
|
||
Function name: nested::closure_tail::{closure#0}::{closure#0}::{closure#0} (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 5a, 1c, 02, 1a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 90, 28) to (start + 2, 26) | ||
|
||
Function name: nested::outer_fn::middle_fn (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 11, 05, 05, 06] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 17, 5) to (start + 5, 6) | ||
|
||
Function name: nested::outer_fn::middle_fn::inner_fn (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 12, 09, 02, 0a] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 18, 9) to (start + 2, 10) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
LL| |#![feature(coverage_attribute, stmt_expr_attributes)] | ||
LL| |//@ edition: 2021 | ||
LL| | | ||
LL| |// Demonstrates the interaction between #[coverage(off)] and various kinds of | ||
LL| |// nested function. | ||
LL| | | ||
LL| |// FIXME(#126625): Coverage attributes should apply recursively to nested functions. | ||
LL| |// FIXME(#126626): When an inner (non-closure) function has `#[coverage(off)]`, | ||
LL| |// its lines can still be marked with misleading execution counts from its enclosing | ||
LL| |// function. | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |fn do_stuff() {} | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |fn outer_fn() { | ||
LL| 0| fn middle_fn() { | ||
LL| 0| fn inner_fn() { | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| | do_stuff(); | ||
LL| |} | ||
LL| | | ||
LL| |struct MyOuter; | ||
LL| |impl MyOuter { | ||
LL| | #[coverage(off)] | ||
LL| | fn outer_method(&self) { | ||
LL| | struct MyMiddle; | ||
LL| | impl MyMiddle { | ||
LL| 0| fn middle_method(&self) { | ||
LL| 0| struct MyInner; | ||
LL| 0| impl MyInner { | ||
LL| 0| fn inner_method(&self) { | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| 0| } | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| | } | ||
LL| | do_stuff(); | ||
LL| | } | ||
LL| |} | ||
LL| | | ||
LL| |trait MyTrait { | ||
LL| | fn trait_method(&self); | ||
LL| |} | ||
LL| |impl MyTrait for MyOuter { | ||
LL| | #[coverage(off)] | ||
LL| | fn trait_method(&self) { | ||
LL| | struct MyMiddle; | ||
LL| | impl MyTrait for MyMiddle { | ||
LL| 0| fn trait_method(&self) { | ||
LL| 0| struct MyInner; | ||
LL| 0| impl MyTrait for MyInner { | ||
LL| 0| fn trait_method(&self) { | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| 0| } | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| | } | ||
LL| | do_stuff(); | ||
LL| | } | ||
LL| |} | ||
LL| | | ||
LL| 1|fn closure_expr() { | ||
LL| 1| let _outer = #[coverage(off)] | ||
LL| | || { | ||
LL| 0| let _middle = || { | ||
LL| 0| let _inner = || { | ||
LL| 0| do_stuff(); | ||
LL| 0| }; | ||
LL| 0| do_stuff(); | ||
LL| 0| }; | ||
LL| | do_stuff(); | ||
LL| | }; | ||
LL| 1| do_stuff(); | ||
LL| 1|} | ||
LL| | | ||
LL| |// This syntax is allowed, even without #![feature(stmt_expr_attributes)]. | ||
LL| 1|fn closure_tail() { | ||
LL| 1| let _outer = { | ||
LL| | #[coverage(off)] | ||
LL| | || { | ||
LL| | let _middle = { | ||
LL| 0| || { | ||
LL| 0| let _inner = { | ||
LL| 0| || { | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| | }; | ||
LL| 0| do_stuff(); | ||
LL| 0| } | ||
LL| | }; | ||
LL| | do_stuff(); | ||
LL| | } | ||
LL| | }; | ||
LL| 1| do_stuff(); | ||
LL| 1|} | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |fn main() { | ||
LL| | outer_fn(); | ||
LL| | MyOuter.outer_method(); | ||
LL| | MyOuter.trait_method(); | ||
LL| | closure_expr(); | ||
LL| | closure_tail(); | ||
LL| |} | ||
|
Oops, something went wrong.