Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_attr_parsing/src/target_checking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub(crate) fn allowed_targets_applied(
];
const IMPL_LIKE: &[Target] =
&[Target::Impl { of_trait: false }, Target::Impl { of_trait: true }];
const ADT_LIKE: &[Target] = &[Target::Struct, Target::Enum];
const ADT_LIKE: &[Target] = &[Target::Struct, Target::Enum, Target::Union];

let mut added_fake_targets = Vec::new();
filter_targets(
Expand Down
6 changes: 3 additions & 3 deletions tests/ui/attributes/attr-on-mac-call.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ LL | #[deprecated]
| ^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, unions, and use statements
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements

warning: `#[inline]` attribute cannot be used on macro calls
--> $DIR/attr-on-mac-call.rs:24:5
Expand Down Expand Up @@ -136,7 +136,7 @@ LL | #[deprecated]
| ^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, unions, and use statements
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements

warning: `#[automatically_derived]` attribute cannot be used on macro calls
--> $DIR/attr-on-mac-call.rs:51:5
Expand All @@ -163,7 +163,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

warning: `#[no_implicit_prelude]` attribute cannot be used on macro calls
--> $DIR/attr-on-mac-call.rs:60:5
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/deprecation/deprecated-expr-precedence.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | #[deprecated] 0
| ^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, unions, and use statements
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements
= note: requested on the command line with `-W unused-attributes`

error[E0308]: mismatched types
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/deprecation/deprecation-sanity.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ LL | #[deprecated = "hello"]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, unions, and use statements
= help: `#[deprecated]` can be applied to associated consts, associated types, constants, crates, data types, enum variants, foreign statics, functions, inherent impl blocks, macro defs, modules, statics, struct fields, traits, type aliases, and use statements
= note: `#[deny(useless_deprecated)]` on by default

error: aborting due to 10 previous errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

warning: `#[must_use]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:17
Expand All @@ -1064,7 +1064,7 @@ LL | mod inner { #![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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

warning: `#[must_use]` attribute cannot be used on type aliases
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:775:5
Expand All @@ -1073,7 +1073,7 @@ LL | #[must_use] type T = S;
| ^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

warning: `#[must_use]` attribute cannot be used on inherent impl blocks
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:780:5
Expand All @@ -1082,7 +1082,7 @@ LL | #[must_use] impl S { }
| ^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

warning: crate-level attribute should be an inner attribute: add an exclamation mark: `#![windows_subsystem]`
--> $DIR/issue-43106-gating-of-builtin-attrs.rs:786:1
Expand Down Expand Up @@ -1635,7 +1635,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

warning: 175 warnings emitted

2 changes: 1 addition & 1 deletion tests/ui/lint/fn_must_use.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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!
= help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions
= help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, and traits
= note: requested on the command line with `-W unused-attributes`

warning: unused return value of `need_to_use_this_value` that must be used
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lint/must_not_suspend/other_items.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `#[must_not_suspend]` attribute cannot be used on modules
LL | #[must_not_suspend]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[must_not_suspend]` can be applied to data types, traits, and unions
= help: `#[must_not_suspend]` can be applied to data types and traits

error: aborting due to 1 previous error

2 changes: 1 addition & 1 deletion tests/ui/lint/must_not_suspend/return.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ error: `#[must_not_suspend]` attribute cannot be used on functions
LL | #[must_not_suspend]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[must_not_suspend]` can be applied to data types, traits, and unions
= help: `#[must_not_suspend]` can be applied to data types and traits

error: aborting due to 1 previous error

44 changes: 22 additions & 22 deletions tests/ui/lint/unused/unused_attributes-must_use.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits
note: the lint level is defined here
--> $DIR/unused_attributes-must_use.rs:4:9
|
Expand All @@ -19,7 +19,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on modules
--> $DIR/unused_attributes-must_use.rs:11:1
Expand All @@ -28,7 +28,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on use statements
--> $DIR/unused_attributes-must_use.rs:15:1
Expand All @@ -37,7 +37,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on constants
--> $DIR/unused_attributes-must_use.rs:19:1
Expand All @@ -46,7 +46,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on statics
--> $DIR/unused_attributes-must_use.rs:22:1
Expand All @@ -55,7 +55,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on inherent impl blocks
--> $DIR/unused_attributes-must_use.rs:40:1
Expand All @@ -64,7 +64,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on foreign modules
--> $DIR/unused_attributes-must_use.rs:55:1
Expand All @@ -73,7 +73,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on foreign statics
--> $DIR/unused_attributes-must_use.rs:59:5
Expand All @@ -82,7 +82,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on type aliases
--> $DIR/unused_attributes-must_use.rs:73:1
Expand All @@ -91,7 +91,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on type parameters
--> $DIR/unused_attributes-must_use.rs:77:8
Expand All @@ -100,7 +100,7 @@ LL | fn qux<#[must_use] T>(_: T) {}
| ^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on associated consts
--> $DIR/unused_attributes-must_use.rs:82:5
Expand All @@ -109,7 +109,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on associated types
--> $DIR/unused_attributes-must_use.rs:85:5
Expand All @@ -118,7 +118,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on trait impl blocks
--> $DIR/unused_attributes-must_use.rs:95:1
Expand All @@ -127,7 +127,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on trait methods in impl blocks
--> $DIR/unused_attributes-must_use.rs:100:5
Expand All @@ -136,7 +136,7 @@ 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!
= help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, traits, and unions
= help: `#[must_use]` can be applied to data types, foreign functions, functions, inherent methods, provided trait methods, required trait methods, and traits

error: `#[must_use]` attribute cannot be used on trait aliases
--> $DIR/unused_attributes-must_use.rs:107:1
Expand All @@ -145,7 +145,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on macro defs
--> $DIR/unused_attributes-must_use.rs:111:1
Expand All @@ -154,7 +154,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on statements
--> $DIR/unused_attributes-must_use.rs:120:5
Expand All @@ -163,7 +163,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on closures
--> $DIR/unused_attributes-must_use.rs:125:13
Expand All @@ -172,7 +172,7 @@ LL | let x = #[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!
= help: `#[must_use]` can be applied to data types, foreign functions, functions, methods, traits, and unions
= help: `#[must_use]` can be applied to data types, foreign functions, functions, methods, and traits

error: `#[must_use]` attribute cannot be used on match arms
--> $DIR/unused_attributes-must_use.rs:148:9
Expand All @@ -181,7 +181,7 @@ 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!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on struct fields
--> $DIR/unused_attributes-must_use.rs:157:28
Expand All @@ -190,7 +190,7 @@ LL | let s = PatternField { #[must_use] foo: 123 };
| ^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: `#[must_use]` attribute cannot be used on pattern fields
--> $DIR/unused_attributes-must_use.rs:159:24
Expand All @@ -199,7 +199,7 @@ LL | let PatternField { #[must_use] foo } = s;
| ^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[must_use]` can be applied to data types, functions, traits, and unions
= help: `#[must_use]` can be applied to data types, functions, and traits

error: unused `X` that must be used
--> $DIR/unused_attributes-must_use.rs:130:5
Expand Down
Loading
Loading