diff options
| -rw-r--r-- | compiler/rustc_attr_parsing/src/session_diagnostics.rs | 8 | ||||
| -rw-r--r-- | tests/ui/attributes/malformed-attrs.rs | 2 | ||||
| -rw-r--r-- | tests/ui/attributes/malformed-attrs.stderr | 7 | ||||
| -rw-r--r-- | tests/ui/cfg/cfg-target-compact-errors.rs | 12 | ||||
| -rw-r--r-- | tests/ui/cfg/cfg-target-compact-errors.stderr | 47 | ||||
| -rw-r--r-- | tests/ui/cfg/cfg-version/syntax.stderr | 4 | ||||
| -rw-r--r-- | tests/ui/cfg/diagnostics-cross-crate.stderr | 12 | ||||
| -rw-r--r-- | tests/ui/cfg/diagnostics-reexport-2.stderr | 20 | ||||
| -rw-r--r-- | tests/ui/cfg/diagnostics-reexport.stderr | 16 | ||||
| -rw-r--r-- | tests/ui/cfg/diagnostics-same-crate.stderr | 16 | ||||
| -rw-r--r-- | tests/ui/check-cfg/compact-names.rs | 4 | ||||
| -rw-r--r-- | tests/ui/check-cfg/compact-names.stderr | 11 | ||||
| -rw-r--r-- | tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs | 25 | ||||
| -rw-r--r-- | tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr | 63 | ||||
| -rw-r--r-- | tests/ui/macros/macro-outer-attributes.stderr | 14 |
15 files changed, 163 insertions, 98 deletions
diff --git a/compiler/rustc_attr_parsing/src/session_diagnostics.rs b/compiler/rustc_attr_parsing/src/session_diagnostics.rs index 8a240639d75..97bf3d1c549 100644 --- a/compiler/rustc_attr_parsing/src/session_diagnostics.rs +++ b/compiler/rustc_attr_parsing/src/session_diagnostics.rs @@ -593,7 +593,13 @@ impl<'a, G: EmissionGuarantee> Diagnostic<'a, G> for AttributeParseError { diag.code(E0565); } AttributeParseErrorReason::ExpectedNameValue(None) => { - // The suggestion we add below this match already contains enough information + // If the span is the entire attribute, the suggestion we add below this match already contains enough information + if self.span != self.attr_span { + diag.span_label( + self.span, + format!("expected this to be of the form `... = \"...\"`"), + ); + } } AttributeParseErrorReason::ExpectedNameValue(Some(name)) => { diag.span_label( diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs index aa52de63a60..5026687b97b 100644 --- a/tests/ui/attributes/malformed-attrs.rs +++ b/tests/ui/attributes/malformed-attrs.rs @@ -100,7 +100,7 @@ //~^ ERROR malformed //~| ERROR the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type #[cfg] -//~^ ERROR is not followed by parentheses +//~^ ERROR malformed #[cfg_attr] //~^ ERROR malformed #[instruction_set] diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr index 3dc3c32c936..56f2be353e7 100644 --- a/tests/ui/attributes/malformed-attrs.stderr +++ b/tests/ui/attributes/malformed-attrs.stderr @@ -1,8 +1,11 @@ -error: `cfg` is not followed by parentheses +error[E0539]: malformed `cfg` attribute input --> $DIR/malformed-attrs.rs:102:1 | LL | #[cfg] - | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[cfg(predicate)]` error: malformed `cfg_attr` attribute input --> $DIR/malformed-attrs.rs:104:1 diff --git a/tests/ui/cfg/cfg-target-compact-errors.rs b/tests/ui/cfg/cfg-target-compact-errors.rs index e00d42fe4d9..cfb19c58a19 100644 --- a/tests/ui/cfg/cfg-target-compact-errors.rs +++ b/tests/ui/cfg/cfg-target-compact-errors.rs @@ -3,19 +3,23 @@ #![feature(cfg_target_compact)] #[cfg(target(o::o))] -//~^ ERROR `cfg` predicate key must be an identifier +//~^ ERROR malformed `cfg` attribute input fn one() {} #[cfg(target(os = 8))] -//~^ ERROR literal in `cfg` predicate value must be a string +//~^ ERROR malformed `cfg` attribute input fn two() {} #[cfg(target(os = "linux", pointer(width = "64")))] -//~^ ERROR invalid predicate `target_pointer` +//~^ ERROR malformed `cfg` attribute input fn three() {} #[cfg(target(true))] -//~^ ERROR `cfg` predicate key must be an identifier +//~^ ERROR malformed `cfg` attribute input fn four() {} +#[cfg(target(clippy::os = "linux"))] +//~^ ERROR `cfg` predicate key must be an identifier +fn five() {} + fn main() {} diff --git a/tests/ui/cfg/cfg-target-compact-errors.stderr b/tests/ui/cfg/cfg-target-compact-errors.stderr index 219d9732c32..7df6729e881 100644 --- a/tests/ui/cfg/cfg-target-compact-errors.stderr +++ b/tests/ui/cfg/cfg-target-compact-errors.stderr @@ -1,28 +1,45 @@ -error: `cfg` predicate key must be an identifier - --> $DIR/cfg-target-compact-errors.rs:5:14 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-target-compact-errors.rs:5:1 | LL | #[cfg(target(o::o))] - | ^^^^ + | ^^^^^^^^^^^^^----^^^ + | | | + | | expected this to be of the form `... = "..."` + | help: must be of the form: `#[cfg(predicate)]` -error[E0565]: literal in `cfg` predicate value must be a string - --> $DIR/cfg-target-compact-errors.rs:9:19 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-target-compact-errors.rs:9:1 | LL | #[cfg(target(os = 8))] - | ^ + | ^^^^^^^^^^^^^^^^^^-^^^ + | | | + | | expected a string literal here + | help: must be of the form: `#[cfg(predicate)]` -error[E0537]: invalid predicate `target_pointer` - --> $DIR/cfg-target-compact-errors.rs:13:28 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-target-compact-errors.rs:13:1 | LL | #[cfg(target(os = "linux", pointer(width = "64")))] - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------^^^ + | | | + | | expected this to be of the form `... = "..."` + | help: must be of the form: `#[cfg(predicate)]` -error: `cfg` predicate key must be an identifier - --> $DIR/cfg-target-compact-errors.rs:17:14 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-target-compact-errors.rs:17:1 | LL | #[cfg(target(true))] - | ^^^^ + | ^^^^^^^^^^^^^----^^^ + | | | + | | expected this to be of the form `... = "..."` + | help: must be of the form: `#[cfg(predicate)]` + +error: `cfg` predicate key must be an identifier + --> $DIR/cfg-target-compact-errors.rs:21:14 + | +LL | #[cfg(target(clippy::os = "linux"))] + | ^^^^^^^^^^ -error: aborting due to 4 previous errors +error: aborting due to 5 previous errors -Some errors have detailed explanations: E0537, E0565. -For more information about an error, try `rustc --explain E0537`. +For more information about this error, try `rustc --explain E0539`. diff --git a/tests/ui/cfg/cfg-version/syntax.stderr b/tests/ui/cfg/cfg-version/syntax.stderr index 2facd960763..188f6d7aa5d 100644 --- a/tests/ui/cfg/cfg-version/syntax.stderr +++ b/tests/ui/cfg/cfg-version/syntax.stderr @@ -17,10 +17,10 @@ LL | #[cfg(version(false))] | ^^^^^ error: expected single version literal - --> $DIR/syntax.rs:23:7 + --> $DIR/syntax.rs:23:14 | LL | #[cfg(version("1.43", "1.44", "1.45"))] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unknown version literal format, assuming it refers to a future version --> $DIR/syntax.rs:51:15 diff --git a/tests/ui/cfg/diagnostics-cross-crate.stderr b/tests/ui/cfg/diagnostics-cross-crate.stderr index 3e32a856e95..155b3db2f42 100644 --- a/tests/ui/cfg/diagnostics-cross-crate.stderr +++ b/tests/ui/cfg/diagnostics-cross-crate.stderr @@ -10,10 +10,10 @@ note: found an item that was configured out LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ note: the item is gated here - --> $DIR/auxiliary/cfged_out.rs:5:5 + --> $DIR/auxiliary/cfged_out.rs:5:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0425]: cannot find function `uwu` in crate `cfged_out` --> $DIR/diagnostics-cross-crate.rs:7:16 @@ -33,10 +33,10 @@ note: found an item that was configured out LL | pub fn uwu() {} | ^^^ note: the item is gated here - --> $DIR/auxiliary/cfged_out.rs:2:5 + --> $DIR/auxiliary/cfged_out.rs:2:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0425]: cannot find function `meow` in module `cfged_out::inner::right` --> $DIR/diagnostics-cross-crate.rs:24:30 @@ -67,10 +67,10 @@ note: found an item that was configured out LL | pub fn vanished() {} | ^^^^^^^^ note: the item is gated here - --> $DIR/auxiliary/cfged_out.rs:21:1 + --> $DIR/auxiliary/cfged_out.rs:21:7 | LL | #[cfg(i_dont_exist_and_you_can_do_nothing_about_it)] - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/cfg/diagnostics-reexport-2.stderr b/tests/ui/cfg/diagnostics-reexport-2.stderr index 95ac5a19b0b..e1f91fcc5d1 100644 --- a/tests/ui/cfg/diagnostics-reexport-2.stderr +++ b/tests/ui/cfg/diagnostics-reexport-2.stderr @@ -10,10 +10,10 @@ note: found an item that was configured out LL | pub mod gated { | ^^^^^ note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:5 + --> $DIR/diagnostics-reexport-2.rs:4:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport2` --> $DIR/diagnostics-reexport-2.rs:46:16 @@ -27,10 +27,10 @@ note: found an item that was configured out LL | pub mod gated { | ^^^^^ note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:5 + --> $DIR/diagnostics-reexport-2.rs:4:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport30` --> $DIR/diagnostics-reexport-2.rs:50:17 @@ -44,10 +44,10 @@ note: found an item that was configured out LL | pub mod gated { | ^^^^^ note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:5 + --> $DIR/diagnostics-reexport-2.rs:4:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport31` --> $DIR/diagnostics-reexport-2.rs:54:17 @@ -61,10 +61,10 @@ note: found an item that was configured out LL | pub mod gated { | ^^^^^ note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:5 + --> $DIR/diagnostics-reexport-2.rs:4:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0433]: failed to resolve: could not find `gated` in `reexport32` --> $DIR/diagnostics-reexport-2.rs:58:17 @@ -78,10 +78,10 @@ note: found an item that was configured out LL | pub mod gated { | ^^^^^ note: the item is gated here - --> $DIR/diagnostics-reexport-2.rs:4:5 + --> $DIR/diagnostics-reexport-2.rs:4:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error: aborting due to 5 previous errors diff --git a/tests/ui/cfg/diagnostics-reexport.stderr b/tests/ui/cfg/diagnostics-reexport.stderr index 95dc4fac945..bf1bbcba7e4 100644 --- a/tests/ui/cfg/diagnostics-reexport.stderr +++ b/tests/ui/cfg/diagnostics-reexport.stderr @@ -10,10 +10,10 @@ note: found an item that was configured out LL | pub fn x() {} | ^ note: the item is gated here - --> $DIR/diagnostics-reexport.rs:17:5 + --> $DIR/diagnostics-reexport.rs:17:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0432]: unresolved imports `b::x`, `b::y` --> $DIR/diagnostics-reexport.rs:22:13 @@ -29,20 +29,20 @@ note: found an item that was configured out LL | pub fn x() {} | ^ note: the item is gated here - --> $DIR/diagnostics-reexport.rs:28:5 + --> $DIR/diagnostics-reexport.rs:28:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ note: found an item that was configured out --> $DIR/diagnostics-reexport.rs:32:12 | LL | pub fn y() {} | ^ note: the item is gated here - --> $DIR/diagnostics-reexport.rs:31:5 + --> $DIR/diagnostics-reexport.rs:31:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0425]: cannot find function `uwu` in module `inner` --> $DIR/diagnostics-reexport.rs:38:12 @@ -56,10 +56,10 @@ note: found an item that was configured out LL | pub use super::uwu; | ^^^ note: the item is gated here - --> $DIR/diagnostics-reexport.rs:7:5 + --> $DIR/diagnostics-reexport.rs:7:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error: aborting due to 3 previous errors diff --git a/tests/ui/cfg/diagnostics-same-crate.stderr b/tests/ui/cfg/diagnostics-same-crate.stderr index 75a1bc39a01..121f25ca090 100644 --- a/tests/ui/cfg/diagnostics-same-crate.stderr +++ b/tests/ui/cfg/diagnostics-same-crate.stderr @@ -10,10 +10,10 @@ note: found an item that was configured out LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:8:5 + --> $DIR/diagnostics-same-crate.rs:8:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0432]: unresolved import `super::inner::doesnt_exist` --> $DIR/diagnostics-same-crate.rs:35:23 @@ -27,10 +27,10 @@ note: found an item that was configured out LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:8:5 + --> $DIR/diagnostics-same-crate.rs:8:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner` --> $DIR/diagnostics-same-crate.rs:54:12 @@ -44,10 +44,10 @@ note: found an item that was configured out LL | pub mod doesnt_exist { | ^^^^^^^^^^^^ note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:8:5 + --> $DIR/diagnostics-same-crate.rs:8:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0425]: cannot find function `uwu` in module `inner` --> $DIR/diagnostics-same-crate.rs:49:12 @@ -61,10 +61,10 @@ note: found an item that was configured out LL | pub fn uwu() {} | ^^^ note: the item is gated here - --> $DIR/diagnostics-same-crate.rs:4:5 + --> $DIR/diagnostics-same-crate.rs:4:11 | LL | #[cfg(false)] - | ^^^^^^^^^^^^^ + | ^^^^^ error[E0425]: cannot find function `meow` in module `inner::right` --> $DIR/diagnostics-same-crate.rs:58:19 diff --git a/tests/ui/check-cfg/compact-names.rs b/tests/ui/check-cfg/compact-names.rs index 931afdf986f..fbf8f9d2002 100644 --- a/tests/ui/check-cfg/compact-names.rs +++ b/tests/ui/check-cfg/compact-names.rs @@ -13,4 +13,8 @@ pub fn expected() {} //~^ WARNING unexpected `cfg` condition name pub fn unexpected() {} +#[cfg(target(os = "windows", architecture = "arm"))] +//~^ WARNING unexpected `cfg` condition name +pub fn unexpected2() {} + fn main() {} diff --git a/tests/ui/check-cfg/compact-names.stderr b/tests/ui/check-cfg/compact-names.stderr index 74ed0337e3b..3221b4e07ec 100644 --- a/tests/ui/check-cfg/compact-names.stderr +++ b/tests/ui/check-cfg/compact-names.stderr @@ -8,5 +8,14 @@ LL | #[cfg(target(os = "linux", architecture = "arm"))] = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration = note: `#[warn(unexpected_cfgs)]` on by default -warning: 1 warning emitted +warning: unexpected `cfg` condition name: `target_architecture` + --> $DIR/compact-names.rs:16:30 + | +LL | #[cfg(target(os = "windows", architecture = "arm"))] + | ^^^^^^^^^^^^^^^^^^^^ + | + = help: to expect this configuration use `--check-cfg=cfg(target_architecture, values("arm"))` + = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration + +warning: 2 warnings emitted diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs index 47418b4e091..df87a3d846e 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -1,16 +1,24 @@ -#[cfg] //~ ERROR `cfg` is not followed by parentheses +#[cfg] +//~^ ERROR malformed `cfg` attribute +//~| NOTE expected this to be a list struct S1; -#[cfg = 10] //~ ERROR `cfg` is not followed by parentheses +#[cfg = 10] +//~^ ERROR malformed `cfg` attribute +//~| NOTE expected this to be a list struct S2; -#[cfg()] //~ ERROR `cfg` predicate is not specified +#[cfg()] +//~^ ERROR malformed `cfg` attribute +//~| NOTE expected a single argument here struct S3; -#[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified +#[cfg(a, b)] +//~^ ERROR malformed `cfg` attribute +//~| NOTE expected a single argument here struct S4; -#[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal +#[cfg("str")] //~ ERROR `cfg` predicate key must be an identifier struct S5; #[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier @@ -19,10 +27,12 @@ struct S6; #[cfg(a())] //~ ERROR invalid predicate `a` struct S7; -#[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string +#[cfg(a = 10)] //~ ERROR malformed `cfg` attribute input +//~^ NOTE expected a string literal here struct S8; -#[cfg(a = b"hi")] //~ ERROR literal in `cfg` predicate value must be a string +#[cfg(a = b"hi")] //~ ERROR malformed `cfg` attribute input +//~^ NOTE expected a normal string literal, not a byte string literal struct S9; macro_rules! generate_s10 { @@ -34,5 +44,6 @@ macro_rules! generate_s10 { } generate_s10!(concat!("nonexistent")); +//~^ NOTE in this expansion of generate_s10! fn main() {} diff --git a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 66ce2ee9858..75e9b9209c0 100644 --- a/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -1,61 +1,78 @@ -error: `cfg` is not followed by parentheses +error[E0539]: malformed `cfg` attribute input --> $DIR/cfg-attr-syntax-validation.rs:1:1 | LL | #[cfg] - | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[cfg(predicate)]` -error: `cfg` is not followed by parentheses - --> $DIR/cfg-attr-syntax-validation.rs:4:1 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-attr-syntax-validation.rs:6:1 | LL | #[cfg = 10] - | ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^^^^^^^ + | | + | expected this to be a list + | help: must be of the form: `#[cfg(predicate)]` -error: `cfg` predicate is not specified - --> $DIR/cfg-attr-syntax-validation.rs:7:1 +error[E0805]: malformed `cfg` attribute input + --> $DIR/cfg-attr-syntax-validation.rs:11:1 | LL | #[cfg()] - | ^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + | ^^^^^--^ + | | | + | | expected a single argument here + | help: must be of the form: `#[cfg(predicate)]` -error: multiple `cfg` predicates are specified - --> $DIR/cfg-attr-syntax-validation.rs:10:10 +error[E0805]: malformed `cfg` attribute input + --> $DIR/cfg-attr-syntax-validation.rs:16:1 | LL | #[cfg(a, b)] - | ^ + | ^^^^^------^ + | | | + | | expected a single argument here + | help: must be of the form: `#[cfg(predicate)]` -error: `cfg` predicate key cannot be a literal - --> $DIR/cfg-attr-syntax-validation.rs:13:7 +error: `cfg` predicate key must be an identifier + --> $DIR/cfg-attr-syntax-validation.rs:21:7 | LL | #[cfg("str")] | ^^^^^ error: `cfg` predicate key must be an identifier - --> $DIR/cfg-attr-syntax-validation.rs:16:7 + --> $DIR/cfg-attr-syntax-validation.rs:24:7 | LL | #[cfg(a::b)] | ^^^^ error[E0537]: invalid predicate `a` - --> $DIR/cfg-attr-syntax-validation.rs:19:7 + --> $DIR/cfg-attr-syntax-validation.rs:27:7 | LL | #[cfg(a())] | ^^^ -error[E0565]: literal in `cfg` predicate value must be a string - --> $DIR/cfg-attr-syntax-validation.rs:22:11 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-attr-syntax-validation.rs:30:1 | LL | #[cfg(a = 10)] - | ^^ + | ^^^^^^^^^^--^^ + | | | + | | expected a string literal here + | help: must be of the form: `#[cfg(predicate)]` -error[E0565]: literal in `cfg` predicate value must be a string - --> $DIR/cfg-attr-syntax-validation.rs:25:11 +error[E0539]: malformed `cfg` attribute input + --> $DIR/cfg-attr-syntax-validation.rs:34:1 | LL | #[cfg(a = b"hi")] - | -^^^^ + | ^^^^^^^^^^-^^^^^^ | | | help: consider removing the prefix + | + = note: expected a normal string literal, not a byte string literal error: expected unsuffixed literal, found `expr` metavariable - --> $DIR/cfg-attr-syntax-validation.rs:30:25 + --> $DIR/cfg-attr-syntax-validation.rs:40:25 | LL | #[cfg(feature = $expr)] | ^^^^^ @@ -67,5 +84,5 @@ LL | generate_s10!(concat!("nonexistent")); error: aborting due to 10 previous errors -Some errors have detailed explanations: E0537, E0565. +Some errors have detailed explanations: E0537, E0539, E0805. For more information about an error, try `rustc --explain E0537`. diff --git a/tests/ui/macros/macro-outer-attributes.stderr b/tests/ui/macros/macro-outer-attributes.stderr index a894c90f4c3..9215754d4bb 100644 --- a/tests/ui/macros/macro-outer-attributes.stderr +++ b/tests/ui/macros/macro-outer-attributes.stderr @@ -10,16 +10,10 @@ note: found an item that was configured out LL | pub fn bar() { }); | ^^^ note: the item is gated here - --> $DIR/macro-outer-attributes.rs:5:45 - | -LL | $i:item) => (mod $nm { #[$a] $i }); } - | ^^^^^ -LL | -LL | / test!(a, -LL | | #[cfg(false)], -LL | | pub fn bar() { }); - | |_______________________- in this macro invocation - = note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $DIR/macro-outer-attributes.rs:8:13 + | +LL | #[cfg(false)], + | ^^^^^ help: consider importing this function | LL + use b::bar; |
