1 // Tests for repeating attribute warnings.
2 // aux-build:lint_unused_extern_crate.rs
3 // compile-flags:--test
4 // Not tested due to extra requirements:
5 // - panic_handler: needs extra setup
6 // - target_feature: platform-specific
7 // - link_section: platform-specific
8 // - proc_macro, proc_macro_derive, proc_macro_attribute: needs to be a
9 // proc-macro, and have special handling for mixing.
10 // - unstable attributes (not going to bother)
11 // - no_main: extra setup
12 #![deny(unused_attributes)]
13 #![crate_name = "unused_attr_duplicate"]
14 #![crate_name = "unused_attr_duplicate2"] //~ ERROR unused attribute
15 //~^ WARN this was previously accepted
16 #![recursion_limit = "128"]
17 #![recursion_limit = "256"] //~ ERROR unused attribute
18 //~^ WARN this was previously accepted
19 #![type_length_limit = "1048576"]
20 #![type_length_limit = "1"] //~ ERROR unused attribute
21 //~^ WARN this was previously accepted
23 #![no_std] //~ ERROR unused attribute
24 #![no_implicit_prelude]
25 #![no_implicit_prelude] //~ ERROR unused attribute
26 #![windows_subsystem = "console"]
27 #![windows_subsystem = "windows"] //~ ERROR unused attribute
28 //~^ WARN this was previously accepted
30 #![no_builtins] //~ ERROR unused attribute
33 #[no_link] //~ ERROR unused attribute
34 extern crate lint_unused_extern_crate;
37 #[macro_use] //~ ERROR unused attribute
40 #[macro_export] //~ ERROR unused attribute
46 #[path = "auxiliary/lint_unused_extern_crate.rs"]
47 #[path = "bar.rs"] //~ ERROR unused attribute
48 //~^ WARN this was previously accepted
53 #[ignore = "some text"] //~ ERROR unused attribute
55 #[should_panic(expected = "values don't match")] //~ ERROR unused attribute
56 //~^ WARN this was previously accepted
60 #[must_use = "some message"] //~ ERROR unused attribute
61 //~^ WARN this was previously accepted
62 // No warnings for #[repr], would require more logic.
66 #[non_exhaustive] //~ ERROR unused attribute
69 #[automatically_derived]
70 #[automatically_derived] //~ ERROR unused attribute
74 #[inline(never)] //~ ERROR unused attribute
75 //~^ WARN this was previously accepted
77 #[cold] //~ ERROR unused attribute
79 #[track_caller] //~ ERROR unused attribute
82 // No warnings for #[link], would require more logic.
83 #[link(name = "rust_test_helpers", kind = "static")]
84 #[link(name = "rust_test_helpers", kind = "static")]
86 #[link_name = "this_does_not_exist"] //~ ERROR unused attribute
87 //~^ WARN this was previously accepted
88 #[link_name = "rust_dbg_extern_identity_u32"]
89 pub fn name_in_rust(v: u32) -> u32;
92 #[export_name = "exported_symbol_name"] //~ ERROR unused attribute
93 //~^ WARN this was previously accepted
94 #[export_name = "exported_symbol_name2"]
95 pub fn export_test() {}
98 #[no_mangle] //~ ERROR unused attribute
99 pub fn no_mangle_test() {}
102 #[used] //~ ERROR unused attribute