diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs index 8f9f91979a42..86aebe6a2ab5 100644 --- a/src/libsyntax/attr/builtin.rs +++ b/src/libsyntax/attr/builtin.rs @@ -390,7 +390,9 @@ fn find_stability_generic<'a, I>(sess: &ParseSess, handle_errors( sess, meta.span, - AttrError::UnknownMetaItem(mi.name(), &["since", "note"]), + AttrError::UnknownMetaItem( + mi.name(), &["since", "note"], + ), false, ); continue 'outer diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs index 06a22eff25c2..8a9740f83092 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -19,14 +19,17 @@ 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 unsupported literal struct S8; -macro_rules! generate_s9 { +#[deprecated(since = b"1.30", note = "hi")] //~ ERROR E0565 +struct S9; + +macro_rules! generate_s10 { ($expr: expr) => { #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item - struct S9; + struct S10; } } -generate_s9!(concat!("nonexistent")); +generate_s10!(concat!("nonexistent")); diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr index 7773fdb8cf98..0b8f2c864eb0 100644 --- a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -40,10 +40,10 @@ error[E0537]: invalid predicate `a` LL | #[cfg(a())] //~ ERROR invalid predicate `a` | ^^^ -error: literal in `cfg` predicate value must be a string +error[E0565]: unsupported literal --> $DIR/cfg-attr-syntax-validation.rs:22:11 | -LL | #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string +LL | #[cfg(a = 10)] //~ ERROR unsupported literal | ^^ error: `cfg` is not a well-formed meta-item @@ -57,4 +57,5 @@ LL | generate_s9!(concat!("nonexistent")); error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0537`. +Some errors occurred: E0537, E0565. +For more information about an error, try `rustc --explain E0537`. diff --git a/src/test/ui/error-codes/E0565-2.rs b/src/test/ui/error-codes/E0565-2.rs new file mode 100644 index 000000000000..eb13e4327511 --- /dev/null +++ b/src/test/ui/error-codes/E0565-2.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// repr currently doesn't support literals +#[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565 +struct A { } + +fn main() { } diff --git a/src/test/ui/error-codes/E0565-2.stderr b/src/test/ui/error-codes/E0565-2.stderr new file mode 100644 index 000000000000..46125b71420a --- /dev/null +++ b/src/test/ui/error-codes/E0565-2.stderr @@ -0,0 +1,9 @@ +error[E0565]: unsupported literal + --> $DIR/E0565-2.rs:12:22 + | +LL | #[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565 + | ^^^^^^^ help: consider removing the prefix: `"1.29"` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0565`.