1
Fork 0

Fix crate_type attribute to not warn on duplicates

This commit is contained in:
Eric Huss 2022-04-10 16:35:37 -07:00
parent 027a232755
commit be23ead9a4
3 changed files with 45 additions and 61 deletions

View file

@ -310,7 +310,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
// Crate properties: // Crate properties:
ungated!(crate_name, CrateLevel, template!(NameValueStr: "name"), FutureWarnFollowing), ungated!(crate_name, CrateLevel, template!(NameValueStr: "name"), FutureWarnFollowing),
ungated!(crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), FutureWarnFollowing), ungated!(crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), DuplicatesOk),
// crate_id is deprecated // crate_id is deprecated
ungated!(crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing), ungated!(crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing),

View file

@ -13,9 +13,6 @@
#![crate_name = "unused_attr_duplicate"] #![crate_name = "unused_attr_duplicate"]
#![crate_name = "unused_attr_duplicate2"] //~ ERROR unused attribute #![crate_name = "unused_attr_duplicate2"] //~ ERROR unused attribute
//~^ WARN this was previously accepted //~^ WARN this was previously accepted
#![crate_type = "bin"]
#![crate_type = "rlib"] //~ ERROR unused attribute
//~^ WARN this was previously accepted
#![recursion_limit = "128"] #![recursion_limit = "128"]
#![recursion_limit = "256"] //~ ERROR unused attribute #![recursion_limit = "256"] //~ ERROR unused attribute
//~^ WARN this was previously accepted //~^ WARN this was previously accepted

View file

@ -1,5 +1,5 @@
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:36:1 --> $DIR/unused-attr-duplicate.rs:33:1
| |
LL | #[no_link] LL | #[no_link]
| ^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^ help: remove this attribute
@ -10,180 +10,180 @@ note: the lint level is defined here
LL | #![deny(unused_attributes)] LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:35:1 --> $DIR/unused-attr-duplicate.rs:32:1
| |
LL | #[no_link] LL | #[no_link]
| ^^^^^^^^^^ | ^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:40:1 --> $DIR/unused-attr-duplicate.rs:37:1
| |
LL | #[macro_use] LL | #[macro_use]
| ^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:39:1 --> $DIR/unused-attr-duplicate.rs:36:1
| |
LL | #[macro_use] LL | #[macro_use]
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:50:1 --> $DIR/unused-attr-duplicate.rs:47:1
| |
LL | #[path = "bar.rs"] LL | #[path = "bar.rs"]
| ^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:49:1 --> $DIR/unused-attr-duplicate.rs:46:1
| |
LL | #[path = "auxiliary/lint_unused_extern_crate.rs"] LL | #[path = "auxiliary/lint_unused_extern_crate.rs"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:56:1 --> $DIR/unused-attr-duplicate.rs:53:1
| |
LL | #[ignore = "some text"] LL | #[ignore = "some text"]
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:55:1 --> $DIR/unused-attr-duplicate.rs:52:1
| |
LL | #[ignore] LL | #[ignore]
| ^^^^^^^^^ | ^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:58:1 --> $DIR/unused-attr-duplicate.rs:55:1
| |
LL | #[should_panic(expected = "values don't match")] LL | #[should_panic(expected = "values don't match")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:57:1 --> $DIR/unused-attr-duplicate.rs:54:1
| |
LL | #[should_panic] LL | #[should_panic]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:63:1 --> $DIR/unused-attr-duplicate.rs:60:1
| |
LL | #[must_use = "some message"] LL | #[must_use = "some message"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:62:1 --> $DIR/unused-attr-duplicate.rs:59:1
| |
LL | #[must_use] LL | #[must_use]
| ^^^^^^^^^^^ | ^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:69:1 --> $DIR/unused-attr-duplicate.rs:66:1
| |
LL | #[non_exhaustive] LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:68:1 --> $DIR/unused-attr-duplicate.rs:65:1
| |
LL | #[non_exhaustive] LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:73:1 --> $DIR/unused-attr-duplicate.rs:70:1
| |
LL | #[automatically_derived] LL | #[automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:72:1 --> $DIR/unused-attr-duplicate.rs:69:1
| |
LL | #[automatically_derived] LL | #[automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:77:1 --> $DIR/unused-attr-duplicate.rs:74:1
| |
LL | #[inline(never)] LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:76:1 --> $DIR/unused-attr-duplicate.rs:73:1
| |
LL | #[inline(always)] LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:80:1 --> $DIR/unused-attr-duplicate.rs:77:1
| |
LL | #[cold] LL | #[cold]
| ^^^^^^^ help: remove this attribute | ^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:79:1 --> $DIR/unused-attr-duplicate.rs:76:1
| |
LL | #[cold] LL | #[cold]
| ^^^^^^^ | ^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:82:1 --> $DIR/unused-attr-duplicate.rs:79:1
| |
LL | #[track_caller] LL | #[track_caller]
| ^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:81:1 --> $DIR/unused-attr-duplicate.rs:78:1
| |
LL | #[track_caller] LL | #[track_caller]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:95:1 --> $DIR/unused-attr-duplicate.rs:92:1
| |
LL | #[export_name = "exported_symbol_name"] LL | #[export_name = "exported_symbol_name"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:97:1 --> $DIR/unused-attr-duplicate.rs:94:1
| |
LL | #[export_name = "exported_symbol_name2"] LL | #[export_name = "exported_symbol_name2"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:101:1 --> $DIR/unused-attr-duplicate.rs:98:1
| |
LL | #[no_mangle] LL | #[no_mangle]
| ^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:100:1 --> $DIR/unused-attr-duplicate.rs:97:1
| |
LL | #[no_mangle] LL | #[no_mangle]
| ^^^^^^^^^^^^ | ^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:105:1 --> $DIR/unused-attr-duplicate.rs:102:1
| |
LL | #[used] LL | #[used]
| ^^^^^^^ help: remove this attribute | ^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:104:1 --> $DIR/unused-attr-duplicate.rs:101:1
| |
LL | #[used] LL | #[used]
| ^^^^^^^ | ^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:89:5 --> $DIR/unused-attr-duplicate.rs:86:5
| |
LL | #[link_name = "this_does_not_exist"] LL | #[link_name = "this_does_not_exist"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:91:5 --> $DIR/unused-attr-duplicate.rs:88:5
| |
LL | #[link_name = "rust_dbg_extern_identity_u32"] LL | #[link_name = "rust_dbg_extern_identity_u32"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -205,102 +205,89 @@ LL | #![crate_name = "unused_attr_duplicate"]
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:17:1 --> $DIR/unused-attr-duplicate.rs:17:1
| |
LL | #![crate_type = "rlib"]
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:16:1
|
LL | #![crate_type = "bin"]
| ^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute
--> $DIR/unused-attr-duplicate.rs:20:1
|
LL | #![recursion_limit = "256"] LL | #![recursion_limit = "256"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:19:1 --> $DIR/unused-attr-duplicate.rs:16:1
| |
LL | #![recursion_limit = "128"] LL | #![recursion_limit = "128"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:23:1 --> $DIR/unused-attr-duplicate.rs:20:1
| |
LL | #![type_length_limit = "1"] LL | #![type_length_limit = "1"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:22:1 --> $DIR/unused-attr-duplicate.rs:19:1
| |
LL | #![type_length_limit = "1048576"] LL | #![type_length_limit = "1048576"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:26:1 --> $DIR/unused-attr-duplicate.rs:23:1
| |
LL | #![no_std] LL | #![no_std]
| ^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:25:1 --> $DIR/unused-attr-duplicate.rs:22:1
| |
LL | #![no_std] LL | #![no_std]
| ^^^^^^^^^^ | ^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:28:1 --> $DIR/unused-attr-duplicate.rs:25:1
| |
LL | #![no_implicit_prelude] LL | #![no_implicit_prelude]
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:27:1 --> $DIR/unused-attr-duplicate.rs:24:1
| |
LL | #![no_implicit_prelude] LL | #![no_implicit_prelude]
| ^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:30:1 --> $DIR/unused-attr-duplicate.rs:27:1
| |
LL | #![windows_subsystem = "windows"] LL | #![windows_subsystem = "windows"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:29:1 --> $DIR/unused-attr-duplicate.rs:26:1
| |
LL | #![windows_subsystem = "console"] LL | #![windows_subsystem = "console"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:33:1 --> $DIR/unused-attr-duplicate.rs:30:1
| |
LL | #![no_builtins] LL | #![no_builtins]
| ^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:32:1 --> $DIR/unused-attr-duplicate.rs:29:1
| |
LL | #![no_builtins] LL | #![no_builtins]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: unused attribute error: unused attribute
--> $DIR/unused-attr-duplicate.rs:43:5 --> $DIR/unused-attr-duplicate.rs:40:5
| |
LL | #[macro_export] LL | #[macro_export]
| ^^^^^^^^^^^^^^^ help: remove this attribute | ^^^^^^^^^^^^^^^ help: remove this attribute
| |
note: attribute also specified here note: attribute also specified here
--> $DIR/unused-attr-duplicate.rs:42:5 --> $DIR/unused-attr-duplicate.rs:39:5
| |
LL | #[macro_export] LL | #[macro_export]
| ^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^
error: aborting due to 24 previous errors error: aborting due to 23 previous errors