Skip to content

Commit 0efa90f

Browse files
ehussZalathar
authored andcommitted
Add a test for coverage attr on trait function
1 parent 85c3989 commit 0efa90f

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Function name: <trait_impl_inherit::S as trait_impl_inherit::T>::f
2+
Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 05, 02, 06]
3+
Number of files: 1
4+
- file 0 => global file 1
5+
Number of expressions: 0
6+
Number of file 0 mappings: 1
7+
- Code(Counter(0)) at (prev + 17, 5) to (start + 2, 6)
8+
Highest counter ID seen: c0
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
LL| |#![feature(coverage_attribute)]
2+
LL| |// Checks that `#[coverage(..)]` in a trait method is not inherited in an
3+
LL| |// implementation.
4+
LL| |//@ edition: 2021
5+
LL| |//@ reference: attributes.coverage.trait-impl-inherit
6+
LL| |
7+
LL| |trait T {
8+
LL| | #[coverage(off)]
9+
LL| | fn f(&self) {
10+
LL| | println!("default");
11+
LL| | }
12+
LL| |}
13+
LL| |
14+
LL| |struct S;
15+
LL| |
16+
LL| |impl T for S {
17+
LL| 1| fn f(&self) {
18+
LL| 1| println!("impl S");
19+
LL| 1| }
20+
LL| |}
21+
LL| |
22+
LL| |#[coverage(off)]
23+
LL| |fn main() {
24+
LL| | S.f();
25+
LL| |}
26+
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#![feature(coverage_attribute)]
2+
// Checks that `#[coverage(..)]` in a trait method is not inherited in an
3+
// implementation.
4+
//@ edition: 2021
5+
//@ reference: attributes.coverage.trait-impl-inherit
6+
7+
trait T {
8+
#[coverage(off)]
9+
fn f(&self) {
10+
println!("default");
11+
}
12+
}
13+
14+
struct S;
15+
16+
impl T for S {
17+
fn f(&self) {
18+
println!("impl S");
19+
}
20+
}
21+
22+
#[coverage(off)]
23+
fn main() {
24+
S.f();
25+
}

0 commit comments

Comments
 (0)