about summary refs log tree commit diff
path: root/tests/coverage/attr/trait-impl-inherit.rs
blob: 951fecce90a18b08f5e4d74513ce1b5cc82db5a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#![feature(coverage_attribute)]
// Checks that `#[coverage(..)]` in a trait method is not inherited in an
// implementation.
//@ edition: 2021
//@ reference: attributes.coverage.trait-impl-inherit

trait T {
    #[coverage(off)]
    fn f(&self) {
        println!("default");
    }
}

struct S;

impl T for S {
    fn f(&self) {
        println!("impl S");
    }
}

#[coverage(off)]
fn main() {
    S.f();
}