]> git.lizzy.rs Git - rust.git/blob - src/test/ui/test-attrs/test-attr-non-associated-functions.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / test-attrs / test-attr-non-associated-functions.rs
1 // #[test] attribute is not allowed on associated functions or methods
2 // reworded error message
3 // compile-flags:--test
4
5 struct A {}
6
7 impl A {
8     #[test]
9     fn new() -> A {
10         //~^ ERROR `#[test]` attribute is only allowed on non associated functions
11         A {}
12     }
13     #[test]
14     fn recovery_witness() -> A {
15         //~^ ERROR `#[test]` attribute is only allowed on non associated functions
16         A {}
17     }
18 }
19
20 #[test]
21 fn test() {
22     let _ = A::new();
23 }
24
25 fn main() {}