about summary refs log tree commit diff
diff options
context:
space:
mode:
authorcsmoe <35686186+csmoe@users.noreply.github.com>2018-10-09 22:55:07 +0800
committercsmoe <35686186+csmoe@users.noreply.github.com>2018-10-20 11:11:31 +0800
commitfb7c76bad551255b174958ccbfe7b7cda7f53897 (patch)
tree0f50481d72f1d54e4a1cddf2d2868619b2fc740c
parentd3b018ccdba328389ca90cff8795e5f6b97e5c13 (diff)
downloadrust-fb7c76bad551255b174958ccbfe7b7cda7f53897.tar.gz
rust-fb7c76bad551255b174958ccbfe7b7cda7f53897.zip
update meta item checking test
-rw-r--r--src/libsyntax/attr/builtin.rs4
-rw-r--r--src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs11
-rw-r--r--src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr7
-rw-r--r--src/test/ui/error-codes/E0565-2.rs15
-rw-r--r--src/test/ui/error-codes/E0565-2.stderr9
5 files changed, 38 insertions, 8 deletions
diff --git a/src/libsyntax/attr/builtin.rs b/src/libsyntax/attr/builtin.rs
index 8f9f91979a4..86aebe6a2ab 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 06a22eff25c..8a9740f8309 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 7773fdb8cf9..0b8f2c864eb 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 00000000000..eb13e432751
--- /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 <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() {  }
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 00000000000..46125b71420
--- /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`.