Skip to content

Commit 9056e9f

Browse files
committed
Add a test for coverage attr on trait function
1 parent 3bf62cc commit 9056e9f

File tree

3 files changed

+56
-0
lines changed

3 files changed

+56
-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, 0f, 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 + 15, 5) to (start + 2, 6)
8+
Highest counter ID seen: c0
9+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
LL| |// Checks that `#[coverage(..)]` in a trait method is not inherited in an
2+
LL| |// implementation.
3+
LL| |//@ reference: attributes.coverage.trait-impl-inherit
4+
LL| |
5+
LL| |trait T {
6+
LL| | #[coverage(off)]
7+
LL| | fn f(&self) {
8+
LL| | println!("default");
9+
LL| | }
10+
LL| |}
11+
LL| |
12+
LL| |struct S;
13+
LL| |
14+
LL| |impl T for S {
15+
LL| 1| fn f(&self) {
16+
LL| 1| println!("impl S");
17+
LL| 1| }
18+
LL| |}
19+
LL| |
20+
LL| |#[coverage(off)]
21+
LL| |fn main() {
22+
LL| | S.f();
23+
LL| |}
24+
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Checks that `#[coverage(..)]` in a trait method is not inherited in an
2+
// implementation.
3+
//@ reference: attributes.coverage.trait-impl-inherit
4+
5+
trait T {
6+
#[coverage(off)]
7+
fn f(&self) {
8+
println!("default");
9+
}
10+
}
11+
12+
struct S;
13+
14+
impl T for S {
15+
fn f(&self) {
16+
println!("impl S");
17+
}
18+
}
19+
20+
#[coverage(off)]
21+
fn main() {
22+
S.f();
23+
}

0 commit comments

Comments
 (0)