summaryrefslogtreecommitdiffstats
path: root/tests/ui/test-attrs/test-attr-non-associated-functions.rs
blob: 31e567c396067495eb1e8c9b55d7cda283faa659 (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
// #[test] attribute is not allowed on associated functions or methods
// reworded error message
// compile-flags:--test

struct A {}

impl A {
    #[test]
    fn new() -> A {
        //~^ ERROR `#[test]` attribute is only allowed on non associated functions
        A {}
    }
    #[test]
    fn recovery_witness() -> A {
        //~^ ERROR `#[test]` attribute is only allowed on non associated functions
        A {}
    }
}

#[test]
fn test() {
    let _ = A::new();
}

fn main() {}