Skip to content

Commit fb7c76b

Browse files
committed
update meta item checking test
1 parent d3b018c commit fb7c76b

File tree

5 files changed

+38
-8
lines changed

5 files changed

+38
-8
lines changed

src/libsyntax/attr/builtin.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,9 @@ fn find_stability_generic<'a, I>(sess: &ParseSess,
390390
handle_errors(
391391
sess,
392392
meta.span,
393-
AttrError::UnknownMetaItem(mi.name(), &["since", "note"]),
393+
AttrError::UnknownMetaItem(
394+
mi.name(), &["since", "note"],
395+
),
394396
false,
395397
);
396398
continue 'outer

src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@ struct S6;
1919
#[cfg(a())] //~ ERROR invalid predicate `a`
2020
struct S7;
2121

22-
#[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string
22+
#[cfg(a = 10)] //~ ERROR unsupported literal
2323
struct S8;
2424

25-
macro_rules! generate_s9 {
25+
#[deprecated(since = b"1.30", note = "hi")] //~ ERROR E0565
26+
struct S9;
27+
28+
macro_rules! generate_s10 {
2629
($expr: expr) => {
2730
#[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item
28-
struct S9;
31+
struct S10;
2932
}
3033
}
3134

32-
generate_s9!(concat!("nonexistent"));
35+
generate_s10!(concat!("nonexistent"));

src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr

+4-3
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ error[E0537]: invalid predicate `a`
4040
LL | #[cfg(a())] //~ ERROR invalid predicate `a`
4141
| ^^^
4242

43-
error: literal in `cfg` predicate value must be a string
43+
error[E0565]: unsupported literal
4444
--> $DIR/cfg-attr-syntax-validation.rs:22:11
4545
|
46-
LL | #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string
46+
LL | #[cfg(a = 10)] //~ ERROR unsupported literal
4747
| ^^
4848

4949
error: `cfg` is not a well-formed meta-item
@@ -57,4 +57,5 @@ LL | generate_s9!(concat!("nonexistent"));
5757

5858
error: aborting due to 9 previous errors
5959

60-
For more information about this error, try `rustc --explain E0537`.
60+
Some errors occurred: E0537, E0565.
61+
For more information about an error, try `rustc --explain E0537`.

src/test/ui/error-codes/E0565-2.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// repr currently doesn't support literals
12+
#[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565
13+
struct A { }
14+
15+
fn main() { }
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0565]: unsupported literal
2+
--> $DIR/E0565-2.rs:12:22
3+
|
4+
LL | #[deprecated(since = b"1.29", note = "hi")] //~ ERROR E0565
5+
| ^^^^^^^ help: consider removing the prefix: `"1.29"`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0565`.

0 commit comments

Comments
 (0)