update meta item checking test
This commit is contained in:
parent
d3b018ccdb
commit
fb7c76bad5
5 changed files with 38 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"));
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
15
src/test/ui/error-codes/E0565-2.rs
Normal file
15
src/test/ui/error-codes/E0565-2.rs
Normal file
|
|
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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() { }
|
||||
9
src/test/ui/error-codes/E0565-2.stderr
Normal file
9
src/test/ui/error-codes/E0565-2.stderr
Normal file
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue