-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
coverage: Allow
#[coverage(..)]
on impl
and mod
These attributes apply to all enclosed functions/methods/closures, unless explicitly overridden by another coverage attribute.
- Loading branch information
Showing
13 changed files
with
253 additions
and
170 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Function name: <impl::MyStruct>::off_on (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 0e, 05, 00, 13] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 14, 5) to (start + 0, 19) | ||
|
||
Function name: <impl::MyStruct>::on_inherit (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 16, 05, 00, 17] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 22, 5) to (start + 0, 23) | ||
|
||
Function name: <impl::MyStruct>::on_on (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 19, 05, 00, 12] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 25, 5) to (start + 0, 18) | ||
|
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,42 @@ | ||
LL| |#![feature(coverage_attribute)] | ||
LL| |//@ edition: 2021 | ||
LL| | | ||
LL| |// Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, | ||
LL| |// and is inherited by any enclosed functions. | ||
LL| | | ||
LL| |struct MyStruct; | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |impl MyStruct { | ||
LL| | fn off_inherit() {} | ||
LL| | | ||
LL| | #[coverage(on)] | ||
LL| 0| fn off_on() {} | ||
LL| | | ||
LL| | #[coverage(off)] | ||
LL| | fn off_off() {} | ||
LL| |} | ||
LL| | | ||
LL| |#[coverage(on)] | ||
LL| |impl MyStruct { | ||
LL| 0| fn on_inherit() {} | ||
LL| | | ||
LL| | #[coverage(on)] | ||
LL| 0| fn on_on() {} | ||
LL| | | ||
LL| | #[coverage(off)] | ||
LL| | fn on_off() {} | ||
LL| |} | ||
LL| | | ||
LL| |trait MyTrait { | ||
LL| | fn method(); | ||
LL| |} | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |impl MyTrait for MyStruct { | ||
LL| | fn method() {} | ||
LL| |} | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |fn main() {} | ||
|
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,41 @@ | ||
#![feature(coverage_attribute)] | ||
//@ edition: 2021 | ||
|
||
// Checks that `#[coverage(..)]` can be applied to impl and impl-trait blocks, | ||
// and is inherited by any enclosed functions. | ||
|
||
struct MyStruct; | ||
|
||
#[coverage(off)] | ||
impl MyStruct { | ||
fn off_inherit() {} | ||
|
||
#[coverage(on)] | ||
fn off_on() {} | ||
|
||
#[coverage(off)] | ||
fn off_off() {} | ||
} | ||
|
||
#[coverage(on)] | ||
impl MyStruct { | ||
fn on_inherit() {} | ||
|
||
#[coverage(on)] | ||
fn on_on() {} | ||
|
||
#[coverage(off)] | ||
fn on_off() {} | ||
} | ||
|
||
trait MyTrait { | ||
fn method(); | ||
} | ||
|
||
#[coverage(off)] | ||
impl MyTrait for MyStruct { | ||
fn method() {} | ||
} | ||
|
||
#[coverage(off)] | ||
fn main() {} |
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,24 @@ | ||
Function name: module::off::on (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 0c, 05, 00, 0f] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 12, 5) to (start + 0, 15) | ||
|
||
Function name: module::on::inherit (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 14, 05, 00, 14] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 20, 5) to (start + 0, 20) | ||
|
||
Function name: module::on::on (unused) | ||
Raw bytes (9): 0x[01, 01, 00, 01, 00, 17, 05, 00, 0f] | ||
Number of files: 1 | ||
- file 0 => global file 1 | ||
Number of expressions: 0 | ||
Number of file 0 mappings: 1 | ||
- Code(Zero) at (prev + 23, 5) to (start + 0, 15) | ||
|
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,38 @@ | ||
LL| |#![feature(coverage_attribute)] | ||
LL| |//@ edition: 2021 | ||
LL| | | ||
LL| |// Checks that `#[coverage(..)]` can be applied to modules, and is inherited | ||
LL| |// by any enclosed functions. | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |mod off { | ||
LL| | fn inherit() {} | ||
LL| | | ||
LL| | #[coverage(on)] | ||
LL| 0| fn on() {} | ||
LL| | | ||
LL| | #[coverage(off)] | ||
LL| | fn off() {} | ||
LL| |} | ||
LL| | | ||
LL| |#[coverage(on)] | ||
LL| |mod on { | ||
LL| 0| fn inherit() {} | ||
LL| | | ||
LL| | #[coverage(on)] | ||
LL| 0| fn on() {} | ||
LL| | | ||
LL| | #[coverage(off)] | ||
LL| | fn off() {} | ||
LL| |} | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |mod nested_a { | ||
LL| | mod nested_b { | ||
LL| | fn inner() {} | ||
LL| | } | ||
LL| |} | ||
LL| | | ||
LL| |#[coverage(off)] | ||
LL| |fn main() {} | ||
|
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,37 @@ | ||
#![feature(coverage_attribute)] | ||
//@ edition: 2021 | ||
|
||
// Checks that `#[coverage(..)]` can be applied to modules, and is inherited | ||
// by any enclosed functions. | ||
|
||
#[coverage(off)] | ||
mod off { | ||
fn inherit() {} | ||
|
||
#[coverage(on)] | ||
fn on() {} | ||
|
||
#[coverage(off)] | ||
fn off() {} | ||
} | ||
|
||
#[coverage(on)] | ||
mod on { | ||
fn inherit() {} | ||
|
||
#[coverage(on)] | ||
fn on() {} | ||
|
||
#[coverage(off)] | ||
fn off() {} | ||
} | ||
|
||
#[coverage(off)] | ||
mod nested_a { | ||
mod nested_b { | ||
fn inner() {} | ||
} | ||
} | ||
|
||
#[coverage(off)] | ||
fn main() {} |
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
Oops, something went wrong.