Update uitests

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
Jonathan Brouwer
2025-08-09 20:41:01 +02:00
parent 5245c39972
commit 4bb7bf64e0
105 changed files with 2615 additions and 2433 deletions

View File

@@ -1,7 +0,0 @@
//@ known-bug: #138510
fn main()
where
#[repr()]
_: Sized,
{
}

View File

@@ -4,13 +4,13 @@ error: `#[doc(alias = "...")]` isn't allowed on foreign module
LL | #[doc(alias = "foo")]
| ^^^^^^^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on inherent implementation block
error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:10:7
|
LL | #[doc(alias = "bar")]
| ^^^^^^^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on trait implementation block
error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:16:7
|
LL | #[doc(alias = "foobar")]

View File

@@ -1,25 +1,25 @@
// Checks that the #[unsafe(naked)] attribute can be placed on function definitions only.
//
//@ needs-asm-support
#![unsafe(naked)] //~ ERROR should be applied to a function definition
#![unsafe(naked)] //~ ERROR attribute cannot be used on
use std::arch::naked_asm;
extern "C" {
#[unsafe(naked)] //~ ERROR should be applied to a function definition
#[unsafe(naked)] //~ ERROR attribute cannot be used on
fn f();
}
#[unsafe(naked)] //~ ERROR should be applied to a function definition
#[unsafe(naked)] //~ ERROR attribute cannot be used on
#[repr(C)]
struct S {
#[unsafe(naked)] //~ ERROR should be applied to a function definition
#[unsafe(naked)] //~ ERROR attribute cannot be used on
a: u32,
b: u32,
}
trait Invoke {
#[unsafe(naked)] //~ ERROR should be applied to a function definition
#[unsafe(naked)] //~ ERROR attribute cannot be used on
extern "C" fn invoke(&self);
}
@@ -48,7 +48,7 @@ impl S {
}
fn main() {
#[unsafe(naked)] //~ ERROR should be applied to a function definition
#[unsafe(naked)] //~ ERROR attribute cannot be used on
|| {};
}

View File

@@ -4,6 +4,54 @@ error[E0433]: failed to resolve: use of unresolved module or unlinked crate `a`
LL | #[::a]
| ^ use of unresolved module or unlinked crate `a`
error: `#[naked]` attribute cannot be used on crates
--> $DIR/naked-invalid-attr.rs:4:1
|
LL | #![unsafe(naked)]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[naked]` can only be applied to functions
error: `#[naked]` attribute cannot be used on foreign functions
--> $DIR/naked-invalid-attr.rs:9:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[naked]` can be applied to methods, functions
error: `#[naked]` attribute cannot be used on structs
--> $DIR/naked-invalid-attr.rs:13:1
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[naked]` can only be applied to functions
error: `#[naked]` attribute cannot be used on struct fields
--> $DIR/naked-invalid-attr.rs:16:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[naked]` can only be applied to functions
error: `#[naked]` attribute cannot be used on required trait methods
--> $DIR/naked-invalid-attr.rs:22:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[naked]` can be applied to functions, inherent methods, provided trait methods, trait methods in impl blocks
error: `#[naked]` attribute cannot be used on closures
--> $DIR/naked-invalid-attr.rs:51:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[naked]` can be applied to methods, functions
error[E0736]: attribute incompatible with `#[unsafe(naked)]`
--> $DIR/naked-invalid-attr.rs:56:3
|
@@ -13,57 +61,6 @@ LL | #[::a]
LL | #[unsafe(naked)]
| ---------------- function marked with `#[unsafe(naked)]` here
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:13:1
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
LL | #[repr(C)]
LL | / struct S {
LL | | #[unsafe(naked)]
LL | | a: u32,
LL | | b: u32,
LL | | }
| |_- not a function definition
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:16:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
LL | a: u32,
| ------ not a function definition
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:51:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
LL | || {};
| ----- not a function definition
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:22:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
LL | extern "C" fn invoke(&self);
| ---------------------------- not a function definition
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:9:5
|
LL | #[unsafe(naked)]
| ^^^^^^^^^^^^^^^^
LL | fn f();
| ------- not a function definition
error: attribute should be applied to a function definition
--> $DIR/naked-invalid-attr.rs:4:1
|
LL | #![unsafe(naked)]
| ^^^^^^^^^^^^^^^^^ cannot be applied to crates
error: aborting due to 8 previous errors
Some errors have detailed explanations: E0433, E0736.

View File

@@ -1,7 +1,7 @@
// This checks that incorrect params on function parameters are caught
fn function(#[inline] param: u32) {
//~^ ERROR attribute should be applied to function or closure
//~^ ERROR attribute cannot be used on
//~| ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes
}

View File

@@ -4,14 +4,13 @@ error: allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed
LL | fn function(#[inline] param: u32) {
| ^^^^^^^^^
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on function params
--> $DIR/attrs-on-params.rs:3:13
|
LL | fn function(#[inline] param: u32) {
| ^^^^^^^^^-----------
| |
| not a function or closure
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0518`.

View File

@@ -2,13 +2,13 @@
#![deny(unused_attributes)] //~ NOTE lint level is defined here
#[cold]
//~^ ERROR attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
struct Foo; //~ NOTE not a function
//~^ ERROR attribute cannot be used on
//~| WARN previously accepted
struct Foo;
fn main() {
#[cold]
//~^ ERROR attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
5; //~ NOTE not a function
//~^ ERROR attribute cannot be used on
//~| WARN previously accepted
5;
}

View File

@@ -1,29 +1,25 @@
error: attribute should be applied to a function definition
error: `#[cold]` attribute cannot be used on structs
--> $DIR/cold-attribute-application-54044.rs:4:1
|
LL | #[cold]
| ^^^^^^^
...
LL | struct Foo;
| ----------- not a function definition
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[cold]` can only be applied to functions
note: the lint level is defined here
--> $DIR/cold-attribute-application-54044.rs:2:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: attribute should be applied to a function definition
error: `#[cold]` attribute cannot be used on expressions
--> $DIR/cold-attribute-application-54044.rs:10:5
|
LL | #[cold]
| ^^^^^^^
...
LL | 5;
| - not a function definition
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[cold]` can only be applied to functions
error: aborting due to 2 previous errors

View File

@@ -0,0 +1,14 @@
// Regression test for https://github.com/rust-lang/rust/issues/138510
#![feature(where_clause_attrs)]
#![deny(unused_attributes)]
fn main() {
}
fn test() where
#[repr()]
//~^ ERROR unused attribute
(): Sized {
}

View File

@@ -0,0 +1,14 @@
error: unused attribute
--> $DIR/empty-repr.rs:10:1
|
LL | #[repr()]
| ^^^^^^^^^ help: remove this attribute
|
note: the lint level is defined here
--> $DIR/empty-repr.rs:4:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: aborting due to 1 previous error

View File

@@ -2,7 +2,7 @@
enum Foo {
#[inline]
//~^ ERROR attribute should be applied
//~^ ERROR attribute cannot be used on
Variant,
}

View File

@@ -1,12 +1,10 @@
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on enum variants
--> $DIR/inline-attribute-enum-variant-error.rs:4:5
|
LL | #[inline]
| ^^^^^^^^^
LL |
LL | Variant,
| ------- not a function or closure
|
= help: `#[inline]` can only be applied to functions
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0518`.

View File

@@ -4,7 +4,7 @@
#[inline]
fn f() {}
#[inline] //~ ERROR: attribute should be applied to function or closure
#[inline] //~ ERROR: attribute cannot be used on
struct S;
struct I {

View File

@@ -1,10 +1,10 @@
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on structs
--> $DIR/attr-usage-inline.rs:7:1
|
LL | #[inline]
| ^^^^^^^^^
LL | struct S;
| --------- not a function or closure
|
= help: `#[inline]` can only be applied to functions
error[E0518]: attribute should be applied to function or closure
--> $DIR/attr-usage-inline.rs:21:1

View File

@@ -3,5 +3,5 @@
fn main() {}
#[track_caller] //~ ERROR attribute should be applied to a function
#[track_caller] //~ ERROR attribute cannot be used on
static _A: () = ();

View File

@@ -1,11 +1,10 @@
error[E0739]: attribute should be applied to a function definition
error: `#[track_caller]` attribute cannot be used on statics
--> $DIR/issue-105594-invalid-attr-validation.rs:6:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
LL | static _A: () = ();
| ------------------- not a function definition
|
= help: `#[track_caller]` can only be applied to functions
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0739`.

View File

@@ -3,16 +3,16 @@
#![deny(unused_attributes)]
#![allow(dead_code)]
#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static
#[linkage = "weak"] //~ ERROR attribute cannot be used on
type InvalidTy = ();
#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static
#[linkage = "weak"] //~ ERROR attribute cannot be used on
mod invalid_module {}
#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static
#[linkage = "weak"] //~ ERROR attribute cannot be used on
struct F;
#[linkage = "weak"] //~ ERROR attribute should be applied to a function or static
#[linkage = "weak"] //~ ERROR attribute cannot be used on
impl F {
#[linkage = "weak"]
fn valid(&self) {}
@@ -24,7 +24,7 @@ fn f() {
{
1
};
//~^^^^ ERROR attribute should be applied to a function or static
//~^^^^ ERROR attribute cannot be used on
}
extern "C" {
@@ -38,5 +38,5 @@ extern "C" {
fn main() {
let _ = #[linkage = "weak"]
(|| 1);
//~^^ ERROR attribute should be applied to a function or static
//~^^ ERROR attribute cannot be used on
}

View File

@@ -1,55 +1,50 @@
error: attribute should be applied to a function or static
error: `#[linkage]` attribute cannot be used on type aliases
--> $DIR/linkage.rs:6:1
|
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
LL | type InvalidTy = ();
| -------------------- not a function definition or static
|
= help: `#[linkage]` can be applied to functions, statics, foreign statics
error: attribute should be applied to a function or static
error: `#[linkage]` attribute cannot be used on modules
--> $DIR/linkage.rs:9:1
|
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
LL | mod invalid_module {}
| --------------------- not a function definition or static
|
= help: `#[linkage]` can be applied to functions, statics, foreign statics
error: attribute should be applied to a function or static
error: `#[linkage]` attribute cannot be used on structs
--> $DIR/linkage.rs:12:1
|
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
LL | struct F;
| --------- not a function definition or static
|
= help: `#[linkage]` can be applied to functions, statics, foreign statics
error: attribute should be applied to a function or static
error: `#[linkage]` attribute cannot be used on inherent impl blocks
--> $DIR/linkage.rs:15:1
|
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
LL | / impl F {
LL | | #[linkage = "weak"]
LL | | fn valid(&self) {}
LL | | }
| |_- not a function definition or static
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[linkage]` can be applied to functions, statics, foreign statics
error: attribute should be applied to a function or static
error: `#[linkage]` attribute cannot be used on expressions
--> $DIR/linkage.rs:23:5
|
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
LL | / {
LL | | 1
LL | | };
| |_____- not a function definition or static
LL | #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[linkage]` can be applied to functions, statics, foreign statics
error: attribute should be applied to a function or static
error: `#[linkage]` attribute cannot be used on closures
--> $DIR/linkage.rs:39:13
|
LL | let _ = #[linkage = "weak"]
| ^^^^^^^^^^^^^^^^^^^
LL | (|| 1);
| ------ not a function definition or static
|
= help: `#[linkage]` can be applied to methods, functions, statics, foreign statics, foreign functions
error: aborting due to 6 previous errors

View File

@@ -3,5 +3,6 @@
#![inline = ""]
//~^ ERROR: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]` [ill_formed_attribute_input]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| ERROR attribute cannot be used on
fn main() {}

View File

@@ -1,3 +1,11 @@
error: `#[inline]` attribute cannot be used on crates
--> $DIR/lint_on_root.rs:3:1
|
LL | #![inline = ""]
| ^^^^^^^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
--> $DIR/lint_on_root.rs:3:1
|
@@ -8,7 +16,7 @@ LL | #![inline = ""]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` on by default
error: aborting due to 1 previous error
error: aborting due to 2 previous errors
Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`

View File

@@ -35,6 +35,7 @@
//~^ ERROR `allow_internal_unstable` expects a list of feature names
#[rustc_confusables]
//~^ ERROR malformed
//~| ERROR attribute cannot be used on
#[deprecated = 5]
//~^ ERROR malformed
#[doc]
@@ -42,9 +43,10 @@
//~| WARN this was previously accepted by the compiler
#[rustc_macro_transparency]
//~^ ERROR malformed
//~| ERROR attribute cannot be used on
#[repr]
//~^ ERROR malformed
//~| ERROR is not supported on function items
//~| ERROR is not supported on functions
#[rustc_as_ptr = 5]
//~^ ERROR malformed
#[inline = 5]
@@ -68,6 +70,7 @@
//~^ ERROR malformed
#[used()]
//~^ ERROR malformed
//~| ERROR attribute cannot be used on
#[crate_name]
//~^ ERROR malformed
#[doc]

View File

@@ -1,5 +1,5 @@
error[E0539]: malformed `cfg` attribute input
--> $DIR/malformed-attrs.rs:99:1
--> $DIR/malformed-attrs.rs:102:1
|
LL | #[cfg]
| ^^^^^^
@@ -10,7 +10,7 @@ LL | #[cfg]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: malformed `cfg_attr` attribute input
--> $DIR/malformed-attrs.rs:101:1
--> $DIR/malformed-attrs.rs:104:1
|
LL | #[cfg_attr]
| ^^^^^^^^^^^
@@ -22,7 +22,7 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
| ++++++++++++++++++++++++++++++++++++++++++++
error[E0463]: can't find crate for `wloop`
--> $DIR/malformed-attrs.rs:208:1
--> $DIR/malformed-attrs.rs:211:1
|
LL | extern crate wloop;
| ^^^^^^^^^^^^^^^^^^^ can't find crate
@@ -42,7 +42,7 @@ LL | #![windows_subsystem = "windows"]
| +++++++++++
error: malformed `crate_name` attribute input
--> $DIR/malformed-attrs.rs:71:1
--> $DIR/malformed-attrs.rs:74:1
|
LL | #[crate_name]
| ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]`
@@ -50,13 +50,13 @@ LL | #[crate_name]
= note: for more information, visit <https://doc.rust-lang.org/reference/crates-and-source-files.html#the-crate_name-attribute>
error: malformed `no_sanitize` attribute input
--> $DIR/malformed-attrs.rs:89:1
--> $DIR/malformed-attrs.rs:92:1
|
LL | #[no_sanitize]
| ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]`
error: malformed `instruction_set` attribute input
--> $DIR/malformed-attrs.rs:103:1
--> $DIR/malformed-attrs.rs:106:1
|
LL | #[instruction_set]
| ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]`
@@ -64,13 +64,13 @@ LL | #[instruction_set]
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-instruction_set-attribute>
error: malformed `patchable_function_entry` attribute input
--> $DIR/malformed-attrs.rs:105:1
--> $DIR/malformed-attrs.rs:108:1
|
LL | #[patchable_function_entry]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
error: malformed `must_not_suspend` attribute input
--> $DIR/malformed-attrs.rs:129:1
--> $DIR/malformed-attrs.rs:132:1
|
LL | #[must_not_suspend()]
| ^^^^^^^^^^^^^^^^^^^^^
@@ -85,13 +85,13 @@ LL + #[must_not_suspend]
|
error: malformed `cfi_encoding` attribute input
--> $DIR/malformed-attrs.rs:131:1
--> $DIR/malformed-attrs.rs:134:1
|
LL | #[cfi_encoding]
| ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]`
error: malformed `allow` attribute input
--> $DIR/malformed-attrs.rs:175:1
--> $DIR/malformed-attrs.rs:178:1
|
LL | #[allow]
| ^^^^^^^^
@@ -107,7 +107,7 @@ LL | #[allow(lint1, lint2, lint3, reason = "...")]
| +++++++++++++++++++++++++++++++++++++
error: malformed `expect` attribute input
--> $DIR/malformed-attrs.rs:177:1
--> $DIR/malformed-attrs.rs:180:1
|
LL | #[expect]
| ^^^^^^^^^
@@ -123,7 +123,7 @@ LL | #[expect(lint1, lint2, lint3, reason = "...")]
| +++++++++++++++++++++++++++++++++++++
error: malformed `warn` attribute input
--> $DIR/malformed-attrs.rs:179:1
--> $DIR/malformed-attrs.rs:182:1
|
LL | #[warn]
| ^^^^^^^
@@ -139,7 +139,7 @@ LL | #[warn(lint1, lint2, lint3, reason = "...")]
| +++++++++++++++++++++++++++++++++++++
error: malformed `deny` attribute input
--> $DIR/malformed-attrs.rs:181:1
--> $DIR/malformed-attrs.rs:184:1
|
LL | #[deny]
| ^^^^^^^
@@ -155,7 +155,7 @@ LL | #[deny(lint1, lint2, lint3, reason = "...")]
| +++++++++++++++++++++++++++++++++++++
error: malformed `forbid` attribute input
--> $DIR/malformed-attrs.rs:183:1
--> $DIR/malformed-attrs.rs:186:1
|
LL | #[forbid]
| ^^^^^^^^^
@@ -171,7 +171,7 @@ LL | #[forbid(lint1, lint2, lint3, reason = "...")]
| +++++++++++++++++++++++++++++++++++++
error: malformed `debugger_visualizer` attribute input
--> $DIR/malformed-attrs.rs:185:1
--> $DIR/malformed-attrs.rs:188:1
|
LL | #[debugger_visualizer]
| ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
@@ -179,13 +179,13 @@ LL | #[debugger_visualizer]
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/debugger.html#the-debugger_visualizer-attribute>
error: malformed `thread_local` attribute input
--> $DIR/malformed-attrs.rs:200:1
--> $DIR/malformed-attrs.rs:203:1
|
LL | #[thread_local()]
| ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]`
error: malformed `no_link` attribute input
--> $DIR/malformed-attrs.rs:204:1
--> $DIR/malformed-attrs.rs:207:1
|
LL | #[no_link()]
| ^^^^^^^^^^^^ help: must be of the form: `#[no_link]`
@@ -193,7 +193,7 @@ LL | #[no_link()]
= note: for more information, visit <https://doc.rust-lang.org/reference/items/extern-crates.html#the-no_link-attribute>
error: malformed `macro_export` attribute input
--> $DIR/malformed-attrs.rs:211:1
--> $DIR/malformed-attrs.rs:214:1
|
LL | #[macro_export = 18]
| ^^^^^^^^^^^^^^^^^^^^
@@ -209,25 +209,25 @@ LL + #[macro_export]
|
error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/malformed-attrs.rs:96:1
--> $DIR/malformed-attrs.rs:99:1
|
LL | #[proc_macro = 18]
| ^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/malformed-attrs.rs:113:1
--> $DIR/malformed-attrs.rs:116:1
|
LL | #[proc_macro_attribute = 19]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/malformed-attrs.rs:120:1
--> $DIR/malformed-attrs.rs:123:1
|
LL | #[proc_macro_derive]
| ^^^^^^^^^^^^^^^^^^^^
error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
--> $DIR/malformed-attrs.rs:213:1
--> $DIR/malformed-attrs.rs:216:1
|
LL | #[allow_internal_unsafe = 1]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -236,7 +236,7 @@ LL | #[allow_internal_unsafe = 1]
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:40:1
--> $DIR/malformed-attrs.rs:41:1
|
LL | #[doc]
| ^^^^^^
@@ -247,7 +247,7 @@ LL | #[doc]
= note: `#[deny(ill_formed_attribute_input)]` on by default
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:73:1
--> $DIR/malformed-attrs.rs:76:1
|
LL | #[doc]
| ^^^^^^
@@ -257,7 +257,7 @@ LL | #[doc]
= note: for more information, visit <https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html>
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`
--> $DIR/malformed-attrs.rs:80:1
--> $DIR/malformed-attrs.rs:83:1
|
LL | #[link]
| ^^^^^^^
@@ -267,7 +267,7 @@ LL | #[link]
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
error: invalid argument
--> $DIR/malformed-attrs.rs:185:1
--> $DIR/malformed-attrs.rs:188:1
|
LL | #[debugger_visualizer]
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -303,8 +303,16 @@ LL | #[rustc_confusables]
| expected this to be a list
| help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]`
error: `#[rustc_confusables]` attribute cannot be used on functions
--> $DIR/malformed-attrs.rs:36:1
|
LL | #[rustc_confusables]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_confusables]` can only be applied to inherent methods
error[E0539]: malformed `deprecated` attribute input
--> $DIR/malformed-attrs.rs:38:1
--> $DIR/malformed-attrs.rs:39:1
|
LL | #[deprecated = 5]
| ^^^^^^^^^^^^^^^-^
@@ -328,7 +336,7 @@ LL + #[deprecated(since = "version", note = "reason")]
= and 1 other candidate
error[E0539]: malformed `rustc_macro_transparency` attribute input
--> $DIR/malformed-attrs.rs:43:1
--> $DIR/malformed-attrs.rs:44:1
|
LL | #[rustc_macro_transparency]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -342,8 +350,16 @@ LL | #[rustc_macro_transparency = "semitransparent"]
LL | #[rustc_macro_transparency = "transparent"]
| +++++++++++++++
error: `#[rustc_macro_transparency]` attribute cannot be used on functions
--> $DIR/malformed-attrs.rs:44:1
|
LL | #[rustc_macro_transparency]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_macro_transparency]` can only be applied to macro defs
error[E0539]: malformed `repr` attribute input
--> $DIR/malformed-attrs.rs:45:1
--> $DIR/malformed-attrs.rs:47:1
|
LL | #[repr]
| ^^^^^^^ expected this to be a list
@@ -362,7 +378,7 @@ LL | #[repr(align(...))]
= and 2 other candidates
error[E0565]: malformed `rustc_as_ptr` attribute input
--> $DIR/malformed-attrs.rs:48:1
--> $DIR/malformed-attrs.rs:50:1
|
LL | #[rustc_as_ptr = 5]
| ^^^^^^^^^^^^^^^---^
@@ -371,7 +387,7 @@ LL | #[rustc_as_ptr = 5]
| help: must be of the form: `#[rustc_as_ptr]`
error[E0539]: malformed `rustc_align` attribute input
--> $DIR/malformed-attrs.rs:53:1
--> $DIR/malformed-attrs.rs:55:1
|
LL | #[rustc_align]
| ^^^^^^^^^^^^^^
@@ -380,7 +396,7 @@ LL | #[rustc_align]
| help: must be of the form: `#[rustc_align(<alignment in bytes>)]`
error[E0539]: malformed `optimize` attribute input
--> $DIR/malformed-attrs.rs:55:1
--> $DIR/malformed-attrs.rs:57:1
|
LL | #[optimize]
| ^^^^^^^^^^^ expected this to be a list
@@ -395,7 +411,7 @@ LL | #[optimize(speed)]
| +++++++
error[E0565]: malformed `cold` attribute input
--> $DIR/malformed-attrs.rs:57:1
--> $DIR/malformed-attrs.rs:59:1
|
LL | #[cold = 1]
| ^^^^^^^---^
@@ -404,13 +420,13 @@ LL | #[cold = 1]
| help: must be of the form: `#[cold]`
error: valid forms for the attribute are `#[must_use = "reason"]` and `#[must_use]`
--> $DIR/malformed-attrs.rs:59:1
--> $DIR/malformed-attrs.rs:61:1
|
LL | #[must_use()]
| ^^^^^^^^^^^^^
error[E0565]: malformed `no_mangle` attribute input
--> $DIR/malformed-attrs.rs:61:1
--> $DIR/malformed-attrs.rs:63:1
|
LL | #[no_mangle = 1]
| ^^^^^^^^^^^^---^
@@ -419,7 +435,7 @@ LL | #[no_mangle = 1]
| help: must be of the form: `#[no_mangle]`
error[E0565]: malformed `naked` attribute input
--> $DIR/malformed-attrs.rs:63:1
--> $DIR/malformed-attrs.rs:65:1
|
LL | #[unsafe(naked())]
| ^^^^^^^^^^^^^^--^^
@@ -428,7 +444,7 @@ LL | #[unsafe(naked())]
| help: must be of the form: `#[naked]`
error[E0565]: malformed `track_caller` attribute input
--> $DIR/malformed-attrs.rs:65:1
--> $DIR/malformed-attrs.rs:67:1
|
LL | #[track_caller()]
| ^^^^^^^^^^^^^^--^
@@ -437,13 +453,13 @@ LL | #[track_caller()]
| help: must be of the form: `#[track_caller]`
error[E0539]: malformed `export_name` attribute input
--> $DIR/malformed-attrs.rs:67:1
--> $DIR/malformed-attrs.rs:69:1
|
LL | #[export_name()]
| ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
error[E0805]: malformed `used` attribute input
--> $DIR/malformed-attrs.rs:69:1
--> $DIR/malformed-attrs.rs:71:1
|
LL | #[used()]
| ^^^^^^--^
@@ -460,8 +476,16 @@ LL - #[used()]
LL + #[used]
|
error: `#[used]` attribute cannot be used on functions
--> $DIR/malformed-attrs.rs:71:1
|
LL | #[used()]
| ^^^^^^^^^
|
= help: `#[used]` can only be applied to statics
error[E0539]: malformed `target_feature` attribute input
--> $DIR/malformed-attrs.rs:76:1
--> $DIR/malformed-attrs.rs:79:1
|
LL | #[target_feature]
| ^^^^^^^^^^^^^^^^^
@@ -470,7 +494,7 @@ LL | #[target_feature]
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error[E0565]: malformed `export_stable` attribute input
--> $DIR/malformed-attrs.rs:78:1
--> $DIR/malformed-attrs.rs:81:1
|
LL | #[export_stable = 1]
| ^^^^^^^^^^^^^^^^---^
@@ -479,7 +503,7 @@ LL | #[export_stable = 1]
| help: must be of the form: `#[export_stable]`
error[E0539]: malformed `link_name` attribute input
--> $DIR/malformed-attrs.rs:83:1
--> $DIR/malformed-attrs.rs:86:1
|
LL | #[link_name]
| ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
@@ -487,7 +511,7 @@ LL | #[link_name]
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
error[E0539]: malformed `link_section` attribute input
--> $DIR/malformed-attrs.rs:85:1
--> $DIR/malformed-attrs.rs:88:1
|
LL | #[link_section]
| ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
@@ -495,7 +519,7 @@ LL | #[link_section]
= note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
error[E0539]: malformed `coverage` attribute input
--> $DIR/malformed-attrs.rs:87:1
--> $DIR/malformed-attrs.rs:90:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -508,7 +532,7 @@ LL | #[coverage(on)]
| ++++
error[E0565]: malformed `no_implicit_prelude` attribute input
--> $DIR/malformed-attrs.rs:94:1
--> $DIR/malformed-attrs.rs:97:1
|
LL | #[no_implicit_prelude = 23]
| ^^^^^^^^^^^^^^^^^^^^^^----^
@@ -517,7 +541,7 @@ LL | #[no_implicit_prelude = 23]
| help: must be of the form: `#[no_implicit_prelude]`
error[E0565]: malformed `proc_macro` attribute input
--> $DIR/malformed-attrs.rs:96:1
--> $DIR/malformed-attrs.rs:99:1
|
LL | #[proc_macro = 18]
| ^^^^^^^^^^^^^----^
@@ -526,7 +550,7 @@ LL | #[proc_macro = 18]
| help: must be of the form: `#[proc_macro]`
error[E0565]: malformed `coroutine` attribute input
--> $DIR/malformed-attrs.rs:108:5
--> $DIR/malformed-attrs.rs:111:5
|
LL | #[coroutine = 63] || {}
| ^^^^^^^^^^^^----^
@@ -535,7 +559,7 @@ LL | #[coroutine = 63] || {}
| help: must be of the form: `#[coroutine]`
error[E0565]: malformed `proc_macro_attribute` attribute input
--> $DIR/malformed-attrs.rs:113:1
--> $DIR/malformed-attrs.rs:116:1
|
LL | #[proc_macro_attribute = 19]
| ^^^^^^^^^^^^^^^^^^^^^^^----^
@@ -544,7 +568,7 @@ LL | #[proc_macro_attribute = 19]
| help: must be of the form: `#[proc_macro_attribute]`
error[E0539]: malformed `must_use` attribute input
--> $DIR/malformed-attrs.rs:116:1
--> $DIR/malformed-attrs.rs:119:1
|
LL | #[must_use = 1]
| ^^^^^^^^^^^^^-^
@@ -562,7 +586,7 @@ LL + #[must_use]
|
error[E0539]: malformed `proc_macro_derive` attribute input
--> $DIR/malformed-attrs.rs:120:1
--> $DIR/malformed-attrs.rs:123:1
|
LL | #[proc_macro_derive]
| ^^^^^^^^^^^^^^^^^^^^ expected this to be a list
@@ -576,7 +600,7 @@ LL | #[proc_macro_derive(TraitName, attributes(name1, name2, ...))]
| ++++++++++++++++++++++++++++++++++++++++++
error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
--> $DIR/malformed-attrs.rs:125:1
--> $DIR/malformed-attrs.rs:128:1
|
LL | #[rustc_layout_scalar_valid_range_start]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -585,7 +609,7 @@ LL | #[rustc_layout_scalar_valid_range_start]
| help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input
--> $DIR/malformed-attrs.rs:127:1
--> $DIR/malformed-attrs.rs:130:1
|
LL | #[rustc_layout_scalar_valid_range_end]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -594,7 +618,7 @@ LL | #[rustc_layout_scalar_valid_range_end]
| help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
error[E0565]: malformed `marker` attribute input
--> $DIR/malformed-attrs.rs:152:1
--> $DIR/malformed-attrs.rs:155:1
|
LL | #[marker = 3]
| ^^^^^^^^^---^
@@ -603,7 +627,7 @@ LL | #[marker = 3]
| help: must be of the form: `#[marker]`
error[E0565]: malformed `fundamental` attribute input
--> $DIR/malformed-attrs.rs:154:1
--> $DIR/malformed-attrs.rs:157:1
|
LL | #[fundamental()]
| ^^^^^^^^^^^^^--^
@@ -612,7 +636,7 @@ LL | #[fundamental()]
| help: must be of the form: `#[fundamental]`
error[E0565]: malformed `ffi_pure` attribute input
--> $DIR/malformed-attrs.rs:162:5
--> $DIR/malformed-attrs.rs:165:5
|
LL | #[unsafe(ffi_pure = 1)]
| ^^^^^^^^^^^^^^^^^^---^^
@@ -621,7 +645,7 @@ LL | #[unsafe(ffi_pure = 1)]
| help: must be of the form: `#[ffi_pure]`
error[E0539]: malformed `link_ordinal` attribute input
--> $DIR/malformed-attrs.rs:164:5
--> $DIR/malformed-attrs.rs:167:5
|
LL | #[link_ordinal]
| ^^^^^^^^^^^^^^^
@@ -632,7 +656,7 @@ LL | #[link_ordinal]
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_ordinal-attribute>
error[E0565]: malformed `ffi_const` attribute input
--> $DIR/malformed-attrs.rs:168:5
--> $DIR/malformed-attrs.rs:171:5
|
LL | #[unsafe(ffi_const = 1)]
| ^^^^^^^^^^^^^^^^^^^---^^
@@ -641,7 +665,7 @@ LL | #[unsafe(ffi_const = 1)]
| help: must be of the form: `#[ffi_const]`
error[E0539]: malformed `linkage` attribute input
--> $DIR/malformed-attrs.rs:170:5
--> $DIR/malformed-attrs.rs:173:5
|
LL | #[linkage]
| ^^^^^^^^^^ expected this to be of the form `linkage = "..."`
@@ -659,7 +683,7 @@ LL | #[linkage = "external"]
= and 5 other candidates
error[E0565]: malformed `automatically_derived` attribute input
--> $DIR/malformed-attrs.rs:188:1
--> $DIR/malformed-attrs.rs:191:1
|
LL | #[automatically_derived = 18]
| ^^^^^^^^^^^^^^^^^^^^^^^^----^
@@ -668,7 +692,7 @@ LL | #[automatically_derived = 18]
| help: must be of the form: `#[automatically_derived]`
error[E0565]: malformed `non_exhaustive` attribute input
--> $DIR/malformed-attrs.rs:194:1
--> $DIR/malformed-attrs.rs:197:1
|
LL | #[non_exhaustive = 1]
| ^^^^^^^^^^^^^^^^^---^
@@ -677,13 +701,13 @@ LL | #[non_exhaustive = 1]
| help: must be of the form: `#[non_exhaustive]`
error: valid forms for the attribute are `#[macro_use(name1, name2, ...)]` and `#[macro_use]`
--> $DIR/malformed-attrs.rs:206:1
--> $DIR/malformed-attrs.rs:209:1
|
LL | #[macro_use = 1]
| ^^^^^^^^^^^^^^^^
error[E0565]: malformed `allow_internal_unsafe` attribute input
--> $DIR/malformed-attrs.rs:213:1
--> $DIR/malformed-attrs.rs:216:1
|
LL | #[allow_internal_unsafe = 1]
| ^^^^^^^^^^^^^^^^^^^^^^^^---^
@@ -692,7 +716,7 @@ LL | #[allow_internal_unsafe = 1]
| help: must be of the form: `#[allow_internal_unsafe]`
error[E0565]: malformed `type_const` attribute input
--> $DIR/malformed-attrs.rs:140:5
--> $DIR/malformed-attrs.rs:143:5
|
LL | #[type_const = 1]
| ^^^^^^^^^^^^^---^
@@ -712,20 +736,20 @@ LL | | #[coroutine = 63] || {}
LL | | }
| |_- not a `const fn`
error: `#[repr(align(...))]` is not supported on function items
--> $DIR/malformed-attrs.rs:45:1
error: `#[repr(align(...))]` is not supported on functions
--> $DIR/malformed-attrs.rs:47:1
|
LL | #[repr]
| ^^^^^^^
|
help: use `#[rustc_align(...)]` instead
--> $DIR/malformed-attrs.rs:45:1
--> $DIR/malformed-attrs.rs:47:1
|
LL | #[repr]
| ^^^^^^^
warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
--> $DIR/malformed-attrs.rs:146:1
--> $DIR/malformed-attrs.rs:149:1
|
LL | #[diagnostic::do_not_recommend()]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -733,7 +757,7 @@ LL | #[diagnostic::do_not_recommend()]
= note: `#[warn(malformed_diagnostic_attributes)]` on by default
warning: missing options for `on_unimplemented` attribute
--> $DIR/malformed-attrs.rs:135:1
--> $DIR/malformed-attrs.rs:138:1
|
LL | #[diagnostic::on_unimplemented]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -741,7 +765,7 @@ LL | #[diagnostic::on_unimplemented]
= help: at least one of the `message`, `note` and `label` options are expected
warning: malformed `on_unimplemented` attribute
--> $DIR/malformed-attrs.rs:137:1
--> $DIR/malformed-attrs.rs:140:1
|
LL | #[diagnostic::on_unimplemented = 1]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
@@ -749,7 +773,7 @@ LL | #[diagnostic::on_unimplemented = 1]
= help: only `message`, `note` and `label` are allowed as options
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
--> $DIR/malformed-attrs.rs:50:1
--> $DIR/malformed-attrs.rs:52:1
|
LL | #[inline = 5]
| ^^^^^^^^^^^^^
@@ -758,7 +782,7 @@ LL | #[inline = 5]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:91:1
--> $DIR/malformed-attrs.rs:94:1
|
LL | #[ignore()]
| ^^^^^^^^^^^
@@ -767,7 +791,7 @@ LL | #[ignore()]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:220:1
--> $DIR/malformed-attrs.rs:223:1
|
LL | #[ignore = 1]
| ^^^^^^^^^^^^^
@@ -776,7 +800,7 @@ LL | #[ignore = 1]
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
error[E0308]: mismatched types
--> $DIR/malformed-attrs.rs:108:23
--> $DIR/malformed-attrs.rs:111:23
|
LL | fn test() {
| - help: a return type might be missing here: `-> _`
@@ -784,15 +808,15 @@ LL | #[coroutine = 63] || {}
| ^^^^^ expected `()`, found coroutine
|
= note: expected unit type `()`
found coroutine `{coroutine@$DIR/malformed-attrs.rs:108:23: 108:25}`
found coroutine `{coroutine@$DIR/malformed-attrs.rs:111:23: 111:25}`
error: aborting due to 74 previous errors; 3 warnings emitted
error: aborting due to 77 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
For more information about an error, try `rustc --explain E0308`.
Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:40:1
--> $DIR/malformed-attrs.rs:41:1
|
LL | #[doc]
| ^^^^^^
@@ -804,7 +828,7 @@ LL | #[doc]
Future breakage diagnostic:
error: valid forms for the attribute are `#[doc(hidden)]`, `#[doc(inline)]`, and `#[doc = "string"]`
--> $DIR/malformed-attrs.rs:73:1
--> $DIR/malformed-attrs.rs:76:1
|
LL | #[doc]
| ^^^^^^
@@ -816,7 +840,7 @@ LL | #[doc]
Future breakage diagnostic:
error: valid forms for the attribute are `#[link(name = "...")]`, `#[link(name = "...", kind = "dylib|static|...")]`, `#[link(name = "...", wasm_import_module = "...")]`, `#[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]`, and `#[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]`
--> $DIR/malformed-attrs.rs:80:1
--> $DIR/malformed-attrs.rs:83:1
|
LL | #[link]
| ^^^^^^^
@@ -828,7 +852,7 @@ LL | #[link]
Future breakage diagnostic:
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
--> $DIR/malformed-attrs.rs:50:1
--> $DIR/malformed-attrs.rs:52:1
|
LL | #[inline = 5]
| ^^^^^^^^^^^^^
@@ -839,7 +863,7 @@ LL | #[inline = 5]
Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:91:1
--> $DIR/malformed-attrs.rs:94:1
|
LL | #[ignore()]
| ^^^^^^^^^^^
@@ -850,7 +874,7 @@ LL | #[ignore()]
Future breakage diagnostic:
error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
--> $DIR/malformed-attrs.rs:220:1
--> $DIR/malformed-attrs.rs:223:1
|
LL | #[ignore = 1]
| ^^^^^^^^^^^^^

View File

@@ -23,7 +23,7 @@ fn f2() {}
#[rustc_align(0)] //~ ERROR invalid alignment value: not a power of two
fn f3() {}
#[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on function items
#[repr(align(16))] //~ ERROR `#[repr(align(...))]` is not supported on functions
fn f4() {}
#[rustc_align(-1)] //~ ERROR expected unsuffixed literal, found `-`
@@ -41,14 +41,14 @@ fn f7() {}
#[rustc_align(16)]
fn f8() {}
#[rustc_align(16)] //~ ERROR `#[rustc_align(...)]` is not supported on struct items
#[rustc_align(16)] //~ ERROR attribute cannot be used on
struct S1;
#[rustc_align(32)] //~ ERROR `#[rustc_align(...)]` should be applied to a function item
#[rustc_align(32)] //~ ERROR attribute cannot be used on
const FOO: i32 = 42;
#[rustc_align(32)] //~ ERROR `#[rustc_align(...)]` should be applied to a function item
#[rustc_align(32)] //~ ERROR attribute cannot be used on
mod test {}
#[rustc_align(32)] //~ ERROR `#[rustc_align(...)]` should be applied to a function item
#[rustc_align(32)] //~ ERROR attribute cannot be used on
use ::std::iter;

View File

@@ -69,7 +69,39 @@ error[E0589]: invalid alignment value: not a power of two
LL | #[rustc_align(3)]
| ^
error: `#[repr(align(...))]` is not supported on function items
error: `#[rustc_align]` attribute cannot be used on structs
--> $DIR/malformed-fn-align.rs:44:1
|
LL | #[rustc_align(16)]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: `#[rustc_align]` attribute cannot be used on constants
--> $DIR/malformed-fn-align.rs:47:1
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: `#[rustc_align]` attribute cannot be used on modules
--> $DIR/malformed-fn-align.rs:50:1
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: `#[rustc_align]` attribute cannot be used on use statements
--> $DIR/malformed-fn-align.rs:53:1
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_align]` can only be applied to functions
error: `#[repr(align(...))]` is not supported on functions
--> $DIR/malformed-fn-align.rs:26:8
|
LL | #[repr(align(16))]
@@ -81,42 +113,6 @@ help: use `#[rustc_align(...)]` instead
LL | #[repr(align(16))]
| ^^^^^^^^^
error: `#[rustc_align(...)]` is not supported on struct items
--> $DIR/malformed-fn-align.rs:44:1
|
LL | #[rustc_align(16)]
| ^^^^^^^^^^^^^^^^^^
|
help: use `#[repr(align(...))]` instead
|
LL - #[rustc_align(16)]
LL + #[repr(align(16))]
|
error: `#[rustc_align(...)]` should be applied to a function item
--> $DIR/malformed-fn-align.rs:47:1
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
LL | const FOO: i32 = 42;
| -------------------- not a function item
error: `#[rustc_align(...)]` should be applied to a function item
--> $DIR/malformed-fn-align.rs:50:1
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
LL | mod test {}
| ----------- not a function item
error: `#[rustc_align(...)]` should be applied to a function item
--> $DIR/malformed-fn-align.rs:53:1
|
LL | #[rustc_align(32)]
| ^^^^^^^^^^^^^^^^^^
LL | use ::std::iter;
| ---------------- not a function item
error: aborting due to 15 previous errors
Some errors have detailed explanations: E0539, E0589, E0805.

View File

@@ -2,9 +2,9 @@
// on an item.
#[inline]
//~^ ERROR attribute should be applied to function or closure [E0518]
//~^ ERROR attribute cannot be used on
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
const FOO: u8 = 0;
fn main() { }

View File

@@ -1,21 +1,18 @@
error: attribute should be applied to a function definition
--> $DIR/multiple-invalid.rs:6:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | const FOO: u8 = 0;
| ------------------ not a function definition
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on constants
--> $DIR/multiple-invalid.rs:4:1
|
LL | #[inline]
| ^^^^^^^^^
...
LL | const FOO: u8 = 0;
| ------------------ not a function or closure
|
= help: `#[inline]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on constants
--> $DIR/multiple-invalid.rs:6:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0518`.

View File

@@ -5,11 +5,11 @@
//@ edition: 2018
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
#[optimize(speed)] //~ ERROR attribute cannot be used on
struct F;
fn invalid() {
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
#[optimize(speed)] //~ ERROR attribute cannot be used on
{
1
};
@@ -18,10 +18,10 @@ fn invalid() {
#[optimize(speed)]
fn valid() {}
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
#[optimize(speed)] //~ ERROR attribute cannot be used on
mod valid_module {}
#[optimize(speed)] //~ ERROR attribute applied to an invalid target
#[optimize(speed)] //~ ERROR attribute cannot be used on
impl F {}
fn main() {

View File

@@ -1,36 +1,34 @@
error: attribute applied to an invalid target
error: `#[optimize]` attribute cannot be used on structs
--> $DIR/optimize.rs:8:1
|
LL | #[optimize(speed)]
| ^^^^^^^^^^^^^^^^^^
LL | struct F;
| --------- invalid target
|
= help: `#[optimize]` can only be applied to functions
error: attribute applied to an invalid target
error: `#[optimize]` attribute cannot be used on expressions
--> $DIR/optimize.rs:12:5
|
LL | #[optimize(speed)]
| ^^^^^^^^^^^^^^^^^^
LL | / {
LL | | 1
LL | | };
| |_____- invalid target
LL | #[optimize(speed)]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[optimize]` can only be applied to functions
error: attribute applied to an invalid target
error: `#[optimize]` attribute cannot be used on modules
--> $DIR/optimize.rs:21:1
|
LL | #[optimize(speed)]
| ^^^^^^^^^^^^^^^^^^
LL | mod valid_module {}
| ------------------- invalid target
|
= help: `#[optimize]` can only be applied to functions
error: attribute applied to an invalid target
error: `#[optimize]` attribute cannot be used on inherent impl blocks
--> $DIR/optimize.rs:24:1
|
LL | #[optimize(speed)]
| ^^^^^^^^^^^^^^^^^^
LL | impl F {}
| --------- invalid target
|
= help: `#[optimize]` can only be applied to functions
error: aborting due to 4 previous errors

View File

@@ -4,20 +4,20 @@
#[used]
static FOO: u32 = 0; // OK
#[used] //~ ERROR attribute must be applied to a `static` variable
#[used] //~ ERROR attribute cannot be used on
fn foo() {}
#[used] //~ ERROR attribute must be applied to a `static` variable
#[used] //~ ERROR attribute cannot be used on
struct Foo {}
#[used] //~ ERROR attribute must be applied to a `static` variable
#[used] //~ ERROR attribute cannot be used on
trait Bar {}
#[used] //~ ERROR attribute must be applied to a `static` variable
#[used] //~ ERROR attribute cannot be used on
impl Bar for Foo {}
// Regression test for <https://github.com/rust-lang/rust/issues/126789>.
extern "C" {
#[used] //~ ERROR attribute must be applied to a `static` variable
#[used] //~ ERROR attribute cannot be used on
static BAR: i32;
}

View File

@@ -1,42 +1,42 @@
error: attribute must be applied to a `static` variable
error: `#[used]` attribute cannot be used on functions
--> $DIR/used.rs:7:1
|
LL | #[used]
| ^^^^^^^
LL | fn foo() {}
| ----------- but this is a function
|
= help: `#[used]` can only be applied to statics
error: attribute must be applied to a `static` variable
error: `#[used]` attribute cannot be used on structs
--> $DIR/used.rs:10:1
|
LL | #[used]
| ^^^^^^^
LL | struct Foo {}
| ------------- but this is a struct
|
= help: `#[used]` can only be applied to statics
error: attribute must be applied to a `static` variable
error: `#[used]` attribute cannot be used on traits
--> $DIR/used.rs:13:1
|
LL | #[used]
| ^^^^^^^
LL | trait Bar {}
| ------------ but this is a trait
|
= help: `#[used]` can only be applied to statics
error: attribute must be applied to a `static` variable
error: `#[used]` attribute cannot be used on trait impl blocks
--> $DIR/used.rs:16:1
|
LL | #[used]
| ^^^^^^^
LL | impl Bar for Foo {}
| ------------------- but this is a trait implementation block
|
= help: `#[used]` can only be applied to statics
error: attribute must be applied to a `static` variable
error: `#[used]` attribute cannot be used on foreign statics
--> $DIR/used.rs:21:5
|
LL | #[used]
| ^^^^^^^
LL | static BAR: i32;
| ---------------- but this is a foreign static item
|
= help: `#[used]` can only be applied to statics
error: aborting due to 5 previous errors

View File

@@ -43,5 +43,6 @@ impl Bar {
}
#[rustc_confusables("blah")]
//~^ ERROR attribute should be applied to an inherent method
//~^ ERROR attribute cannot be used on
//~| HELP can only be applied to
fn not_inherent_impl_method() {}

View File

@@ -22,11 +22,13 @@ LL | #[rustc_confusables(invalid_meta_item)]
| | expected a string literal here
| help: must be of the form: `#[rustc_confusables("name1", "name2", ...)]`
error: attribute should be applied to an inherent method
error: `#[rustc_confusables]` attribute cannot be used on functions
--> $DIR/rustc_confusables.rs:45:1
|
LL | #[rustc_confusables("blah")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_confusables]` can only be applied to inherent methods
error[E0599]: no method named `inser` found for struct `rustc_confusables_across_crate::BTreeSet` in the current scope
--> $DIR/rustc_confusables.rs:12:7

View File

@@ -32,7 +32,7 @@ trait String {}
trait OK {}
#[rustc_skip_during_method_dispatch(array)]
//~^ ERROR: attribute should be applied to a trait
//~^ ERROR: attribute cannot be used on
impl OK for () {}
fn main() {}

View File

@@ -61,14 +61,13 @@ LL | #[rustc_skip_during_method_dispatch("array")]
| | didn't expect a literal here
| help: must be of the form: `#[rustc_skip_during_method_dispatch(array, boxed_slice)]`
error: attribute should be applied to a trait
error: `#[rustc_skip_during_method_dispatch]` attribute cannot be used on trait impl blocks
--> $DIR/rustc_skip_during_method_dispatch.rs:34:1
|
LL | #[rustc_skip_during_method_dispatch(array)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | impl OK for () {}
| ----------------- not a trait
|
= help: `#[rustc_skip_during_method_dispatch]` can only be applied to traits
error: aborting due to 8 previous errors

View File

@@ -3,9 +3,9 @@
#![feature(coroutines)]
#[coroutine]
//~^ ERROR: attribute should be applied to closures
//~^ ERROR: attribute cannot be used on
struct Foo;
#[coroutine]
//~^ ERROR: attribute should be applied to closures
//~^ ERROR: attribute cannot be used on
fn main() {}

View File

@@ -1,14 +1,18 @@
error: attribute should be applied to closures
error: `#[coroutine]` attribute cannot be used on structs
--> $DIR/invalid_attr_usage.rs:5:1
|
LL | #[coroutine]
| ^^^^^^^^^^^^
|
= help: `#[coroutine]` can only be applied to closures
error: attribute should be applied to closures
error: `#[coroutine]` attribute cannot be used on functions
--> $DIR/invalid_attr_usage.rs:9:1
|
LL | #[coroutine]
| ^^^^^^^^^^^^
|
= help: `#[coroutine]` can only be applied to closures
error: aborting due to 2 previous errors

View File

@@ -11,24 +11,24 @@
#[coverage(off)]
mod submod {}
#[coverage(off)] //~ ERROR coverage attribute not allowed here [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
type MyTypeAlias = ();
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
trait MyTrait {
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
const TRAIT_ASSOC_CONST: u32;
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
type TraitAssocType;
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
fn trait_method(&self);
#[coverage(off)]
fn trait_method_with_default(&self) {}
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
fn trait_assoc_fn();
}
@@ -36,7 +36,7 @@ trait MyTrait {
impl MyTrait for () {
const TRAIT_ASSOC_CONST: u32 = 0;
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
type TraitAssocType = Self;
#[coverage(off)]
@@ -53,14 +53,14 @@ trait HasAssocType {
}
impl HasAssocType for () {
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
type T = impl Copy;
fn constrain_assoc_type() -> Self::T {}
}
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
struct MyStruct {
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
field: u32,
}
@@ -73,25 +73,25 @@ impl MyStruct {
}
extern "C" {
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
static X: u32;
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
type T;
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
fn foreign_fn();
}
#[coverage(off)]
fn main() {
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
let _ = ();
// Currently not allowed on let statements, even if they bind to a closure.
// It might be nice to support this as a special case someday, but trying
// to define the precise boundaries of that special case might be tricky.
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
let _let_closure = || ();
// In situations where attributes can already be applied to expressions,
@@ -107,10 +107,10 @@ fn main() {
//~^ ERROR attributes on expressions are experimental [E0658]
match () {
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
() => (),
}
#[coverage(off)] //~ ERROR [E0788]
#[coverage(off)] //~ ERROR attribute cannot be used on
return ();
}

View File

@@ -8,185 +8,142 @@ LL | let _closure_expr = #[coverage(off)] || ();
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on type aliases
--> $DIR/allowed-positions.rs:14:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | type MyTypeAlias = ();
| ---------------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on traits
--> $DIR/allowed-positions.rs:17:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | / trait MyTrait {
LL | | #[coverage(off)]
LL | | const TRAIT_ASSOC_CONST: u32;
... |
LL | | fn trait_assoc_fn();
LL | | }
| |_- not a function, impl block, or module
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
--> $DIR/allowed-positions.rs:61:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | / struct MyStruct {
LL | | #[coverage(off)]
LL | | field: u32,
LL | | }
| |_- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
error[E0788]: coverage attribute not allowed here
--> $DIR/allowed-positions.rs:63:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | field: u32,
| ---------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
error[E0788]: coverage attribute not allowed here
--> $DIR/allowed-positions.rs:88:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | let _ = ();
| ----------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
error[E0788]: coverage attribute not allowed here
--> $DIR/allowed-positions.rs:94:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | let _let_closure = || ();
| ------------------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
error[E0788]: coverage attribute not allowed here
--> $DIR/allowed-positions.rs:110:9
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | () => (),
| -------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
error[E0788]: coverage attribute not allowed here
--> $DIR/allowed-positions.rs:114:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | return ();
| --------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/allowed-positions.rs:19:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | const TRAIT_ASSOC_CONST: u32;
| ----------------------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/allowed-positions.rs:22:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | type TraitAssocType;
| -------------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on required trait methods
--> $DIR/allowed-positions.rs:25:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | fn trait_method(&self);
| ----------------------- function has no body
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to impl blocks, functions, closures, provided trait methods, trait methods in impl blocks, inherent methods, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on required trait methods
--> $DIR/allowed-positions.rs:31:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | fn trait_assoc_fn();
| -------------------- function has no body
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to impl blocks, functions, closures, provided trait methods, trait methods in impl blocks, inherent methods, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/allowed-positions.rs:39:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | type TraitAssocType = Self;
| --------------------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/allowed-positions.rs:56:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | type T = impl Copy;
| ------------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on structs
--> $DIR/allowed-positions.rs:61:1
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error: `#[coverage]` attribute cannot be used on struct fields
--> $DIR/allowed-positions.rs:63:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error: `#[coverage]` attribute cannot be used on foreign statics
--> $DIR/allowed-positions.rs:76:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | static X: u32;
| -------------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on foreign types
--> $DIR/allowed-positions.rs:79:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | type T;
| ------- not a function, impl block, or module
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0788]: coverage attribute not allowed here
error: `#[coverage]` attribute cannot be used on foreign functions
--> $DIR/allowed-positions.rs:82:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
LL | fn foreign_fn();
| ---------------- function has no body
|
= help: coverage attribute can be applied to a function (with body), impl block, or module
= help: `#[coverage]` can be applied to methods, impl blocks, functions, closures, modules, crates
error: `#[coverage]` attribute cannot be used on statements
--> $DIR/allowed-positions.rs:88:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error: `#[coverage]` attribute cannot be used on statements
--> $DIR/allowed-positions.rs:94:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error: `#[coverage]` attribute cannot be used on match arms
--> $DIR/allowed-positions.rs:110:9
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error: `#[coverage]` attribute cannot be used on expressions
--> $DIR/allowed-positions.rs:114:5
|
LL | #[coverage(off)]
| ^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error: aborting due to 18 previous errors
Some errors have detailed explanations: E0658, E0788.
For more information about an error, try `rustc --explain E0658`.
For more information about this error, try `rustc --explain E0658`.

View File

@@ -20,6 +20,7 @@ mod my_mod_inner {
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
struct MyStruct;
#[coverage = "off"]
@@ -27,18 +28,22 @@ struct MyStruct;
impl MyStruct {
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
const X: u32 = 7;
}
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
trait MyTrait {
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
const X: u32;
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
type T;
}
@@ -47,10 +52,12 @@ trait MyTrait {
impl MyTrait for MyStruct {
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
const X: u32 = 8;
#[coverage = "off"]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
type T = ();
}

View File

@@ -43,8 +43,16 @@ LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on structs
--> $DIR/name-value.rs:21:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:25:1
--> $DIR/name-value.rs:26:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -59,7 +67,7 @@ LL + #[coverage(on)]
|
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:28:5
--> $DIR/name-value.rs:29:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -73,8 +81,85 @@ LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/name-value.rs:29:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:33:1
--> $DIR/name-value.rs:35:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[coverage = "off"]
LL + #[coverage(off)]
|
LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on traits
--> $DIR/name-value.rs:35:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:39:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[coverage = "off"]
LL + #[coverage(off)]
|
LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/name-value.rs:39:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:44:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[coverage = "off"]
LL + #[coverage(off)]
|
LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/name-value.rs:44:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:50:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -89,7 +174,7 @@ LL + #[coverage(on)]
|
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:36:5
--> $DIR/name-value.rs:53:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -103,8 +188,16 @@ LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/name-value.rs:53:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:40:5
--> $DIR/name-value.rs:58:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -118,8 +211,16 @@ LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/name-value.rs:58:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:45:1
--> $DIR/name-value.rs:64:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -133,51 +234,6 @@ LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:48:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[coverage = "off"]
LL + #[coverage(off)]
|
LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:52:5
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[coverage = "off"]
LL + #[coverage(off)]
|
LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error[E0539]: malformed `coverage` attribute input
--> $DIR/name-value.rs:57:1
|
LL | #[coverage = "off"]
| ^^^^^^^^^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL - #[coverage = "off"]
LL + #[coverage(off)]
|
LL - #[coverage = "off"]
LL + #[coverage(on)]
|
error: aborting due to 12 previous errors
error: aborting due to 19 previous errors
For more information about this error, try `rustc --explain E0539`.

View File

@@ -20,6 +20,7 @@ mod my_mod_inner {
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
struct MyStruct;
#[coverage]
@@ -27,18 +28,22 @@ struct MyStruct;
impl MyStruct {
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
const X: u32 = 7;
}
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
trait MyTrait {
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
const X: u32;
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
type T;
}
@@ -47,10 +52,12 @@ trait MyTrait {
impl MyTrait for MyStruct {
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
const X: u32 = 8;
#[coverage]
//~^ ERROR malformed `coverage` attribute input
//~| ERROR attribute cannot be used on
type T = ();
}

View File

@@ -39,8 +39,16 @@ LL | #[coverage(off)]
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on structs
--> $DIR/word-only.rs:21:1
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:25:1
--> $DIR/word-only.rs:26:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -53,7 +61,7 @@ LL | #[coverage(on)]
| ++++
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:28:5
--> $DIR/word-only.rs:29:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -65,8 +73,79 @@ LL | #[coverage(off)]
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/word-only.rs:29:5
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:33:1
--> $DIR/word-only.rs:35:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL | #[coverage(off)]
| +++++
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on traits
--> $DIR/word-only.rs:35:1
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:39:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL | #[coverage(off)]
| +++++
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/word-only.rs:39:5
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:44:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL | #[coverage(off)]
| +++++
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/word-only.rs:44:5
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:50:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -79,7 +158,7 @@ LL | #[coverage(on)]
| ++++
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:36:5
--> $DIR/word-only.rs:53:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -91,8 +170,16 @@ LL | #[coverage(off)]
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on associated consts
--> $DIR/word-only.rs:53:5
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:40:5
--> $DIR/word-only.rs:58:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -104,8 +191,16 @@ LL | #[coverage(off)]
LL | #[coverage(on)]
| ++++
error: `#[coverage]` attribute cannot be used on associated types
--> $DIR/word-only.rs:58:5
|
LL | #[coverage]
| ^^^^^^^^^^^
|
= help: `#[coverage]` can be applied to functions, impl blocks, modules, crates
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:45:1
--> $DIR/word-only.rs:64:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
@@ -117,45 +212,6 @@ LL | #[coverage(off)]
LL | #[coverage(on)]
| ++++
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:48:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL | #[coverage(off)]
| +++++
LL | #[coverage(on)]
| ++++
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:52:5
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL | #[coverage(off)]
| +++++
LL | #[coverage(on)]
| ++++
error[E0539]: malformed `coverage` attribute input
--> $DIR/word-only.rs:57:1
|
LL | #[coverage]
| ^^^^^^^^^^^ this attribute is only valid with either `on` or `off` as an argument
|
help: try changing it to one of the following valid forms of the attribute
|
LL | #[coverage(off)]
| +++++
LL | #[coverage(on)]
| ++++
error: aborting due to 12 previous errors
error: aborting due to 19 previous errors
For more information about this error, try `rustc --explain E0539`.

View File

@@ -1,3 +1,5 @@
#![deny(unused_attributes)]
// Various checks that deprecation attributes are used correctly
mod bogus_attribute_types_1 {
@@ -32,7 +34,8 @@ fn f1() { }
struct X;
#[deprecated = "hello"] //~ ERROR this `#[deprecated]` annotation has no effect
#[deprecated = "hello"] //~ ERROR attribute cannot be used on
//~| WARN previously accepted
impl Default for X {
fn default() -> Self {
X

View File

@@ -1,11 +1,11 @@
error[E0541]: unknown meta item 'reason'
--> $DIR/deprecation-sanity.rs:4:43
--> $DIR/deprecation-sanity.rs:6:43
|
LL | #[deprecated(since = "a", note = "a", reason)]
| ^^^^^^ expected one of `since`, `note`
error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:7:5
--> $DIR/deprecation-sanity.rs:9:5
|
LL | #[deprecated(since = "a", note)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^----^^
@@ -29,7 +29,7 @@ LL + #[deprecated(since = "version", note = "reason")]
= and 1 other candidate
error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:10:5
--> $DIR/deprecation-sanity.rs:12:5
|
LL | #[deprecated(since, note = "a")]
| ^^^^^^^^^^^^^-----^^^^^^^^^^^^^^
@@ -53,7 +53,7 @@ LL + #[deprecated(since = "version", note = "reason")]
= and 1 other candidate
error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:13:5
--> $DIR/deprecation-sanity.rs:15:5
|
LL | #[deprecated(since = "a", note(b))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-------^^
@@ -77,7 +77,7 @@ LL + #[deprecated(since = "version", note = "reason")]
= and 1 other candidate
error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:16:5
--> $DIR/deprecation-sanity.rs:18:5
|
LL | #[deprecated(since(b), note = "a")]
| ^^^^^^^^^^^^^--------^^^^^^^^^^^^^^
@@ -101,7 +101,7 @@ LL + #[deprecated(since = "version", note = "reason")]
= and 1 other candidate
error[E0539]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:19:5
--> $DIR/deprecation-sanity.rs:21:5
|
LL | #[deprecated(note = b"test")]
| ^^^^^^^^^^^^^^^^^^^^-^^^^^^^^
@@ -111,7 +111,7 @@ LL | #[deprecated(note = b"test")]
= note: expected a normal string literal, not a byte string literal
error[E0565]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:22:5
--> $DIR/deprecation-sanity.rs:24:5
|
LL | #[deprecated("test")]
| ^^^^^^^^^^^^^------^^
@@ -135,19 +135,19 @@ LL + #[deprecated(since = "version", note = "reason")]
= and 1 other candidate
error: multiple `deprecated` attributes
--> $DIR/deprecation-sanity.rs:27:1
--> $DIR/deprecation-sanity.rs:29:1
|
LL | #[deprecated(since = "a", note = "b")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
|
note: attribute also specified here
--> $DIR/deprecation-sanity.rs:26:1
--> $DIR/deprecation-sanity.rs:28:1
|
LL | #[deprecated(since = "a", note = "b")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0538]: malformed `deprecated` attribute input
--> $DIR/deprecation-sanity.rs:30:1
--> $DIR/deprecation-sanity.rs:32:1
|
LL | #[deprecated(since = "a", since = "b", note = "c")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^-----------^^^^^^^^^^^^^^
@@ -170,12 +170,14 @@ LL + #[deprecated(since = "version", note = "reason")]
|
= and 1 other candidate
error: this `#[deprecated]` annotation has no effect
--> $DIR/deprecation-sanity.rs:35:1
error: `#[deprecated]` attribute cannot be used on trait impl blocks
--> $DIR/deprecation-sanity.rs:37:1
|
LL | #[deprecated = "hello"]
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove the unnecessary deprecation attribute
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= 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 functions, data types, modules, unions, constants, statics, macro defs, type aliases, use statements, struct fields, traits, associated types, associated consts, enum variants, inherent impl blocks, crates
= note: `#[deny(useless_deprecated)]` on by default
error: aborting due to 10 previous errors

View File

@@ -1,9 +0,0 @@
#[inline(always)] //~ ERROR: E0518
struct Foo;
#[inline(never)] //~ ERROR: E0518
impl Foo {
}
fn main() {
}

View File

@@ -1,20 +0,0 @@
error[E0518]: attribute should be applied to function or closure
--> $DIR/E0518.rs:1:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
LL | struct Foo;
| ----------- not a function or closure
error[E0518]: attribute should be applied to function or closure
--> $DIR/E0518.rs:4:1
|
LL | #[inline(never)]
| ^^^^^^^^^^^^^^^^
LL | / impl Foo {
LL | | }
| |_- not a function or closure
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0518`.

View File

@@ -2,7 +2,7 @@ error[E0718]: `owned_box` lang item must be applied to a struct
--> $DIR/E0718.rs:4:1
|
LL | #[lang = "owned_box"]
| ^^^^^^^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static item
| ^^^^^^^^^^^^^^^^^^^^^ attribute should be applied to a struct, not a static
error: aborting due to 1 previous error

View File

@@ -9,21 +9,21 @@
extern "C" {
#[no_mangle]
//~^ WARNING `#[no_mangle]` has no effect on a foreign static
//~^^ WARNING this was previously accepted by the compiler
//~^ WARNING attribute cannot be used on
//~| WARN previously accepted
pub static FOO: u8;
#[no_mangle]
//~^ WARNING `#[no_mangle]` has no effect on a foreign function
//~^^ WARNING this was previously accepted by the compiler
//~^ WARNING attribute cannot be used on
//~| WARN previously accepted
pub fn bar();
}
fn no_new_warn() {
// Should emit the generic "not a function or static" warning
#[no_mangle]
//~^ WARNING attribute should be applied to a free function, impl method or static
//~^^ WARNING this was previously accepted by the compiler
//~^ WARNING attribute cannot be used on
//~| WARN previously accepted
let x = 0_u8;
}

View File

@@ -1,42 +1,34 @@
warning: attribute should be applied to a free function, impl method or static
--> $DIR/extern-no-mangle.rs:24:5
warning: `#[no_mangle]` attribute cannot be used on foreign statics
--> $DIR/extern-no-mangle.rs:11:5
|
LL | #[no_mangle]
| ^^^^^^^^^^^^
...
LL | let x = 0_u8;
| ------------- not a free function, impl method or static
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[no_mangle]` can be applied to functions, statics
note: the lint level is defined here
--> $DIR/extern-no-mangle.rs:1:9
|
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
warning: `#[no_mangle]` has no effect on a foreign static
--> $DIR/extern-no-mangle.rs:11:5
|
LL | #[no_mangle]
| ^^^^^^^^^^^^ help: remove this attribute
...
LL | pub static FOO: u8;
| ------------------- foreign static
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: symbol names in extern blocks are not mangled
warning: `#[no_mangle]` has no effect on a foreign function
warning: `#[no_mangle]` attribute cannot be used on foreign functions
--> $DIR/extern-no-mangle.rs:16:5
|
LL | #[no_mangle]
| ^^^^^^^^^^^^ help: remove this attribute
...
LL | pub fn bar();
| ------------- foreign function
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: symbol names in extern blocks are not mangled
= help: `#[no_mangle]` can be applied to methods, functions, statics
warning: `#[no_mangle]` attribute cannot be used on statements
--> $DIR/extern-no-mangle.rs:24:5
|
LL | #[no_mangle]
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[no_mangle]` can be applied to functions, statics
warning: 3 warnings emitted

View File

@@ -1,22 +1,25 @@
#![warn(unused_attributes)] //~ NOTE lint level is defined here
#[link_name = "foo"]
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
struct Foo; //~ NOTE not a foreign function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
struct Foo;
#[link_name = "foobar"]
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| HELP try `#[link(name = "foobar")]` instead
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
extern "C" {
fn foo() -> u32;
}
//~^^^ NOTE not a foreign function or static
#[link_name]
//~^ ERROR malformed `link_name` attribute input
//~| HELP must be of the form
//~| WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
//~| NOTE for more information, visit
extern "C" {
fn bar() -> u32;

View File

@@ -6,40 +6,38 @@ LL | #[link_name]
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link_name-attribute>
warning: attribute should be applied to a foreign function or static
warning: `#[link_name]` attribute cannot be used on structs
--> $DIR/issue-47725.rs:3:1
|
LL | #[link_name = "foo"]
| ^^^^^^^^^^^^^^^^^^^^
...
LL | struct Foo;
| ----------- not a foreign function or static
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_name]` can be applied to foreign functions, foreign statics
note: the lint level is defined here
--> $DIR/issue-47725.rs:1:9
|
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
warning: attribute should be applied to a foreign function or static
--> $DIR/issue-47725.rs:8:1
|
LL | #[link_name = "foobar"]
| ^^^^^^^^^^^^^^^^^^^^^^^
...
LL | / extern "C" {
LL | | fn foo() -> u32;
LL | | }
| |_- not a foreign function or static
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
help: try `#[link(name = "foobar")]` instead
--> $DIR/issue-47725.rs:8:1
warning: `#[link_name]` attribute cannot be used on foreign modules
--> $DIR/issue-47725.rs:9:1
|
LL | #[link_name = "foobar"]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_name]` can be applied to foreign functions, foreign statics
error: aborting due to 1 previous error; 2 warnings emitted
warning: `#[link_name]` attribute cannot be used on foreign modules
--> $DIR/issue-47725.rs:17:1
|
LL | #[link_name]
| ^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[link_name]` can be applied to foreign functions, foreign statics
error: aborting due to 1 previous error; 3 warnings emitted
For more information about this error, try `rustc --explain E0539`.

View File

@@ -4,7 +4,7 @@
// FIXME(jdonszelmann): empty attributes are currently ignored, since when its empty no actual
// change is applied. This should be fixed when later moving this check to attribute parsing.
#[allow_internal_unstable(something)] //~ ERROR allow_internal_unstable side-steps
//~| ERROR attribute should
//~| ERROR attribute cannot be used on
struct S;
fn main() {}

View File

@@ -7,14 +7,13 @@ LL | #[allow_internal_unstable(something)]
= help: add `#![feature(allow_internal_unstable)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: attribute should be applied to a macro
error: `#[allow_internal_unstable]` attribute cannot be used on structs
--> $DIR/feature-gate-allow-internal-unstable-struct.rs:6:1
|
LL | #[allow_internal_unstable(something)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | struct S;
| --------- not a macro
|
= help: `#[allow_internal_unstable]` can be applied to macro defs, functions
error: aborting due to 2 previous errors

View File

@@ -1,6 +1,4 @@
//~ NOTE: not an `extern crate` item
//~^ NOTE: not a free function, impl method or static
//~^^ NOTE: not a function or closure
// This is testing whether various builtin attributes signals an
// error or warning when put in "weird" places.
//
@@ -19,29 +17,25 @@
#![repr()]
//~^ ERROR: `repr` attribute cannot be used at crate level
#![path = "3800"]
//~^ ERROR: `path` attribute cannot be used at crate level
//~^ ERROR: attribute cannot be used on
#![automatically_derived]
//~^ ERROR: `automatically_derived` attribute cannot be used at crate level
//~^ ERROR: attribute cannot be used on
#![no_mangle]
#![no_link]
//~^ ERROR: attribute should be applied to an `extern crate` item
#![export_name = "2200"]
//~^ ERROR: attribute should be applied to a free function, impl method or static
//~^ ERROR: attribute cannot be used on
#![inline]
//~^ ERROR: attribute should be applied to function or closure
//~^ ERROR: attribute cannot be used on
#[inline]
//~^ ERROR attribute should be applied to function or closure
//~^ ERROR attribute cannot be used on
mod inline {
//~^ NOTE not a function or closure
//~| NOTE the inner attribute doesn't annotate this module
//~| NOTE the inner attribute doesn't annotate this module
//~| NOTE the inner attribute doesn't annotate this module
//~^ NOTE the inner attribute doesn't annotate this module
//~| NOTE the inner attribute doesn't annotate this module
//~| NOTE the inner attribute doesn't annotate this module
mod inner { #![inline] }
//~^ ERROR attribute should be applied to function or closure
//~| NOTE not a function or closure
//~^ ERROR attribute cannot be used on
#[inline = "2100"] fn f() { }
//~^ ERROR valid forms for the attribute are
@@ -50,16 +44,13 @@ mod inline {
//~| NOTE for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
#[inline] struct S;
//~^ ERROR attribute should be applied to function or closure
//~| NOTE not a function or closure
//~^ ERROR attribute cannot be used on
#[inline] type T = S;
//~^ ERROR attribute should be applied to function or closure
//~| NOTE not a function or closure
//~^ ERROR attribute cannot be used on
#[inline] impl S { }
//~^ ERROR attribute should be applied to function or closure
//~| NOTE not a function or closure
//~^ ERROR attribute cannot be used on
}
#[no_link]
@@ -89,36 +80,27 @@ mod no_link {
}
#[export_name = "2200"]
//~^ ERROR attribute should be applied to a free function, impl method or static
//~^ ERROR attribute cannot be used on
mod export_name {
//~^ NOTE not a free function, impl method or static
mod inner { #![export_name="2200"] }
//~^ ERROR attribute should be applied to a free function, impl method or static
//~| NOTE not a free function, impl method or static
//~^ ERROR attribute cannot be used on
#[export_name = "2200"] fn f() { }
#[export_name = "2200"] struct S;
//~^ ERROR attribute should be applied to a free function, impl method or static
//~| NOTE not a free function, impl method or static
//~^ ERROR attribute cannot be used on
#[export_name = "2200"] type T = S;
//~^ ERROR attribute should be applied to a free function, impl method or static
//~| NOTE not a free function, impl method or static
//~^ ERROR attribute cannot be used on
#[export_name = "2200"] impl S { }
//~^ ERROR attribute should be applied to a free function, impl method or static
//~| NOTE not a free function, impl method or static
//~^ ERROR attribute cannot be used on
trait Tr {
#[export_name = "2200"] fn foo();
//~^ ERROR attribute should be applied to a free function, impl method or static
//~| NOTE not a free function, impl method or static
//~^ ERROR attribute cannot be used on
#[export_name = "2200"] fn bar() {}
//~^ ERROR attribute should be applied to a free function, impl method or static
//~| NOTE not a free function, impl method or static
}
}

View File

@@ -1,5 +1,5 @@
error[E0658]: use of an internal attribute
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:14:1
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:12:1
|
LL | #![rustc_main]
| ^^^^^^^^^^^^^^
@@ -8,19 +8,128 @@ LL | #![rustc_main]
= note: the `#[rustc_main]` attribute is an internal implementation detail that will never be stable
= note: the `#[rustc_main]` attribute is used internally to specify test entry point function
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:32:1
error: `#[path]` attribute cannot be used on crates
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:19:1
|
LL | #[inline]
| ^^^^^^^^^
LL |
LL | / mod inline {
... |
LL | | }
| |_- not a function or closure
LL | #![path = "3800"]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[path]` can only be applied to modules
error: `#[automatically_derived]` attribute cannot be used on crates
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:21:1
|
LL | #![automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[automatically_derived]` can only be applied to trait impl blocks
error: `#[export_name]` attribute cannot be used on crates
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:26:1
|
LL | #![export_name = "2200"]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to functions, statics
error: `#[inline]` attribute cannot be used on crates
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:1
|
LL | #![inline]
| ^^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: `#[inline]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1
|
LL | #[inline]
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: `#[inline]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:37:17
|
LL | mod inner { #![inline] }
| ^^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: `#[inline]` attribute cannot be used on structs
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
|
LL | #[inline] struct S;
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: `#[inline]` attribute cannot be used on type aliases
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:49:5
|
LL | #[inline] type T = S;
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: `#[inline]` attribute cannot be used on inherent impl blocks
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:5
|
LL | #[inline] impl S { }
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: `#[export_name]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:82:1
|
LL | #[export_name = "2200"]
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to functions, statics
error: `#[export_name]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:85:17
|
LL | mod inner { #![export_name="2200"] }
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to functions, statics
error: `#[export_name]` attribute cannot be used on structs
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:90:5
|
LL | #[export_name = "2200"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to functions, statics
error: `#[export_name]` attribute cannot be used on type aliases
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:93:5
|
LL | #[export_name = "2200"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to functions, statics
error: `#[export_name]` attribute cannot be used on inherent impl blocks
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:5
|
LL | #[export_name = "2200"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to functions, statics
error: `#[export_name]` attribute cannot be used on required trait methods
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:100:9
|
LL | #[export_name = "2200"] fn foo();
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[export_name]` can be applied to statics, functions, inherent methods, provided trait methods, trait methods in impl blocks
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:65:1
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:56:1
|
LL | #[no_link]
| ^^^^^^^^^^
@@ -33,22 +142,8 @@ LL | | mod inner { #![no_link] }
LL | | }
| |_- not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:91:1
|
LL | #[export_name = "2200"]
| ^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / mod export_name {
LL | |
LL | |
LL | | mod inner { #![export_name="2200"] }
... |
LL | | }
| |_- not a free function, impl method or static
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:125:8
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:107:8
|
LL | #[repr(C)]
| ^
@@ -61,7 +156,7 @@ LL | | }
| |_- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:149:8
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:131:8
|
LL | #[repr(Rust)]
| ^^^^
@@ -74,25 +169,13 @@ LL | | }
| |_- not a struct, enum, or union
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:26:1
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:24:1
|
LL | #![no_link]
| ^^^^^^^^^^^ not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:28:1
|
LL | #![export_name = "2200"]
| ^^^^^^^^^^^^^^^^^^^^^^^^ not a free function, impl method or static
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:30:1
|
LL | #![inline]
| ^^^^^^^^^^ not a function or closure
error: `macro_export` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:12:1
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:10:1
|
LL | #![macro_export]
| ^^^^^^^^^^^^^^^^
@@ -107,7 +190,7 @@ LL + #[macro_export]
|
error: `rustc_main` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:14:1
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:12:1
|
LL | #![rustc_main]
| ^^^^^^^^^^^^^^
@@ -122,7 +205,7 @@ LL + #[rustc_main]
|
error: `repr` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:19:1
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:17:1
|
LL | #![repr()]
| ^^^^^^^^^^
@@ -136,176 +219,86 @@ LL - #![repr()]
LL + #[repr()]
|
error: `path` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:21:1
|
LL | #![path = "3800"]
| ^^^^^^^^^^^^^^^^^
...
LL | mod inline {
| ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
LL - #![path = "3800"]
LL + #[path = "3800"]
|
error: `automatically_derived` attribute cannot be used at crate level
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:23:1
|
LL | #![automatically_derived]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | mod inline {
| ------ the inner attribute doesn't annotate this module
|
help: perhaps you meant to use an outer attribute
|
LL - #![automatically_derived]
LL + #[automatically_derived]
|
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:42:17
|
LL | mod inner { #![inline] }
| ------------^^^^^^^^^^-- not a function or closure
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:52:5
|
LL | #[inline] struct S;
| ^^^^^^^^^ --------- not a function or closure
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:56:5
|
LL | #[inline] type T = S;
| ^^^^^^^^^ ----------- not a function or closure
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:60:5
|
LL | #[inline] impl S { }
| ^^^^^^^^^ ---------- not a function or closure
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:70:17
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:61:17
|
LL | mod inner { #![no_link] }
| ------------^^^^^^^^^^^-- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:74:5
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:65:5
|
LL | #[no_link] fn f() { }
| ^^^^^^^^^^ ---------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:78:5
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:69:5
|
LL | #[no_link] struct S;
| ^^^^^^^^^^ --------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:82:5
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:73:5
|
LL | #[no_link]type T = S;
| ^^^^^^^^^^----------- not an `extern crate` item
error: attribute should be applied to an `extern crate` item
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:86:5
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:77:5
|
LL | #[no_link] impl S { }
| ^^^^^^^^^^ ---------- not an `extern crate` item
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:96:17
|
LL | mod inner { #![export_name="2200"] }
| ------------^^^^^^^^^^^^^^^^^^^^^^-- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:102:5
|
LL | #[export_name = "2200"] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:106:5
|
LL | #[export_name = "2200"] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:110:5
|
LL | #[export_name = "2200"] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^ ---------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:115:9
|
LL | #[export_name = "2200"] fn foo();
| ^^^^^^^^^^^^^^^^^^^^^^^ --------- not a free function, impl method or static
error: attribute should be applied to a free function, impl method or static
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:119:9
|
LL | #[export_name = "2200"] fn bar() {}
| ^^^^^^^^^^^^^^^^^^^^^^^ ----------- not a free function, impl method or static
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:129:25
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:111:25
|
LL | mod inner { #![repr(C)] }
| --------------------^---- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:133:12
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:115:12
|
LL | #[repr(C)] fn f() { }
| ^ ---------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:139:12
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:121:12
|
LL | #[repr(C)] type T = S;
| ^ ----------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:143:12
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:125:12
|
LL | #[repr(C)] impl S { }
| ^ ---------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:153:25
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:135:25
|
LL | mod inner { #![repr(Rust)] }
| --------------------^^^^---- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:157:12
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:139:12
|
LL | #[repr(Rust)] fn f() { }
| ^^^^ ---------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:163:12
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:145:12
|
LL | #[repr(Rust)] type T = S;
| ^^^^ ----------- not a struct, enum, or union
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:167:12
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:149:12
|
LL | #[repr(Rust)] impl S { }
| ^^^^ ---------- not a struct, enum, or union
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:5
|
LL | #[inline = "2100"] fn f() { }
| ^^^^^^^^^^^^^^^^^^
@@ -314,13 +307,13 @@ LL | #[inline = "2100"] fn f() { }
= note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
= note: `#[deny(ill_formed_attribute_input)]` on by default
error: aborting due to 38 previous errors
error: aborting due to 37 previous errors
Some errors have detailed explanations: E0517, E0518, E0658.
Some errors have detailed explanations: E0517, E0658.
For more information about an error, try `rustc --explain E0517`.
Future incompatibility report: Future breakage diagnostic:
error: valid forms for the attribute are `#[inline(always)]`, `#[inline(never)]`, and `#[inline]`
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:46:5
--> $DIR/issue-43106-gating-of-builtin-attrs-error.rs:40:5
|
LL | #[inline = "2100"] fn f() { }
| ^^^^^^^^^^^^^^^^^^

View File

@@ -1,7 +1,4 @@
//~ NOTE not a function
//~| NOTE not a foreign function or static
//~| NOTE cannot be applied to crates
//~| NOTE not an `extern` block
//~ NOTE not an `extern` block
// This test enumerates as many compiler-builtin ungated attributes as
// possible (that is, all the mutually compatible ones), and checks
// that we get "expected" (*) warnings for each in the various weird
@@ -50,25 +47,34 @@
#![macro_use] // (allowed if no argument; see issue-43160-gating-of-macro_use.rs)
// skipping testing of cfg
// skipping testing of cfg_attr
#![should_panic] //~ WARN `#[should_panic]` only has an effect
#![ignore] //~ WARN `#[ignore]` only has an effect on functions
#![should_panic] //~ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#![ignore] //~ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#![no_implicit_prelude]
#![reexport_test_harness_main = "2900"]
// see gated-link-args.rs
// see issue-43106-gating-of-macro_escape.rs for crate-level; but non crate-level is below at "2700"
// (cannot easily test gating of crate-level #[no_std]; but non crate-level is below at "2600")
#![proc_macro_derive(Test)] //~ WARN `#[proc_macro_derive]` only has an effect
#![proc_macro_derive(Test)] //~ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#![doc = "2400"]
#![cold] //~ WARN attribute should be applied to a function
//~^ WARN this was previously accepted
#![cold] //~ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#![link()] //~ WARN attribute should be applied to an `extern` block
//~^ WARN this was previously accepted
#![link_name = "1900"]
//~^ WARN attribute should be applied to a foreign function
//~^^ WARN this was previously accepted by the compiler
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#![link_section = "1800"]
//~^ WARN attribute should be applied to a function or static
//~^^ WARN this was previously accepted by the compiler
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#![must_use]
//~^ WARN `#[must_use]` has no effect
//~| HELP remove the attribute
@@ -175,16 +181,24 @@ mod macro_use {
mod inner { #![macro_use] }
#[macro_use] fn f() { }
//~^ WARN `#[macro_use]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[macro_use] struct S;
//~^ WARN `#[macro_use]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[macro_use] type T = S;
//~^ WARN `#[macro_use]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[macro_use] impl S { }
//~^ WARN `#[macro_use]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
}
#[macro_export]
@@ -243,116 +257,158 @@ mod path {
mod inner { #![path="3800"] }
#[path = "3800"] fn f() { }
//~^ WARN `#[path]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[path = "3800"] struct S;
//~^ WARN `#[path]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[path = "3800"] type T = S;
//~^ WARN `#[path]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[path = "3800"] impl S { }
//~^ WARN `#[path]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
}
#[automatically_derived]
//~^ WARN `#[automatically_derived]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
mod automatically_derived {
mod inner { #![automatically_derived] }
//~^ WARN `#[automatically_derived]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[automatically_derived] fn f() { }
//~^ WARN `#[automatically_derived]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[automatically_derived] struct S;
//~^ WARN `#[automatically_derived]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[automatically_derived] type T = S;
//~^ WARN `#[automatically_derived]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[automatically_derived] trait W { }
//~^ WARN `#[automatically_derived]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[automatically_derived] impl S { }
//~^ WARN `#[automatically_derived]
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[automatically_derived] impl W for S { }
}
#[no_mangle]
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
mod no_mangle {
//~^ NOTE not a free function, impl method or static
mod inner { #![no_mangle] }
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a free function, impl method or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_mangle] fn f() { }
#[no_mangle] struct S;
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a free function, impl method or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_mangle] type T = S;
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a free function, impl method or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_mangle] impl S { }
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a free function, impl method or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
trait Tr {
#[no_mangle] fn foo();
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a free function, impl method or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_mangle] fn bar() {}
//~^ WARN attribute should be applied to a free function, impl method or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a free function, impl method or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
}
}
#[should_panic]
//~^ WARN `#[should_panic]` only has an effect on
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
mod should_panic {
mod inner { #![should_panic] }
//~^ WARN `#[should_panic]` only has an effect on
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[should_panic] fn f() { }
#[should_panic] struct S;
//~^ WARN `#[should_panic]` only has an effect on
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[should_panic] type T = S;
//~^ WARN `#[should_panic]` only has an effect on
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[should_panic] impl S { }
//~^ WARN `#[should_panic]` only has an effect on
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
}
#[ignore]
//~^ WARN `#[ignore]` only has an effect on functions
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
mod ignore {
mod inner { #![ignore] }
//~^ WARN `#[ignore]` only has an effect on functions
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[ignore] fn f() { }
#[ignore] struct S;
//~^ WARN `#[ignore]` only has an effect on functions
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[ignore] type T = S;
//~^ WARN `#[ignore]` only has an effect on functions
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[ignore] impl S { }
//~^ WARN `#[ignore]` only has an effect on functions
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
}
#[no_implicit_prelude]
@@ -360,16 +416,24 @@ mod no_implicit_prelude {
mod inner { #![no_implicit_prelude] }
#[no_implicit_prelude] fn f() { }
//~^ WARN `#[no_implicit_prelude]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_implicit_prelude] struct S;
//~^ WARN `#[no_implicit_prelude]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_implicit_prelude] type T = S;
//~^ WARN `#[no_implicit_prelude]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[no_implicit_prelude] impl S { }
//~^ WARN `#[no_implicit_prelude]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
}
#[reexport_test_harness_main = "2900"]
@@ -400,16 +464,24 @@ mod macro_escape {
//~| HELP try an outer attribute: `#[macro_use]`
#[macro_escape] fn f() { }
//~^ WARN `#[macro_escape]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[macro_escape] struct S;
//~^ WARN `#[macro_escape]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[macro_escape] type T = S;
//~^ WARN `#[macro_escape]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[macro_escape] impl S { }
//~^ WARN `#[macro_escape]` only has an effect
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
}
#[no_std]
@@ -449,100 +521,97 @@ mod doc {
}
#[cold]
//~^ WARN attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
mod cold {
//~^ NOTE not a function
mod inner { #![cold] }
//~^ WARN attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[cold] fn f() { }
#[cold] struct S;
//~^ WARN attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[cold] type T = S;
//~^ WARN attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
#[cold] impl S { }
//~^ WARN attribute should be applied to a function
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can only be applied to
}
#[link_name = "1900"]
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
mod link_name {
//~^ NOTE not a foreign function or static
#[link_name = "1900"]
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| HELP try `#[link(name = "1900")]` instead
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
extern "C" { }
//~^ NOTE not a foreign function or static
mod inner { #![link_name="1900"] }
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a foreign function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_name = "1900"] fn f() { }
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a foreign function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_name = "1900"] struct S;
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a foreign function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_name = "1900"] type T = S;
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a foreign function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_name = "1900"] impl S { }
//~^ WARN attribute should be applied to a foreign function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a foreign function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
}
#[link_section = "1800"]
//~^ WARN attribute should be applied to a function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
mod link_section {
//~^ NOTE not a function or static
mod inner { #![link_section="1800"] }
//~^ WARN attribute should be applied to a function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_section = "1800"] fn f() { }
#[link_section = "1800"] struct S;
//~^ WARN attribute should be applied to a function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_section = "1800"] type T = S;
//~^ WARN attribute should be applied to a function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
#[link_section = "1800"] impl S { }
//~^ WARN attribute should be applied to a function or static [unused_attributes]
//~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
//~| NOTE not a function or static
//~^ WARN attribute cannot be used on
//~| WARN previously accepted
//~| HELP can be applied to
}

View File

@@ -1,34 +1,29 @@
// At time of authorship, #[proc_macro_derive = "2500"] will emit an
// error when it occurs on a mod (apart from crate-level), but will
// not descend further into the mod for other occurrences of the same
// error.
//
// This file sits on its own because the "weird" occurrences here
// This file sits on its own because the occurrences here
// signal errors, making it incompatible with the "warnings only"
// nature of issue-43106-gating-of-builtin-attrs.rs
#[proc_macro_derive(Test)]
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
//~^ ERROR attribute cannot be used on
mod proc_macro_derive1 {
mod inner { #![proc_macro_derive(Test)] }
// (no error issued here if there was one on outer module)
//~^ ERROR attribute cannot be used on
}
mod proc_macro_derive2 {
mod inner { #![proc_macro_derive(Test)] }
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
//~^ ERROR attribute cannot be used on
#[proc_macro_derive(Test)] fn f() { }
//~^ ERROR the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro`
#[proc_macro_derive(Test)] struct S;
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
//~^ ERROR attribute cannot be used on
#[proc_macro_derive(Test)] type T = S;
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
//~^ ERROR attribute cannot be used on
#[proc_macro_derive(Test)] impl S { }
//~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions
//~^ ERROR attribute cannot be used on
}
fn main() {}

View File

@@ -1,38 +1,56 @@
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:10:1
|
LL | #[proc_macro_derive(Test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:18:17
|
LL | mod inner { #![proc_macro_derive(Test)] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:21:5
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:16:5
|
LL | #[proc_macro_derive(Test)] fn f() { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:24:5
error: `#[proc_macro_derive]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:5:1
|
LL | #[proc_macro_derive(Test)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: `#[proc_macro_derive]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:8:17
|
LL | mod inner { #![proc_macro_derive(Test)] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: `#[proc_macro_derive]` attribute cannot be used on modules
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:13:17
|
LL | mod inner { #![proc_macro_derive(Test)] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: `#[proc_macro_derive]` attribute cannot be used on structs
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:19:5
|
LL | #[proc_macro_derive(Test)] struct S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:27:5
error: `#[proc_macro_derive]` attribute cannot be used on type aliases
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:22:5
|
LL | #[proc_macro_derive(Test)] type T = S;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:30:5
error: `#[proc_macro_derive]` attribute cannot be used on inherent impl blocks
--> $DIR/issue-43106-gating-of-proc_macro_derive.rs:25:5
|
LL | #[proc_macro_derive(Test)] impl S { }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: aborting due to 6 previous errors
error: aborting due to 7 previous errors

View File

@@ -1,16 +1,16 @@
#![feature(ffi_const)]
#![crate_type = "lib"]
#[unsafe(ffi_const)] //~ ERROR `#[ffi_const]` may only be used on foreign functions
#[unsafe(ffi_const)] //~ ERROR attribute cannot be used on
pub fn foo() {}
#[unsafe(ffi_const)] //~ ERROR `#[ffi_const]` may only be used on foreign functions
#[unsafe(ffi_const)] //~ ERROR attribute cannot be used on
macro_rules! bar {
() => {};
}
extern "C" {
#[unsafe(ffi_const)] //~ ERROR `#[ffi_const]` may only be used on foreign functions
#[unsafe(ffi_const)] //~ ERROR attribute cannot be used on
static INT: i32;
#[ffi_const] //~ ERROR unsafe attribute used without unsafe

View File

@@ -9,24 +9,29 @@ help: wrap the attribute in `unsafe(...)`
LL | #[unsafe(ffi_const)]
| +++++++ +
error[E0756]: `#[ffi_const]` may only be used on foreign functions
error: `#[ffi_const]` attribute cannot be used on functions
--> $DIR/ffi_const.rs:4:1
|
LL | #[unsafe(ffi_const)]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: `#[ffi_const]` can only be applied to foreign functions
error[E0756]: `#[ffi_const]` may only be used on foreign functions
error: `#[ffi_const]` attribute cannot be used on macro defs
--> $DIR/ffi_const.rs:7:1
|
LL | #[unsafe(ffi_const)]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: `#[ffi_const]` can only be applied to foreign functions
error[E0756]: `#[ffi_const]` may only be used on foreign functions
error: `#[ffi_const]` attribute cannot be used on foreign statics
--> $DIR/ffi_const.rs:13:5
|
LL | #[unsafe(ffi_const)]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: `#[ffi_const]` can only be applied to foreign functions
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0756`.

View File

@@ -1,16 +1,16 @@
#![feature(ffi_pure)]
#![crate_type = "lib"]
#[unsafe(ffi_pure)] //~ ERROR `#[ffi_pure]` may only be used on foreign functions
#[unsafe(ffi_pure)] //~ ERROR attribute cannot be used on
pub fn foo() {}
#[unsafe(ffi_pure)] //~ ERROR `#[ffi_pure]` may only be used on foreign functions
#[unsafe(ffi_pure)] //~ ERROR attribute cannot be used on
macro_rules! bar {
() => {};
}
extern "C" {
#[unsafe(ffi_pure)] //~ ERROR `#[ffi_pure]` may only be used on foreign functions
#[unsafe(ffi_pure)] //~ ERROR attribute cannot be used on
static INT: i32;
#[ffi_pure] //~ ERROR unsafe attribute used without unsafe

View File

@@ -9,24 +9,29 @@ help: wrap the attribute in `unsafe(...)`
LL | #[unsafe(ffi_pure)]
| +++++++ +
error[E0755]: `#[ffi_pure]` may only be used on foreign functions
error: `#[ffi_pure]` attribute cannot be used on functions
--> $DIR/ffi_pure.rs:4:1
|
LL | #[unsafe(ffi_pure)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[ffi_pure]` can only be applied to foreign functions
error[E0755]: `#[ffi_pure]` may only be used on foreign functions
error: `#[ffi_pure]` attribute cannot be used on macro defs
--> $DIR/ffi_pure.rs:7:1
|
LL | #[unsafe(ffi_pure)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[ffi_pure]` can only be applied to foreign functions
error[E0755]: `#[ffi_pure]` may only be used on foreign functions
error: `#[ffi_pure]` attribute cannot be used on foreign statics
--> $DIR/ffi_pure.rs:13:5
|
LL | #[unsafe(ffi_pure)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[ffi_pure]` can only be applied to foreign functions
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0755`.

View File

@@ -28,110 +28,110 @@ pub fn forced4() {
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
extern crate std as other_std;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
use std::collections::HashMap;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
static _FOO: &'static str = "FOO";
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
const _BAR: u32 = 3;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
mod foo { }
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
unsafe extern "C" {
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
static X: &'static u32;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
type Y;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
fn foo();
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
type Foo = u32;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
enum Bar<#[rustc_force_inline] T> {
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
Baz(std::marker::PhantomData<T>),
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
struct Qux {
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
field: u32,
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
union FooBar {
x: u32,
y: u32,
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
trait FooBaz {
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
type Foo;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
const Bar: i32;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
fn foo() {}
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
trait FooQux = FooBaz;
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
impl<T> Bar<T> {
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
fn foo() {}
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
impl<T> FooBaz for Bar<T> {
type Foo = u32;
const Bar: i32 = 3;
}
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
macro_rules! barqux { ($foo:tt) => { $foo }; }
fn barqux(#[rustc_force_inline] _x: u32) {}
//~^ ERROR allow, cfg, cfg_attr, deny, expect, forbid, and warn are the only allowed built-in attributes in function parameters
//~^^ ERROR attribute should be applied to a function
//~^^ ERROR attribute cannot be used on
#[rustc_force_inline]
//~^ ERROR attribute cannot be applied to a `async`, `gen` or `async gen` function
@@ -147,16 +147,16 @@ async gen fn async_gen_foo() {}
fn main() {
let _x = #[rustc_force_inline] || { };
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
let _y = #[rustc_force_inline] 3 + 4;
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
let _z = 3;
match _z {
#[rustc_force_inline]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
1 => (),
_ => (),
}

View File

@@ -64,202 +64,245 @@ LL - #[rustc_force_inline = 2]
LL + #[rustc_force_inline]
|
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on extern crates
--> $DIR/invalid.rs:30:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | extern crate std as other_std;
| ------------------------------ not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on use statements
--> $DIR/invalid.rs:34:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | use std::collections::HashMap;
| ------------------------------ not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on statics
--> $DIR/invalid.rs:38:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | static _FOO: &'static str = "FOO";
| ---------------------------------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on constants
--> $DIR/invalid.rs:42:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | const _BAR: u32 = 3;
| -------------------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on modules
--> $DIR/invalid.rs:46:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | mod foo { }
| ----------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on foreign modules
--> $DIR/invalid.rs:50:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / unsafe extern "C" {
LL | | #[rustc_force_inline]
LL | |
LL | | static X: &'static u32;
... |
LL | | fn foo();
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on foreign statics
--> $DIR/invalid.rs:53:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on foreign types
--> $DIR/invalid.rs:57:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on foreign functions
--> $DIR/invalid.rs:61:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on type aliases
--> $DIR/invalid.rs:66:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | type Foo = u32;
| --------------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on enums
--> $DIR/invalid.rs:70:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / enum Bar<#[rustc_force_inline] T> {
LL | |
LL | | #[rustc_force_inline]
... |
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on function params
--> $DIR/invalid.rs:72:10
|
LL | enum Bar<#[rustc_force_inline] T> {
| ^^^^^^^^^^^^^^^^^^^^^ - not a function definition
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on enum variants
--> $DIR/invalid.rs:74:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | Baz(std::marker::PhantomData<T>),
| -------------------------------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on structs
--> $DIR/invalid.rs:79:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / struct Qux {
LL | | #[rustc_force_inline]
LL | |
LL | | field: u32,
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on struct fields
--> $DIR/invalid.rs:82:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | field: u32,
| ---------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on unions
--> $DIR/invalid.rs:87:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / union FooBar {
LL | | x: u32,
LL | | y: u32,
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on traits
--> $DIR/invalid.rs:94:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / trait FooBaz {
LL | | #[rustc_force_inline]
LL | |
LL | | type Foo;
... |
LL | | fn foo() {}
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on associated types
--> $DIR/invalid.rs:97:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on associated consts
--> $DIR/invalid.rs:100:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on provided trait methods
--> $DIR/invalid.rs:104:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on trait aliases
--> $DIR/invalid.rs:109:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | trait FooQux = FooBaz;
| ---------------------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on inherent impl blocks
--> $DIR/invalid.rs:113:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / impl<T> Bar<T> {
LL | | #[rustc_force_inline]
LL | |
LL | | fn foo() {}
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on inherent methods
--> $DIR/invalid.rs:116:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on trait impl blocks
--> $DIR/invalid.rs:121:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / impl<T> FooBaz for Bar<T> {
LL | | type Foo = u32;
LL | | const Bar: i32 = 3;
LL | | }
| |_- not a function definition
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on macro defs
--> $DIR/invalid.rs:128:1
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | macro_rules! barqux { ($foo:tt) => { $foo }; }
| ---------------------------------------------- not a function definition
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute should be applied to a function
error: `#[rustc_force_inline]` attribute cannot be used on function params
--> $DIR/invalid.rs:132:11
|
LL | fn barqux(#[rustc_force_inline] _x: u32) {}
| ^^^^^^^^^^^^^^^^^^^^^--------
| |
| not a function definition
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on closures
--> $DIR/invalid.rs:149:14
|
LL | let _x = #[rustc_force_inline] || { };
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on expressions
--> $DIR/invalid.rs:151:14
|
LL | let _y = #[rustc_force_inline] 3 + 4;
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on statements
--> $DIR/invalid.rs:153:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: `#[rustc_force_inline]` attribute cannot be used on match arms
--> $DIR/invalid.rs:158:9
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_force_inline]` can only be applied to functions
error: attribute cannot be applied to a `async`, `gen` or `async gen` function
--> $DIR/invalid.rs:136:1
@@ -288,99 +331,6 @@ LL |
LL | async gen fn async_gen_foo() {}
| ---------------------------- `async`, `gen` or `async gen` function
error: attribute should be applied to a function
--> $DIR/invalid.rs:149:14
|
LL | let _x = #[rustc_force_inline] || { };
| ^^^^^^^^^^^^^^^^^^^^^ ------ not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:151:14
|
LL | let _y = #[rustc_force_inline] 3 + 4;
| ^^^^^^^^^^^^^^^^^^^^^ - not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:153:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | let _z = 3;
| ----------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:158:9
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | 1 => (),
| ------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:97:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | type Foo;
| --------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:100:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | const Bar: i32;
| --------------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:104:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn foo() {}
| ----------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:116:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn foo() {}
| ----------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:53:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | static X: &'static u32;
| ----------------------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:57:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | type Y;
| ------- not a function definition
error: attribute should be applied to a function
--> $DIR/invalid.rs:61:5
|
LL | #[rustc_force_inline]
| ^^^^^^^^^^^^^^^^^^^^^
LL |
LL | fn foo();
| --------- not a function definition
error: aborting due to 37 previous errors
Some errors have detailed explanations: E0539, E0805.

View File

@@ -25,6 +25,14 @@ LL | #[rustc_layout_scalar_valid_range_end(a = "a")]
| | expected an integer literal here
| help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
error: `#[rustc_layout_scalar_valid_range_end]` attribute cannot be used on enums
--> $DIR/invalid_rustc_layout_scalar_valid_range.rs:12:1
|
LL | #[rustc_layout_scalar_valid_range_end(1)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[rustc_layout_scalar_valid_range_end]` can only be applied to structs
error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
--> $DIR/invalid_rustc_layout_scalar_valid_range.rs:18:1
|
@@ -34,17 +42,6 @@ LL | #[rustc_layout_scalar_valid_range_start(rustc_layout_scalar_valid_range_sta
| | expected an integer literal here
| help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
error: attribute should be applied to a struct
--> $DIR/invalid_rustc_layout_scalar_valid_range.rs:12:1
|
LL | #[rustc_layout_scalar_valid_range_end(1)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL | / enum E {
LL | | X = 1,
LL | | Y = 14,
LL | | }
| |_- not a struct
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0539, E0805.

View File

@@ -1,4 +1,4 @@
fn main() {
#[inline] struct Foo; //~ ERROR attribute should be applied to function or closure
#[inline] struct Foo; //~ ERROR attribute cannot be used on
#[repr(C)] fn foo() {} //~ ERROR attribute should be applied to a struct, enum, or union
}

View File

@@ -1,8 +1,10 @@
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on structs
--> $DIR/issue-31769.rs:2:5
|
LL | #[inline] struct Foo;
| ^^^^^^^^^ ----------- not a function or closure
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-31769.rs:3:12
@@ -12,5 +14,4 @@ LL | #[repr(C)] fn foo() {}
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0517, E0518.
For more information about an error, try `rustc --explain E0517`.
For more information about this error, try `rustc --explain E0517`.

View File

@@ -4,12 +4,13 @@ fn main() {
#[inline]
let _a = 4;
//~^^ ERROR attribute should be applied to function or closure
//~^^ ERROR attribute cannot be used on
#[inline(XYZ)]
let _b = 4;
//~^^ ERROR malformed `inline` attribute
//~| ERROR attribute cannot be used on
#[repr(nothing)]
let _x = 0;
@@ -30,6 +31,7 @@ fn main() {
#[inline(ABC)]
foo();
//~^^ ERROR malformed `inline` attribute
//~| ERROR attribute cannot be used on
let _z = #[repr] 1;
//~^ ERROR malformed `repr` attribute

View File

@@ -1,3 +1,11 @@
error: `#[inline]` attribute cannot be used on statements
--> $DIR/issue-43988.rs:5:5
|
LL | #[inline]
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error[E0539]: malformed `inline` attribute input
--> $DIR/issue-43988.rs:10:5
|
@@ -19,8 +27,16 @@ LL - #[inline(XYZ)]
LL + #[inline]
|
error: `#[inline]` attribute cannot be used on statements
--> $DIR/issue-43988.rs:10:5
|
LL | #[inline(XYZ)]
| ^^^^^^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error[E0552]: unrecognized representation hint
--> $DIR/issue-43988.rs:14:12
--> $DIR/issue-43988.rs:15:12
|
LL | #[repr(nothing)]
| ^^^^^^^
@@ -29,7 +45,7 @@ LL | #[repr(nothing)]
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
error[E0552]: unrecognized representation hint
--> $DIR/issue-43988.rs:18:12
--> $DIR/issue-43988.rs:19:12
|
LL | #[repr(something_not_real)]
| ^^^^^^^^^^^^^^^^^^
@@ -38,7 +54,7 @@ LL | #[repr(something_not_real)]
= note: for more information, visit <https://doc.rust-lang.org/reference/type-layout.html?highlight=repr#representations>
error[E0539]: malformed `repr` attribute input
--> $DIR/issue-43988.rs:24:5
--> $DIR/issue-43988.rs:25:5
|
LL | #[repr]
| ^^^^^^^ expected this to be a list
@@ -57,7 +73,7 @@ LL | #[repr(align(...))]
= and 2 other candidates
error[E0539]: malformed `inline` attribute input
--> $DIR/issue-43988.rs:30:5
--> $DIR/issue-43988.rs:31:5
|
LL | #[inline(ABC)]
| ^^^^^^^^^---^^
@@ -77,8 +93,16 @@ LL - #[inline(ABC)]
LL + #[inline]
|
error: `#[inline]` attribute cannot be used on expressions
--> $DIR/issue-43988.rs:31:5
|
LL | #[inline(ABC)]
| ^^^^^^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error[E0539]: malformed `repr` attribute input
--> $DIR/issue-43988.rs:34:14
--> $DIR/issue-43988.rs:36:14
|
LL | let _z = #[repr] 1;
| ^^^^^^^ expected this to be a list
@@ -96,15 +120,7 @@ LL | let _z = #[repr(align(...))] 1;
| ++++++++++++
= and 2 other candidates
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-43988.rs:5:5
|
LL | #[inline]
| ^^^^^^^^^
LL | let _a = 4;
| ----------- not a function or closure
error: aborting due to 9 previous errors
error: aborting due to 7 previous errors
Some errors have detailed explanations: E0518, E0539, E0552.
For more information about an error, try `rustc --explain E0518`.
Some errors have detailed explanations: E0539, E0552.
For more information about an error, try `rustc --explain E0539`.

View File

@@ -3,26 +3,26 @@
use std::marker::PhantomData;
pub struct Foo<#[inline] const N: usize>;
//~^ ERROR attribute should be applied to function or closure
//~^ ERROR attribute cannot be used on
pub struct Bar<#[cold] const N: usize>;
//~^ ERROR attribute should be applied to a function
//~| WARN this was previously accepted
//~^ ERROR attribute cannot be used on
//~| WARN previously accepted
pub struct Baz<#[repr(C)] const N: usize>;
//~^ ERROR attribute should be applied to a struct, enum, or union
//
pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>);
//~^ ERROR attribute should be applied to function or closure
//~^ ERROR attribute cannot be used on
pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>);
//~^ ERROR attribute should be applied to a function
//~| WARN this was previously accepted
//~^ ERROR attribute cannot be used on
//~| WARN previously accepted
pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>);
//~^ ERROR attribute should be applied to a struct, enum, or union
//
pub struct Foo3<#[inline] T>(PhantomData<T>);
//~^ ERROR attribute should be applied to function or closure
//~^ ERROR attribute cannot be used on
pub struct Bar3<#[cold] T>(PhantomData<T>);
//~^ ERROR attribute should be applied to a function
//~| WARN this was previously accepted
//~^ ERROR attribute cannot be used on
//~| WARN previously accepted
pub struct Baz3<#[repr(C)] T>(PhantomData<T>);
//~^ ERROR attribute should be applied to a struct, enum, or union

View File

@@ -1,21 +1,26 @@
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on function params
--> $DIR/issue-78957.rs:5:16
|
LL | pub struct Foo<#[inline] const N: usize>;
| ^^^^^^^^^ -------------- not a function or closure
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/issue-78957.rs:7:16
error: `#[inline]` attribute cannot be used on function params
--> $DIR/issue-78957.rs:13:17
|
LL | pub struct Bar<#[cold] const N: usize>;
| ^^^^^^^ -------------- not a function definition
LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>);
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
note: the lint level is defined here
--> $DIR/issue-78957.rs:1:9
= help: `#[inline]` can only be applied to functions
error: `#[inline]` attribute cannot be used on function params
--> $DIR/issue-78957.rs:21:17
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
LL | pub struct Foo3<#[inline] T>(PhantomData<T>);
| ^^^^^^^^^
|
= help: `#[inline]` can only be applied to functions
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-78957.rs:10:23
@@ -23,47 +28,50 @@ error[E0517]: attribute should be applied to a struct, enum, or union
LL | pub struct Baz<#[repr(C)] const N: usize>;
| ^ -------------- not a struct, enum, or union
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-78957.rs:13:17
|
LL | pub struct Foo2<#[inline] 'a>(PhantomData<&'a ()>);
| ^^^^^^^^^ -- not a function or closure
error: attribute should be applied to a function definition
--> $DIR/issue-78957.rs:15:17
|
LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>);
| ^^^^^^^ -- not a function definition
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-78957.rs:18:24
|
LL | pub struct Baz2<#[repr(C)] 'a>(PhantomData<&'a ()>);
| ^ -- not a struct, enum, or union
error[E0518]: attribute should be applied to function or closure
--> $DIR/issue-78957.rs:21:17
|
LL | pub struct Foo3<#[inline] T>(PhantomData<T>);
| ^^^^^^^^^ - not a function or closure
error: attribute should be applied to a function definition
--> $DIR/issue-78957.rs:23:17
|
LL | pub struct Bar3<#[cold] T>(PhantomData<T>);
| ^^^^^^^ - not a function definition
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
error[E0517]: attribute should be applied to a struct, enum, or union
--> $DIR/issue-78957.rs:26:24
|
LL | pub struct Baz3<#[repr(C)] T>(PhantomData<T>);
| ^ - not a struct, enum, or union
error: `#[cold]` attribute cannot be used on function params
--> $DIR/issue-78957.rs:7:16
|
LL | pub struct Bar<#[cold] const N: usize>;
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[cold]` can only be applied to functions
note: the lint level is defined here
--> $DIR/issue-78957.rs:1:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: `#[cold]` attribute cannot be used on function params
--> $DIR/issue-78957.rs:15:17
|
LL | pub struct Bar2<#[cold] 'a>(PhantomData<&'a ()>);
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[cold]` can only be applied to functions
error: `#[cold]` attribute cannot be used on function params
--> $DIR/issue-78957.rs:23:17
|
LL | pub struct Bar3<#[cold] T>(PhantomData<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: `#[cold]` can only be applied to functions
error: aborting due to 9 previous errors
Some errors have detailed explanations: E0517, E0518.
For more information about an error, try `rustc --explain E0517`.
For more information about this error, try `rustc --explain E0517`.

View File

@@ -1,13 +1,13 @@
#[link_ordinal(123)]
//~^ ERROR attribute should be applied to a foreign function or static
//~^ ERROR attribute cannot be used on
struct Foo {}
#[link_ordinal(123)]
//~^ ERROR attribute should be applied to a foreign function or static
//~^ ERROR attribute cannot be used on
fn test() {}
#[link_ordinal(42)]
//~^ ERROR attribute should be applied to a foreign function or static
//~^ ERROR attribute cannot be used on
static mut imported_val: i32 = 123;
#[link(name = "exporter", kind = "raw-dylib")]

View File

@@ -1,20 +1,26 @@
error: attribute should be applied to a foreign function or static
error: `#[link_ordinal]` attribute cannot be used on structs
--> $DIR/link-ordinal-not-foreign-fn.rs:1:1
|
LL | #[link_ordinal(123)]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: `#[link_ordinal]` can be applied to foreign functions, foreign statics
error: attribute should be applied to a foreign function or static
error: `#[link_ordinal]` attribute cannot be used on functions
--> $DIR/link-ordinal-not-foreign-fn.rs:5:1
|
LL | #[link_ordinal(123)]
| ^^^^^^^^^^^^^^^^^^^^
|
= help: `#[link_ordinal]` can be applied to foreign functions, foreign statics
error: attribute should be applied to a foreign function or static
error: `#[link_ordinal]` attribute cannot be used on statics
--> $DIR/link-ordinal-not-foreign-fn.rs:9:1
|
LL | #[link_ordinal(42)]
| ^^^^^^^^^^^^^^^^^^^
|
= help: `#[link_ordinal]` can be applied to foreign functions, foreign statics
error: aborting due to 3 previous errors

View File

@@ -4,33 +4,33 @@
#![warn(unused_attributes)]
trait Trait {
#[inline] //~ WARN `#[inline]` is ignored on constants
//~^ WARN this was previously accepted
#[inline] //~ WARN attribute cannot be used on
//~| WARN previously accepted
const X: u32;
#[inline] //~ ERROR attribute should be applied to function or closure
#[inline] //~ ERROR attribute cannot be used on
type T;
type U;
}
impl Trait for () {
#[inline] //~ WARN `#[inline]` is ignored on constants
//~^ WARN this was previously accepted
#[inline] //~ WARN attribute cannot be used on
//~| WARN previously accepted
const X: u32 = 0;
#[inline] //~ ERROR attribute should be applied to function or closure
#[inline] //~ ERROR attribute cannot be used on
type T = Self;
#[inline] //~ ERROR attribute should be applied to function or closure
#[inline] //~ ERROR attribute cannot be used on
type U = impl Trait; //~ ERROR unconstrained opaque type
}
extern "C" {
#[inline] //~ ERROR attribute should be applied to function or closure
#[inline] //~ ERROR attribute cannot be used on
static X: u32;
#[inline] //~ ERROR attribute should be applied to function or closure
#[inline] //~ ERROR attribute cannot be used on
type T;
}

View File

@@ -1,65 +1,42 @@
warning: `#[inline]` is ignored on constants
--> $DIR/inline-trait-and-foreign-items.rs:7:5
|
LL | #[inline]
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: see issue #65833 <https://github.com/rust-lang/rust/issues/65833> for more information
note: the lint level is defined here
--> $DIR/inline-trait-and-foreign-items.rs:4:9
|
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on associated types
--> $DIR/inline-trait-and-foreign-items.rs:11:5
|
LL | #[inline]
| ^^^^^^^^^
LL | type T;
| ------- not a function or closure
warning: `#[inline]` is ignored on constants
--> $DIR/inline-trait-and-foreign-items.rs:18:5
|
LL | #[inline]
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: see issue #65833 <https://github.com/rust-lang/rust/issues/65833> for more information
= help: `#[inline]` can only be applied to functions
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on associated types
--> $DIR/inline-trait-and-foreign-items.rs:22:5
|
LL | #[inline]
| ^^^^^^^^^
LL | type T = Self;
| -------------- not a function or closure
|
= help: `#[inline]` can only be applied to functions
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on associated types
--> $DIR/inline-trait-and-foreign-items.rs:25:5
|
LL | #[inline]
| ^^^^^^^^^
LL | type U = impl Trait;
| -------------------- not a function or closure
|
= help: `#[inline]` can only be applied to functions
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on foreign statics
--> $DIR/inline-trait-and-foreign-items.rs:30:5
|
LL | #[inline]
| ^^^^^^^^^
LL | static X: u32;
| -------------- not a function or closure
|
= help: `#[inline]` can only be applied to functions
error[E0518]: attribute should be applied to function or closure
error: `#[inline]` attribute cannot be used on foreign types
--> $DIR/inline-trait-and-foreign-items.rs:33:5
|
LL | #[inline]
| ^^^^^^^^^
LL | type T;
| ------- not a function or closure
|
= help: `#[inline]` can only be applied to functions
error: unconstrained opaque type
--> $DIR/inline-trait-and-foreign-items.rs:26:14
@@ -69,6 +46,28 @@ LL | type U = impl Trait;
|
= note: `U` must be used in combination with a concrete type within the same impl
warning: `#[inline]` attribute cannot be used on associated consts
--> $DIR/inline-trait-and-foreign-items.rs:7:5
|
LL | #[inline]
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[inline]` can only be applied to functions
note: the lint level is defined here
--> $DIR/inline-trait-and-foreign-items.rs:4:9
|
LL | #![warn(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
warning: `#[inline]` attribute cannot be used on associated consts
--> $DIR/inline-trait-and-foreign-items.rs:18:5
|
LL | #[inline]
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[inline]` can only be applied to functions
error: aborting due to 6 previous errors; 2 warnings emitted
For more information about this error, try `rustc --explain E0518`.

View File

@@ -4,8 +4,10 @@
// A sample of various built-in attributes.
#[macro_export]
#[macro_use] //~ ERROR `#[macro_use]` only has an effect
#[path="foo"] //~ ERROR #[path]` only has an effect
#[macro_use] //~ ERROR attribute cannot be used on
//~| WARN previously accepted
#[path="foo"] //~ ERROR attribute cannot be used on
//~| WARN previously accepted
#[recursion_limit="1"] //~ ERROR crate-level attribute should be an inner attribute
macro_rules! foo {
() => {};

View File

@@ -1,5 +1,5 @@
error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
--> $DIR/unused-attr-macro-rules.rs:9:1
--> $DIR/unused-attr-macro-rules.rs:11:1
|
LL | #[recursion_limit="1"]
| ^^^^^^^^^^^^^^^^^^^^^^
@@ -10,17 +10,23 @@ note: the lint level is defined here
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: `#[macro_use]` only has an effect on `extern crate` and modules
error: `#[macro_use]` attribute cannot be used on macro defs
--> $DIR/unused-attr-macro-rules.rs:7:1
|
LL | #[macro_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: `#[macro_use]` can be applied to modules, extern crates, crates
error: `#[path]` only has an effect on modules
--> $DIR/unused-attr-macro-rules.rs:8:1
error: `#[path]` attribute cannot be used on macro defs
--> $DIR/unused-attr-macro-rules.rs:9:1
|
LL | #[path="foo"]
| ^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[path]` can only be applied to modules
error: aborting due to 3 previous errors

View File

@@ -15,127 +15,127 @@ note: the lint level is defined here
LL | #![deny(unused_attributes, unused_must_use)]
| ^^^^^^^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to an extern crate
error: `#[must_use]` has no effect when applied to extern crates
--> $DIR/unused_attributes-must_use.rs:7:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a module
error: `#[must_use]` has no effect when applied to modules
--> $DIR/unused_attributes-must_use.rs:10:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a use
error: `#[must_use]` has no effect when applied to use statements
--> $DIR/unused_attributes-must_use.rs:13:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a constant item
error: `#[must_use]` has no effect when applied to constants
--> $DIR/unused_attributes-must_use.rs:16:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a static item
error: `#[must_use]` has no effect when applied to statics
--> $DIR/unused_attributes-must_use.rs:18:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to an inherent implementation block
error: `#[must_use]` has no effect when applied to inherent impl blocks
--> $DIR/unused_attributes-must_use.rs:35:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a foreign module
error: `#[must_use]` has no effect when applied to foreign modules
--> $DIR/unused_attributes-must_use.rs:49:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a type alias
error: `#[must_use]` has no effect when applied to type aliases
--> $DIR/unused_attributes-must_use.rs:63:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a type parameter
error: `#[must_use]` has no effect when applied to type parameters
--> $DIR/unused_attributes-must_use.rs:66:8
|
LL | fn qux<#[must_use] T>(_: T) {}
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to an trait implementation block
error: `#[must_use]` has no effect when applied to trait impl blocks
--> $DIR/unused_attributes-must_use.rs:81:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a trait alias
error: `#[must_use]` has no effect when applied to trait aliases
--> $DIR/unused_attributes-must_use.rs:91:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a macro def
error: `#[must_use]` has no effect when applied to macro defs
--> $DIR/unused_attributes-must_use.rs:94:1
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a statement
error: `#[must_use]` has no effect when applied to statements
--> $DIR/unused_attributes-must_use.rs:102:5
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a closure
error: `#[must_use]` has no effect when applied to closures
--> $DIR/unused_attributes-must_use.rs:106:13
|
LL | let x = #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to an match arm
error: `#[must_use]` has no effect when applied to match arms
--> $DIR/unused_attributes-must_use.rs:128:9
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a struct field
error: `#[must_use]` has no effect when applied to struct fields
--> $DIR/unused_attributes-must_use.rs:136:28
|
LL | let s = PatternField { #[must_use] foo: 123 };
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a pattern field
error: `#[must_use]` has no effect when applied to pattern fields
--> $DIR/unused_attributes-must_use.rs:137:24
|
LL | let PatternField { #[must_use] foo } = s;
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to an associated const
error: `#[must_use]` has no effect when applied to associated consts
--> $DIR/unused_attributes-must_use.rs:70:5
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to an associated type
error: `#[must_use]` has no effect when applied to associated types
--> $DIR/unused_attributes-must_use.rs:72:5
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a provided trait method
error: `#[must_use]` has no effect when applied to provided trait methods
--> $DIR/unused_attributes-must_use.rs:85:5
|
LL | #[must_use]
| ^^^^^^^^^^^
error: `#[must_use]` has no effect when applied to a foreign static item
error: `#[must_use]` has no effect when applied to foreign statics
--> $DIR/unused_attributes-must_use.rs:52:5
|
LL | #[must_use]

View File

@@ -1,12 +1,14 @@
#![deny(unused_attributes)]
trait Trait {
#[inline] //~ ERROR `#[inline]` is ignored on function prototypes
#[inline] //~ ERROR attribute cannot be used on
//~^ WARN previously accepted
fn foo();
}
extern "C" {
#[inline] //~ ERROR `#[inline]` is ignored on function prototypes
#[inline] //~ ERROR attribute cannot be used on
//~^ WARN previously accepted
fn foo();
}

View File

@@ -1,20 +1,25 @@
error: `#[inline]` is ignored on function prototypes
error: `#[inline]` attribute cannot be used on required trait methods
--> $DIR/warn-unused-inline-on-fn-prototypes.rs:4:5
|
LL | #[inline]
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[inline]` can be applied to functions, inherent methods, provided trait methods, trait methods in impl blocks, closures
note: the lint level is defined here
--> $DIR/warn-unused-inline-on-fn-prototypes.rs:1:9
|
LL | #![deny(unused_attributes)]
| ^^^^^^^^^^^^^^^^^
error: `#[inline]` is ignored on function prototypes
--> $DIR/warn-unused-inline-on-fn-prototypes.rs:9:5
error: `#[inline]` attribute cannot be used on foreign functions
--> $DIR/warn-unused-inline-on-fn-prototypes.rs:10:5
|
LL | #[inline]
| ^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= help: `#[inline]` can be applied to methods, functions, closures
error: aborting due to 2 previous errors

View File

@@ -3,17 +3,17 @@
#![allow(incomplete_features)]
#![feature(loop_match)]
#![loop_match] //~ ERROR should be applied to a loop
#![const_continue] //~ ERROR should be applied to a break expression
#![loop_match] //~ ERROR attribute cannot be used on
#![const_continue] //~ ERROR attribute cannot be used on
extern "C" {
#[loop_match] //~ ERROR should be applied to a loop
#[const_continue] //~ ERROR should be applied to a break expression
#[loop_match] //~ ERROR attribute cannot be used on
#[const_continue] //~ ERROR attribute cannot be used on
fn f();
}
#[loop_match] //~ ERROR should be applied to a loop
#[const_continue] //~ ERROR should be applied to a break expression
#[loop_match] //~ ERROR attribute cannot be used on
#[const_continue] //~ ERROR attribute cannot be used on
#[repr(C)]
struct S {
a: u32,
@@ -21,18 +21,18 @@ struct S {
}
trait Invoke {
#[loop_match] //~ ERROR should be applied to a loop
#[const_continue] //~ ERROR should be applied to a break expression
#[loop_match] //~ ERROR attribute cannot be used on
#[const_continue] //~ ERROR attribute cannot be used on
extern "C" fn invoke(&self);
}
#[loop_match] //~ ERROR should be applied to a loop
#[const_continue] //~ ERROR should be applied to a break expression
#[loop_match] //~ ERROR attribute cannot be used on
#[const_continue] //~ ERROR attribute cannot be used on
extern "C" fn ok() {}
fn main() {
#[loop_match] //~ ERROR should be applied to a loop
#[const_continue] //~ ERROR should be applied to a break expression
#[loop_match] //~ ERROR attribute cannot be used on
#[const_continue] //~ ERROR attribute cannot be used on
|| {};
{

View File

@@ -1,54 +1,98 @@
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:16:1
error: `#[loop_match]` attribute cannot be used on crates
--> $DIR/invalid-attribute.rs:6:1
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
LL | #[repr(C)]
LL | struct S {
| -------- not a break expression
LL | #![loop_match]
| ^^^^^^^^^^^^^^
|
= help: `#[loop_match]` can be applied to
error: `#[loop_match]` should be applied to a loop
error: `#[const_continue]` attribute cannot be used on crates
--> $DIR/invalid-attribute.rs:7:1
|
LL | #![const_continue]
| ^^^^^^^^^^^^^^^^^^
|
= help: `#[const_continue]` can be applied to
error: `#[loop_match]` attribute cannot be used on foreign functions
--> $DIR/invalid-attribute.rs:10:5
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
|
= help: `#[loop_match]` can be applied to
error: `#[const_continue]` attribute cannot be used on foreign functions
--> $DIR/invalid-attribute.rs:11:5
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[const_continue]` can be applied to
error: `#[loop_match]` attribute cannot be used on structs
--> $DIR/invalid-attribute.rs:15:1
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
...
LL | struct S {
| -------- not a loop
|
= help: `#[loop_match]` can be applied to
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:30:1
error: `#[const_continue]` attribute cannot be used on structs
--> $DIR/invalid-attribute.rs:16:1
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
LL | extern "C" fn ok() {}
| ------------------ not a break expression
|
= help: `#[const_continue]` can be applied to
error: `#[loop_match]` should be applied to a loop
error: `#[loop_match]` attribute cannot be used on required trait methods
--> $DIR/invalid-attribute.rs:24:5
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
|
= help: `#[loop_match]` can be applied to
error: `#[const_continue]` attribute cannot be used on required trait methods
--> $DIR/invalid-attribute.rs:25:5
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[const_continue]` can be applied to
error: `#[loop_match]` attribute cannot be used on functions
--> $DIR/invalid-attribute.rs:29:1
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
LL | #[const_continue]
LL | extern "C" fn ok() {}
| ------------------ not a loop
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:35:5
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
LL | || {};
| -- not a break expression
= help: `#[loop_match]` can be applied to
error: `#[loop_match]` should be applied to a loop
error: `#[const_continue]` attribute cannot be used on functions
--> $DIR/invalid-attribute.rs:30:1
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[const_continue]` can be applied to
error: `#[loop_match]` attribute cannot be used on closures
--> $DIR/invalid-attribute.rs:34:5
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
|
= help: `#[loop_match]` can be applied to
error: `#[const_continue]` attribute cannot be used on closures
--> $DIR/invalid-attribute.rs:35:5
|
LL | #[const_continue]
LL | || {};
| -- not a loop
| ^^^^^^^^^^^^^^^^^
|
= help: `#[const_continue]` can be applied to
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:40:9
@@ -67,65 +111,5 @@ LL | #[const_continue]
LL | 5
| - not a loop
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:25:5
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
LL | extern "C" fn invoke(&self);
| ---------------------------- not a break expression
error: `#[loop_match]` should be applied to a loop
--> $DIR/invalid-attribute.rs:24:5
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
LL | #[const_continue]
LL | extern "C" fn invoke(&self);
| ---------------------------- not a loop
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:11:5
|
LL | #[const_continue]
| ^^^^^^^^^^^^^^^^^
LL | fn f();
| ------- not a break expression
error: `#[loop_match]` should be applied to a loop
--> $DIR/invalid-attribute.rs:10:5
|
LL | #[loop_match]
| ^^^^^^^^^^^^^
LL | #[const_continue]
LL | fn f();
| ------- not a loop
error: `#[const_continue]` should be applied to a break expression
--> $DIR/invalid-attribute.rs:7:1
|
LL | / #![allow(incomplete_features)]
LL | | #![feature(loop_match)]
LL | | #![loop_match]
LL | | #![const_continue]
| | ^^^^^^^^^^^^^^^^^^
... |
LL | | };
LL | | }
| |_- not a break expression
error: `#[loop_match]` should be applied to a loop
--> $DIR/invalid-attribute.rs:6:1
|
LL | / #![allow(incomplete_features)]
LL | | #![feature(loop_match)]
LL | | #![loop_match]
| | ^^^^^^^^^^^^^^
LL | | #![const_continue]
... |
LL | | };
LL | | }
| |_- not a loop
error: aborting due to 14 previous errors

View File

@@ -2,13 +2,12 @@ fn main() {
(0..)
.map(
#[target_feature(enable = "")]
//~^ ERROR: attribute should be applied to a function
//~^ ERROR: attribute cannot be used on
#[track_caller]
//~^ ERROR: `#[track_caller]` on closures is currently unstable
//~| NOTE: see issue #87417
//~| NOTE: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|_| (),
//~^ NOTE: not a function
)
.next();
}

View File

@@ -1,11 +1,10 @@
error: attribute should be applied to a function definition
error: `#[target_feature]` attribute cannot be used on closures
--> $DIR/issue-68060.rs:4:13
|
LL | #[target_feature(enable = "")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL | |_| (),
| ------ not a function definition
|
= help: `#[target_feature]` can be applied to methods, functions
error[E0658]: `#[track_caller]` on closures is currently unstable
--> $DIR/issue-68060.rs:6:13

View File

@@ -1,23 +1,23 @@
#![feature(marker_trait_attr)]
#[marker] //~ ERROR attribute should be applied to a trait
#[marker] //~ ERROR attribute cannot be used on
struct Struct {}
#[marker] //~ ERROR attribute should be applied to a trait
#[marker] //~ ERROR attribute cannot be used on
impl Struct {}
#[marker] //~ ERROR attribute should be applied to a trait
#[marker] //~ ERROR attribute cannot be used on
union Union {
x: i32,
}
#[marker] //~ ERROR attribute should be applied to a trait
#[marker] //~ ERROR attribute cannot be used on
const CONST: usize = 10;
#[marker] //~ ERROR attribute should be applied to a trait
#[marker] //~ ERROR attribute cannot be used on
fn function() {}
#[marker] //~ ERROR attribute should be applied to a trait
#[marker] //~ ERROR attribute cannot be used on
type Type = ();
fn main() {}

View File

@@ -1,52 +1,50 @@
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on structs
--> $DIR/marker-attribute-on-non-trait.rs:3:1
|
LL | #[marker]
| ^^^^^^^^^
LL | struct Struct {}
| ---------------- not a trait
|
= help: `#[marker]` can only be applied to traits
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on inherent impl blocks
--> $DIR/marker-attribute-on-non-trait.rs:6:1
|
LL | #[marker]
| ^^^^^^^^^
LL | impl Struct {}
| -------------- not a trait
|
= help: `#[marker]` can only be applied to traits
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on unions
--> $DIR/marker-attribute-on-non-trait.rs:9:1
|
LL | #[marker]
| ^^^^^^^^^
LL | / union Union {
LL | | x: i32,
LL | | }
| |_- not a trait
LL | #[marker]
| ^^^^^^^^^
|
= help: `#[marker]` can only be applied to traits
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on constants
--> $DIR/marker-attribute-on-non-trait.rs:14:1
|
LL | #[marker]
| ^^^^^^^^^
LL | const CONST: usize = 10;
| ------------------------ not a trait
|
= help: `#[marker]` can only be applied to traits
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on functions
--> $DIR/marker-attribute-on-non-trait.rs:17:1
|
LL | #[marker]
| ^^^^^^^^^
LL | fn function() {}
| ---------------- not a trait
|
= help: `#[marker]` can only be applied to traits
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on type aliases
--> $DIR/marker-attribute-on-non-trait.rs:20:1
|
LL | #[marker]
| ^^^^^^^^^
LL | type Type = ();
| --------------- not a trait
|
= help: `#[marker]` can only be applied to traits
error: aborting due to 6 previous errors

View File

@@ -2,7 +2,7 @@ error[E0718]: `panic_impl` lang item must be applied to a function
--> $DIR/panic-handler-wrong-location.rs:6:1
|
LL | #[panic_handler]
| ^^^^^^^^^^^^^^^^ attribute should be applied to a function, not a static item
| ^^^^^^^^^^^^^^^^ attribute should be applied to a function, not a static
error: `#[panic_handler]` function required, but not found

View File

@@ -8,7 +8,7 @@ pub fn foo(a: proc_macro::TokenStream) -> proc_macro::TokenStream {
// Issue #37590
#[proc_macro_derive(Foo)]
//~^ ERROR: the `#[proc_macro_derive]` attribute may only be used on bare functions
//~^ ERROR: attribute cannot be used on
pub struct Foo {
}

View File

@@ -4,11 +4,13 @@ error: the `#[proc_macro_derive]` attribute is only usable with crates of the `p
LL | #[proc_macro_derive(Foo)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: the `#[proc_macro_derive]` attribute may only be used on bare functions
error: `#[proc_macro_derive]` attribute cannot be used on structs
--> $DIR/illegal-proc-macro-derive-use.rs:10:1
|
LL | #[proc_macro_derive(Foo)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[proc_macro_derive]` can only be applied to functions
error: aborting due to 2 previous errors

View File

@@ -3,11 +3,11 @@
struct Foo;
#[non_exhaustive]
//~^ ERROR attribute should be applied to a struct or enum [E0701]
//~^ ERROR attribute cannot be used on
trait Bar { }
#[non_exhaustive]
//~^ ERROR attribute should be applied to a struct or enum [E0701]
//~^ ERROR attribute cannot be used on
union Baz {
f1: u16,
f2: u16

View File

@@ -7,28 +7,22 @@ LL | #[non_exhaustive(anything)]
| | didn't expect any arguments here
| help: must be of the form: `#[non_exhaustive]`
error[E0701]: attribute should be applied to a struct or enum
error: `#[non_exhaustive]` attribute cannot be used on traits
--> $DIR/invalid-attribute.rs:5:1
|
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^
LL |
LL | trait Bar { }
| ------------- not a struct or enum
|
= help: `#[non_exhaustive]` can be applied to data types, enum variants
error[E0701]: attribute should be applied to a struct or enum
error: `#[non_exhaustive]` attribute cannot be used on unions
--> $DIR/invalid-attribute.rs:9:1
|
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^
LL |
LL | / union Baz {
LL | | f1: u16,
LL | | f2: u16
LL | | }
| |_- not a struct or enum
LL | #[non_exhaustive]
| ^^^^^^^^^^^^^^^^^
|
= help: `#[non_exhaustive]` can be applied to data types, enum variants
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0565, E0701.
For more information about an error, try `rustc --explain E0565`.
For more information about this error, try `rustc --explain E0565`.

View File

@@ -1,5 +1,5 @@
#[track_caller]
struct S;
//~^^ ERROR attribute should be applied to a function definition
//~^^ ERROR attribute cannot be used on
fn main() {}

View File

@@ -1,11 +1,10 @@
error[E0739]: attribute should be applied to a function definition
error: `#[track_caller]` attribute cannot be used on structs
--> $DIR/only-for-fns.rs:1:1
|
LL | #[track_caller]
| ^^^^^^^^^^^^^^^
LL | struct S;
| --------- not a function definition
|
= help: `#[track_caller]` can only be applied to functions
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0739`.

View File

@@ -10,13 +10,13 @@ error: `#[doc(alias = "...")]` isn't allowed on foreign module
LL | #[doc(alias = "foo")]
| ^^^^^^^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on inherent implementation block
error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:12:7
|
LL | #[doc(alias = "bar")]
| ^^^^^^^^^^^^^
error: `#[doc(alias = "...")]` isn't allowed on trait implementation block
error: `#[doc(alias = "...")]` isn't allowed on implementation block
--> $DIR/check-doc-alias-attr-location.rs:18:7
|
LL | #[doc(alias = "foobar")]

View File

@@ -3,19 +3,16 @@
#![warn(unused_attributes)]
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
extern crate alloc;
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
use alloc::alloc::alloc;
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
extern "Rust" {}
//~^ NOTE not a function
#[target_feature = "+sse2"]
//~^ ERROR malformed `target_feature` attribute
@@ -32,42 +29,35 @@ extern "Rust" {}
unsafe fn foo() {}
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
mod another {}
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
const FOO: usize = 7;
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
struct Foo;
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
enum Bar {}
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
union Qux {
//~^ NOTE not a function
f1: u16,
f1: u16,
f2: u16,
}
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
type Uwu = ();
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
trait Baz {}
//~^ NOTE not a function
#[inline(always)]
//~^ ERROR: cannot use `#[inline(always)]`
@@ -75,21 +65,18 @@ trait Baz {}
unsafe fn test() {}
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
static A: () = ();
//~^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
impl Quux for u8 {}
//~^ NOTE not a function
//~| NOTE missing `foo` in implementation
//~^ NOTE missing `foo` in implementation
//~| ERROR missing: `foo`
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
impl Foo {}
//~^ NOTE not a function
trait Quux {
fn foo(); //~ NOTE `foo` from trait
@@ -109,17 +96,15 @@ impl Quux for Foo {
fn main() {
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
unsafe {
foo();
}
//~^^^ NOTE not a function
#[target_feature(enable = "sse2")]
//~^ ERROR attribute should be applied to a function
//~^ ERROR attribute cannot be used on
|| {};
//~^ NOTE not a function
}
}
#[target_feature(enable = "+sse2")]
//~^ ERROR `+sse2` is not valid for this target

View File

@@ -1,5 +1,29 @@
error: `#[target_feature]` attribute cannot be used on extern crates
--> $DIR/invalid-attribute.rs:5:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on use statements
--> $DIR/invalid-attribute.rs:9:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on foreign modules
--> $DIR/invalid-attribute.rs:13:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error[E0539]: malformed `target_feature` attribute input
--> $DIR/invalid-attribute.rs:20:1
--> $DIR/invalid-attribute.rs:17:1
|
LL | #[target_feature = "+sse2"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -8,7 +32,7 @@ LL | #[target_feature = "+sse2"]
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error[E0539]: malformed `target_feature` attribute input
--> $DIR/invalid-attribute.rs:26:1
--> $DIR/invalid-attribute.rs:23:1
|
LL | #[target_feature(bar)]
| ^^^^^^^^^^^^^^^^^---^^
@@ -17,7 +41,7 @@ LL | #[target_feature(bar)]
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error[E0539]: malformed `target_feature` attribute input
--> $DIR/invalid-attribute.rs:29:1
--> $DIR/invalid-attribute.rs:26:1
|
LL | #[target_feature(disable = "baz")]
| ^^^^^^^^^^^^^^^^^-------^^^^^^^^^^
@@ -25,161 +49,116 @@ LL | #[target_feature(disable = "baz")]
| | expected this to be of the form `enable = "..."`
| help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:5:1
error: `#[target_feature]` attribute cannot be used on modules
--> $DIR/invalid-attribute.rs:31:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | extern crate alloc;
| ------------------- not a function definition
|
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:10:1
error: `#[target_feature]` attribute cannot be used on constants
--> $DIR/invalid-attribute.rs:35:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | use alloc::alloc::alloc;
| ------------------------ not a function definition
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:15:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | extern "Rust" {}
| ---------------- not a function definition
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:34:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | mod another {}
| -------------- not a function definition
error: attribute should be applied to a function definition
error: `#[target_feature]` attribute cannot be used on structs
--> $DIR/invalid-attribute.rs:39:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | const FOO: usize = 7;
| --------------------- not a function definition
|
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:44:1
error: `#[target_feature]` attribute cannot be used on enums
--> $DIR/invalid-attribute.rs:43:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | struct Foo;
| ----------- not a function definition
|
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:49:1
error: `#[target_feature]` attribute cannot be used on unions
--> $DIR/invalid-attribute.rs:47:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | enum Bar {}
| ----------- not a function definition
|
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
error: `#[target_feature]` attribute cannot be used on type aliases
--> $DIR/invalid-attribute.rs:54:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / union Qux {
LL | |
LL | | f1: u16,
LL | | f2: u16,
LL | | }
| |_- not a function definition
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:62:1
error: `#[target_feature]` attribute cannot be used on traits
--> $DIR/invalid-attribute.rs:58:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | type Uwu = ();
| -------------- not a function definition
|
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
error: `#[target_feature]` attribute cannot be used on statics
--> $DIR/invalid-attribute.rs:67:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | trait Baz {}
| ------------ not a function definition
error: cannot use `#[inline(always)]` with `#[target_feature]`
--> $DIR/invalid-attribute.rs:72:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
error: `#[target_feature]` attribute cannot be used on trait impl blocks
--> $DIR/invalid-attribute.rs:71:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on inherent impl blocks
--> $DIR/invalid-attribute.rs:77:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | static A: () = ();
| ------------------ not a function definition
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:82:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | impl Quux for u8 {}
| ------------------- not a function definition
= help: `#[target_feature]` can only be applied to functions
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:89:1
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | impl Foo {}
| ----------- not a function definition
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:111:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | / unsafe {
LL | | foo();
LL | | }
| |_____- not a function definition
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:118:5
error: `#[target_feature]` attribute cannot be used on expressions
--> $DIR/invalid-attribute.rs:98:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |
LL | || {};
| ----- not a function definition
|
= help: `#[target_feature]` can only be applied to functions
error: `#[target_feature]` attribute cannot be used on closures
--> $DIR/invalid-attribute.rs:104:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `#[target_feature]` can be applied to methods, functions
error: cannot use `#[inline(always)]` with `#[target_feature]`
--> $DIR/invalid-attribute.rs:62:1
|
LL | #[inline(always)]
| ^^^^^^^^^^^^^^^^^
error: the feature named `foo` is not valid for this target
--> $DIR/invalid-attribute.rs:23:18
--> $DIR/invalid-attribute.rs:20:18
|
LL | #[target_feature(enable = "foo")]
| ^^^^^^^^^^^^^^ `foo` is not valid for this target
error[E0046]: not all trait items implemented, missing: `foo`
--> $DIR/invalid-attribute.rs:84:1
--> $DIR/invalid-attribute.rs:73:1
|
LL | impl Quux for u8 {}
| ^^^^^^^^^^^^^^^^ missing `foo` in implementation
@@ -188,7 +167,7 @@ LL | fn foo();
| --------- `foo` from trait
error: `#[target_feature(..)]` cannot be applied to safe trait method
--> $DIR/invalid-attribute.rs:100:5
--> $DIR/invalid-attribute.rs:87:5
|
LL | #[target_feature(enable = "sse2")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be applied to safe trait method
@@ -197,13 +176,13 @@ LL | fn foo() {}
| -------- not an `unsafe` function
error[E0053]: method `foo` has an incompatible type for trait
--> $DIR/invalid-attribute.rs:103:5
--> $DIR/invalid-attribute.rs:90:5
|
LL | fn foo() {}
| ^^^^^^^^ expected safe fn, found unsafe fn
|
note: type in trait
--> $DIR/invalid-attribute.rs:95:5
--> $DIR/invalid-attribute.rs:82:5
|
LL | fn foo();
| ^^^^^^^^^
@@ -211,7 +190,7 @@ LL | fn foo();
found signature `#[target_features] fn()`
error: the feature named `+sse2` is not valid for this target
--> $DIR/invalid-attribute.rs:124:18
--> $DIR/invalid-attribute.rs:109:18
|
LL | #[target_feature(enable = "+sse2")]
| ^^^^^^^^^^^^^^^^ `+sse2` is not valid for this target

View File

@@ -1,7 +1,7 @@
#![feature(trait_alias, marker_trait_attr)]
#[marker]
//~^ ERROR attribute should be applied to a trait
//~^ ERROR attribute cannot be used on
trait Foo = Send;
fn main() {}

View File

@@ -1,11 +1,10 @@
error: attribute should be applied to a trait
error: `#[marker]` attribute cannot be used on trait aliases
--> $DIR/not-a-marker.rs:3:1
|
LL | #[marker]
| ^^^^^^^^^
LL |
LL | trait Foo = Send;
| ----------------- not a trait
|
= help: `#[marker]` can only be applied to traits
error: aborting due to 1 previous error

View File

@@ -2,9 +2,9 @@
#[const_trait]
trait A {
#[const_trait] //~ ERROR attribute should be applied
#[const_trait] //~ ERROR attribute cannot be used on
fn foo(self);
}
#[const_trait] //~ ERROR attribute should be applied
#[const_trait] //~ ERROR attribute cannot be used on
fn main() {}

Some files were not shown because too many files have changed in this diff Show More