]> git.lizzy.rs Git - rust.git/blob - src/test/ui/attributes/duplicated-attributes.rs
Require Drop impls to have the same constness on its bounds as the bounds on the...
[rust.git] / src / test / ui / attributes / duplicated-attributes.rs
1 // Test that, if an item is annotated with a builtin attribute more than once, a warning is
2 // emitted.
3 // Tests https://github.com/rust-lang/rust/issues/90979
4
5 // check-pass
6 // compile-flags: --test
7
8 #![feature(test)]
9 #![feature(cfg_eval)]
10
11 #[test]
12 #[test]
13 //~^ WARNING duplicated attribute
14 fn f() {}
15
16 // The following shouldn't trigger an error. The attribute is not duplicated.
17 #[test]
18 fn f2() {}
19
20 // The following shouldn't trigger an error either. The second attribute is not #[test].
21 #[test]
22 #[inline]
23 fn f3() {}
24
25 extern crate test;
26 use test::Bencher;
27
28 #[bench]
29 #[bench]
30 //~^ WARNING duplicated attribute
31 fn f4(_: &mut Bencher) {}
32
33 #[cfg_eval]
34 #[cfg_eval]
35 //~^ WARNING duplicated attribute
36 struct S;
37
38 #[cfg_eval]
39 struct S2;
40
41 fn main() {}