Changes in uitests for cfg_attr

Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
This commit is contained in:
Jonathan Brouwer
2025-10-14 19:59:38 +02:00
parent 7113d58c8e
commit 090dad00a9
18 changed files with 384 additions and 86 deletions

View File

@@ -9,17 +9,16 @@ 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
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/malformed-attrs.rs:103:1
|
LL | #[cfg_attr]
| ^^^^^^^^^^^
| |
| expected this to be a list
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
help: missing condition and attribute
|
LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
| ++++++++++++++++++++++++++++++++++++++++++++
error[E0463]: can't find crate for `wloop`
--> $DIR/malformed-attrs.rs:209:1

View File

@@ -3,19 +3,27 @@
#![allow(unexpected_cfgs)] // invalid cfgs
#[cfg(any(foo, foo::bar))]
//~^ERROR `cfg` predicate key must be an identifier
//~^ ERROR malformed `cfg` attribute input
//~| NOTE expected a valid identifier here
//~| NOTE for more information, visit
fn foo1() {}
#[cfg(any(foo::bar, foo))]
//~^ERROR `cfg` predicate key must be an identifier
//~^ ERROR malformed `cfg` attribute input
//~| NOTE expected a valid identifier here
//~| NOTE for more information, visit
fn foo2() {}
#[cfg(all(foo, foo::bar))]
//~^ERROR `cfg` predicate key must be an identifier
//~^ ERROR malformed `cfg` attribute input
//~| NOTE expected a valid identifier here
//~| NOTE for more information, visit
fn foo3() {}
#[cfg(all(foo::bar, foo))]
//~^ERROR `cfg` predicate key must be an identifier
//~^ ERROR malformed `cfg` attribute input
//~| NOTE expected a valid identifier here
//~| NOTE for more information, visit
fn foo4() {}
fn main() {}

View File

@@ -1,26 +1,47 @@
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-path-error.rs:5:16
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:5:1
|
LL | #[cfg(any(foo, foo::bar))]
| ^^^^^^^^
| ^^^^^^^^^^^^^^^--------^^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-path-error.rs:9:11
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:11:1
|
LL | #[cfg(any(foo::bar, foo))]
| ^^^^^^^^
| ^^^^^^^^^^--------^^^^^^^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-path-error.rs:13:16
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:17:1
|
LL | #[cfg(all(foo, foo::bar))]
| ^^^^^^^^
| ^^^^^^^^^^^^^^^--------^^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-path-error.rs:17:11
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:23:1
|
LL | #[cfg(all(foo::bar, foo))]
| ^^^^^^^^
| ^^^^^^^^^^--------^^^^^^^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0539`.

View File

@@ -19,7 +19,7 @@ fn three() {}
fn four() {}
#[cfg(target(clippy::os = "linux"))]
//~^ ERROR `cfg` predicate key must be an identifier
//~^ ERROR malformed `cfg` attribute input
fn five() {}
fn main() {}

View File

@@ -42,11 +42,16 @@ LL | #[cfg(target(true))]
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-target-compact-errors.rs:21:14
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-target-compact-errors.rs:21:1
|
LL | #[cfg(target(clippy::os = "linux"))]
| ^^^^^^^^^^
| ^^^^^^^^^^^^^----------^^^^^^^^^^^^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: aborting due to 5 previous errors

View File

@@ -1,49 +1,56 @@
error: malformed `cfg_attr` attribute input
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg-attr-parse.rs:4:1
|
LL | #[cfg_attr()]
| ^^^^^^^^^^^^^
| ^^^^^^^^^^--^
| | |
| | expected at least 1 argument here
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
help: missing condition and attribute
|
LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
| ++++++++++++++++++++++++++++++++++++++++++
error: expected `,`, found end of `cfg_attr` input
--> $DIR/cfg-attr-parse.rs:8:17
|
LL | #[cfg_attr(all())]
| ^ expected `,`
| ----------------^-
| | |
| | expected `,`
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:16:18
|
LL | #[cfg_attr(all(),,)]
| ^ expected identifier
| -----------------^--
| | |
| | expected identifier
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:28:28
|
LL | #[cfg_attr(all(), must_use,,)]
| ^ expected identifier
| ---------------------------^--
| | |
| | expected identifier
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:40:40
|
LL | #[cfg_attr(all(), must_use, deprecated,,)]
| ^ expected identifier
| ---------------------------------------^--
| | |
| | expected identifier
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: wrong `cfg_attr` delimiters
@@ -62,9 +69,11 @@ error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:44:18
|
LL | #[cfg_attr[all(),,]]
| ^ expected identifier
| -----------------^--
| | |
| | expected identifier
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: wrong `cfg_attr` delimiters
@@ -83,10 +92,13 @@ error: expected identifier, found `,`
--> $DIR/cfg-attr-parse.rs:50:18
|
LL | #[cfg_attr{all(),,}]
| ^ expected identifier
| -----------------^--
| | |
| | expected identifier
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: aborting due to 9 previous errors
For more information about this error, try `rustc --explain E0539`.

View File

@@ -22,10 +22,16 @@ struct S3;
//~| NOTE for more information, visit
struct S4;
#[cfg("str")] //~ ERROR `cfg` predicate key must be an identifier
#[cfg("str")]
//~^ ERROR malformed `cfg` attribute input
//~| NOTE expected a valid identifier here
//~| NOTE for more information, visit
struct S5;
#[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier
#[cfg(a::b)]
//~^ ERROR malformed `cfg` attribute input
//~| NOTE expected a valid identifier here
//~| NOTE for more information, visit
struct S6;
#[cfg(a())] //~ ERROR invalid predicate `a`

View File

@@ -42,26 +42,36 @@ LL | #[cfg(a, b)]
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-attr-syntax-validation.rs:25:7
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-attr-syntax-validation.rs:25:1
|
LL | #[cfg("str")]
| ^^^^^
| ^^^^^^-----^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: `cfg` predicate key must be an identifier
--> $DIR/cfg-attr-syntax-validation.rs:28:7
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-attr-syntax-validation.rs:31:1
|
LL | #[cfg(a::b)]
| ^^^^
| ^^^^^^----^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg(predicate)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0537]: invalid predicate `a`
--> $DIR/cfg-attr-syntax-validation.rs:31:7
--> $DIR/cfg-attr-syntax-validation.rs:37:7
|
LL | #[cfg(a())]
| ^^^
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-attr-syntax-validation.rs:34:1
--> $DIR/cfg-attr-syntax-validation.rs:40:1
|
LL | #[cfg(a = 10)]
| ^^^^^^^^^^--^^
@@ -72,7 +82,7 @@ LL | #[cfg(a = 10)]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-attr-syntax-validation.rs:39:1
--> $DIR/cfg-attr-syntax-validation.rs:45:1
|
LL | #[cfg(a = b"hi")]
| ^^^^^^^^^^-^^^^^^
@@ -82,7 +92,7 @@ LL | #[cfg(a = b"hi")]
= note: expected a normal string literal, not a byte string literal
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
--> $DIR/cfg-attr-syntax-validation.rs:45:25
--> $DIR/cfg-attr-syntax-validation.rs:51:25
|
LL | #[cfg(feature = $expr)]
| ^^^^^

View File

@@ -0,0 +1,50 @@
#[cfg_attr]
//~^ ERROR malformed `cfg_attr` attribute
struct S1;
#[cfg_attr = 10]
//~^ ERROR malformed `cfg_attr` attribute
struct S2;
#[cfg_attr()]
//~^ ERROR malformed `cfg_attr` attribute
struct S3;
#[cfg_attr("str")] //~ ERROR malformed `cfg_attr` attribute input
struct S5;
#[cfg_attr(a::b)] //~ ERROR malformed `cfg_attr` attribute input
struct S6;
#[cfg_attr(a())] //~ ERROR invalid predicate `a`
struct S7;
#[cfg_attr(a = 10)] //~ ERROR malformed `cfg_attr` attribute input
struct S8;
#[cfg_attr(a = b"hi")] //~ ERROR malformed `cfg_attr` attribute input
struct S9;
macro_rules! generate_s10 {
($expr: expr) => {
#[cfg_attr(feature = $expr)]
//~^ ERROR expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
struct S10;
}
}
generate_s10!(concat!("nonexistent"));
#[cfg_attr(true)] //~ ERROR expected `,`, found end of `cfg_attr` input
struct S11;
#[cfg_attr(true, unknown_attribute)] //~ ERROR cannot find attribute `unknown_attribute` in this scope
struct S12;
#[cfg_attr(true, link_section)] //~ ERROR malformed `link_section` attribute input
struct S13;
#[cfg_attr(true, inline())] //~ ERROR malformed `inline` attribute input
fn f1() {}
fn main() {}

View File

@@ -0,0 +1,144 @@
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:1:1
|
LL | #[cfg_attr]
| ^^^^^^^^^^^
| |
| expected this to be a list
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:5:1
|
LL | #[cfg_attr = 10]
| ^^^^^^^^^^^^^^^^
| |
| expected this to be a list
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:9:1
|
LL | #[cfg_attr()]
| ^^^^^^^^^^--^
| | |
| | expected at least 1 argument here
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:13:1
|
LL | #[cfg_attr("str")]
| ^^^^^^^^^^^-----^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:16:1
|
LL | #[cfg_attr(a::b)]
| ^^^^^^^^^^^----^^
| | |
| | expected a valid identifier here
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error[E0537]: invalid predicate `a`
--> $DIR/cfg_attr-attr-syntax-validation.rs:19:12
|
LL | #[cfg_attr(a())]
| ^^^
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:22:1
|
LL | #[cfg_attr(a = 10)]
| ^^^^^^^^^^^^^^^--^^
| | |
| | expected a string literal here
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:25:1
|
LL | #[cfg_attr(a = b"hi")]
| ^^^^^^^^^^^^^^^-^^^^^^
| |
| help: consider removing the prefix
|
= note: expected a normal string literal, not a byte string literal
error: expected `,`, found end of `cfg_attr` input
--> $DIR/cfg_attr-attr-syntax-validation.rs:38:16
|
LL | #[cfg_attr(true)]
| ---------------^-
| | |
| | expected `,`
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: expected a literal (`1u8`, `1.0f32`, `"string"`, etc.) here, found `expr` metavariable
--> $DIR/cfg_attr-attr-syntax-validation.rs:30:30
|
LL | #[cfg_attr(feature = $expr)]
| ---------------------^^^^^-- help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
...
LL | generate_s10!(concat!("nonexistent"));
| ------------------------------------- in this macro invocation
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
= note: this error originates in the macro `generate_s10` (in Nightly builds, run with -Z macro-backtrace for more info)
error: cannot find attribute `unknown_attribute` in this scope
--> $DIR/cfg_attr-attr-syntax-validation.rs:41:18
|
LL | #[cfg_attr(true, unknown_attribute)]
| ^^^^^^^^^^^^^^^^^
error[E0539]: malformed `link_section` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:44:18
|
LL | #[cfg_attr(true, link_section)]
| ^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/abi.html#the-link_section-attribute>
error[E0805]: malformed `inline` attribute input
--> $DIR/cfg_attr-attr-syntax-validation.rs:47:18
|
LL | #[cfg_attr(true, inline())]
| ^^^^^^--
| |
| expected a single argument here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/attributes/codegen.html#the-inline-attribute>
help: try changing it to one of the following valid forms of the attribute
|
LL - #[cfg_attr(true, inline())]
LL + #[cfg_attr(true, #[inline(always)])]
|
LL - #[cfg_attr(true, inline())]
LL + #[cfg_attr(true, #[inline(never)])]
|
LL - #[cfg_attr(true, inline())]
LL + #[cfg_attr(true, #[inline])]
|
error: aborting due to 13 previous errors
Some errors have detailed explanations: E0537, E0539, E0805.
For more information about an error, try `rustc --explain E0537`.

View File

@@ -1,6 +1,6 @@
#[link(name = "foo", cfg("rlib"))]
//~^ ERROR link cfg is unstable
//~| ERROR `cfg` predicate key must be an identifier
//~| ERROR malformed `link` attribute input
extern "C" {}
fn main() {}

View File

@@ -7,12 +7,32 @@ LL | #[link(name = "foo", cfg("rlib"))]
= help: add `#![feature(link_cfg)]` 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: `cfg` predicate key must be an identifier
--> $DIR/issue-43925.rs:1:26
error[E0539]: malformed `link` attribute input
--> $DIR/issue-43925.rs:1:1
|
LL | #[link(name = "foo", cfg("rlib"))]
| ^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^------^^^
| |
| expected a valid identifier here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
help: try changing it to one of the following valid forms of the attribute
|
LL - #[link(name = "foo", cfg("rlib"))]
LL + #[link(name = "...")]
|
LL - #[link(name = "foo", cfg("rlib"))]
LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]
|
LL - #[link(name = "foo", cfg("rlib"))]
LL + #[link(name = "...", kind = "dylib|static|...")]
|
LL - #[link(name = "foo", cfg("rlib"))]
LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]
|
= and 1 other candidate
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
Some errors have detailed explanations: E0539, E0658.
For more information about an error, try `rustc --explain E0539`.

View File

@@ -22,7 +22,7 @@ extern "C" {}
#[link(name = "...", modifiers())] //~ ERROR malformed `link` attribute input
#[link(name = "...", cfg)] //~ ERROR malformed `link` attribute input
#[link(name = "...", cfg = "literal")] //~ ERROR malformed `link` attribute input
#[link(name = "...", cfg("literal"))] //~ ERROR `cfg` predicate key must be an identifier
#[link(name = "...", cfg("literal"))] //~ ERROR malformed `link` attribute input
#[link(name = "...", wasm_import_module)] //~ ERROR malformed `link` attribute input
#[link(name = "...", wasm_import_module())] //~ ERROR malformed `link` attribute input
extern "C" {}

View File

@@ -367,11 +367,30 @@ LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...",
|
= and 1 other candidate
error: `cfg` predicate key must be an identifier
--> $DIR/link-attr-validation-late.rs:25:26
error[E0539]: malformed `link` attribute input
--> $DIR/link-attr-validation-late.rs:25:1
|
LL | #[link(name = "...", cfg("literal"))]
| ^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^^^^---------^^^
| |
| expected a valid identifier here
|
= note: for more information, visit <https://doc.rust-lang.org/reference/items/external-blocks.html#the-link-attribute>
help: try changing it to one of the following valid forms of the attribute
|
LL - #[link(name = "...", cfg("literal"))]
LL + #[link(name = "...")]
|
LL - #[link(name = "...", cfg("literal"))]
LL + #[link(name = "...", import_name_type = "decorated|noprefix|undecorated")]
|
LL - #[link(name = "...", cfg("literal"))]
LL + #[link(name = "...", kind = "dylib|static|...")]
|
LL - #[link(name = "...", cfg("literal"))]
LL + #[link(name = "...", kind = "dylib|static|...", wasm_import_module = "...", import_name_type = "decorated|noprefix|undecorated")]
|
= and 1 other candidate
error[E0539]: malformed `link` attribute input
--> $DIR/link-attr-validation-late.rs:26:1

View File

@@ -1,27 +1,24 @@
error: malformed `cfg_attr` attribute input
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/malformed-special-attrs.rs:1:1
|
LL | #[cfg_attr]
| ^^^^^^^^^^^
| |
| expected this to be a list
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
help: missing condition and attribute
|
LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
| ++++++++++++++++++++++++++++++++++++++++++++
error: malformed `cfg_attr` attribute input
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/malformed-special-attrs.rs:4:1
|
LL | #[cfg_attr = ""]
| ^^^^^^^^^^^^^^^^
| |
| expected this to be a list
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
help: missing condition and attribute
|
LL - #[cfg_attr = ""]
LL + #[cfg_attr(condition, attribute, other_attribute, ...)]
|
error: malformed `derive` attribute input
--> $DIR/malformed-special-attrs.rs:7:1
@@ -37,3 +34,4 @@ LL | #[derive = ""]
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0539`.

View File

@@ -1,6 +1,7 @@
//@ edition:2018
//@ aux-build: remove-extern-crate.rs
//@ run-rustfix
//@ rustfix-only-machine-applicable
#![warn(rust_2018_idioms)]

View File

@@ -1,6 +1,7 @@
//@ edition:2018
//@ aux-build: remove-extern-crate.rs
//@ run-rustfix
//@ rustfix-only-machine-applicable
#![warn(rust_2018_idioms)]

View File

@@ -1,29 +1,33 @@
error: expected identifier, found `"macro_use"`
--> $DIR/removing-extern-crate-malformed-cfg.rs:7:18
--> $DIR/removing-extern-crate-malformed-cfg.rs:8:18
|
LL | #[cfg_attr(test, "macro_use")]
| ^^^^^^^^^^^ expected identifier
| -----------------^^^^^^^^^^^--
| | |
| | expected identifier
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
error: expected one of `(`, `,`, `::`, or `=`, found `<eof>`
--> $DIR/removing-extern-crate-malformed-cfg.rs:12:16
--> $DIR/removing-extern-crate-malformed-cfg.rs:13:16
|
LL | #[cfg_attr(test)]
| ^^^^ expected one of `(`, `,`, `::`, or `=`
| -----------^^^^--
| | |
| | expected one of `(`, `,`, `::`, or `=`
| help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
|
= help: the valid syntax is `#[cfg_attr(condition, attribute, other_attribute, ...)]`
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
warning: unused extern crate
--> $DIR/removing-extern-crate-malformed-cfg.rs:8:1
--> $DIR/removing-extern-crate-malformed-cfg.rs:9:1
|
LL | extern crate remove_extern_crate as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused
|
note: the lint level is defined here
--> $DIR/removing-extern-crate-malformed-cfg.rs:5:9
--> $DIR/removing-extern-crate-malformed-cfg.rs:6:9
|
LL | #![warn(rust_2018_idioms)]
| ^^^^^^^^^^^^^^^^
@@ -36,7 +40,7 @@ LL +
|
warning: unused extern crate
--> $DIR/removing-extern-crate-malformed-cfg.rs:9:1
--> $DIR/removing-extern-crate-malformed-cfg.rs:10:1
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ unused
@@ -48,7 +52,7 @@ LL +
|
warning: unused extern crate
--> $DIR/removing-extern-crate-malformed-cfg.rs:13:5
--> $DIR/removing-extern-crate-malformed-cfg.rs:14:5
|
LL | extern crate remove_extern_crate as foo;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused
@@ -61,7 +65,7 @@ LL +
|
warning: unused extern crate
--> $DIR/removing-extern-crate-malformed-cfg.rs:14:5
--> $DIR/removing-extern-crate-malformed-cfg.rs:15:5
|
LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ unused