about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-06-30 13:00:45 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-06-30 13:57:12 +0300
commite4e7eb2d5891ceb9241f769540dd413e90020971 (patch)
treef3aa0719e0588841025aae5e9d019dbe3ac42a62 /src/test/ui
parent0ffb6438a6b19135cdfd3461dbd9efaf0011a149 (diff)
downloadrust-e4e7eb2d5891ceb9241f769540dd413e90020971.tar.gz
rust-e4e7eb2d5891ceb9241f769540dd413e90020971.zip
Feature gate `rustc` attributes harder
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/feature-gates/feature-gate-rustc-attrs.rs19
-rw-r--r--src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr52
-rw-r--r--src/test/ui/proc-macro/expand-to-unstable-2.rs4
-rw-r--r--src/test/ui/proc-macro/expand-to-unstable-2.stderr11
-rw-r--r--src/test/ui/reserved/reserved-attr-on-macro.rs2
-rw-r--r--src/test/ui/reserved/reserved-attr-on-macro.stderr13
-rw-r--r--src/test/ui/suggestions/attribute-typos.rs5
-rw-r--r--src/test/ui/suggestions/attribute-typos.stderr11
8 files changed, 108 insertions, 9 deletions
diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
index 95ff18213f7..d3a2e486416 100644
--- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
+++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
@@ -1,6 +1,23 @@
 // Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
 
+#![feature(decl_macro)]
+
+mod rustc { pub macro unknown() {} }
+mod unknown { pub macro rustc() {} }
+
+#[rustc::unknown]
+//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
+//~| ERROR macro `rustc::unknown` may not be used in attributes
+fn f() {}
+
+#[unknown::rustc]
+//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
+//~| ERROR macro `unknown::rustc` may not be used in attributes
+fn g() {}
+
 #[rustc_dummy]
 //~^ ERROR used by the test suite
-
+#[rustc_unknown]
+//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
+//~| ERROR attribute `rustc_unknown` is currently unknown
 fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr
index 57dcc77e518..cdc7b27a749 100644
--- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr
+++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr
@@ -1,5 +1,53 @@
+error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
+  --> $DIR/feature-gate-rustc-attrs.rs:8:3
+   |
+LL | #[rustc::unknown]
+   |   ^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error: macro `rustc::unknown` may not be used in attributes
+  --> $DIR/feature-gate-rustc-attrs.rs:8:1
+   |
+LL | #[rustc::unknown]
+   | ^^^^^^^^^^^^^^^^^
+
+error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
+  --> $DIR/feature-gate-rustc-attrs.rs:13:12
+   |
+LL | #[unknown::rustc]
+   |            ^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error: macro `unknown::rustc` may not be used in attributes
+  --> $DIR/feature-gate-rustc-attrs.rs:13:1
+   |
+LL | #[unknown::rustc]
+   | ^^^^^^^^^^^^^^^^^
+
+error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
+  --> $DIR/feature-gate-rustc-attrs.rs:20:3
+   |
+LL | #[rustc_unknown]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error[E0658]: The attribute `rustc_unknown` is currently unknown to the compiler and may have meaning added to it in the future
+  --> $DIR/feature-gate-rustc-attrs.rs:20:3
+   |
+LL | #[rustc_unknown]
+   |   ^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
 error[E0658]: used by the test suite
-  --> $DIR/feature-gate-rustc-attrs.rs:3:1
+  --> $DIR/feature-gate-rustc-attrs.rs:18:1
    |
 LL | #[rustc_dummy]
    | ^^^^^^^^^^^^^^
@@ -7,6 +55,6 @@ LL | #[rustc_dummy]
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(rustc_attrs)] to the crate attributes to enable
 
-error: aborting due to previous error
+error: aborting due to 7 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.rs b/src/test/ui/proc-macro/expand-to-unstable-2.rs
index 8ce3cde6f04..437ae930934 100644
--- a/src/test/ui/proc-macro/expand-to-unstable-2.rs
+++ b/src/test/ui/proc-macro/expand-to-unstable-2.rs
@@ -4,7 +4,9 @@
 extern crate derive_unstable_2;
 
 #[derive(Unstable)]
-//~^ ERROR attribute `rustc_foo` is currently unknown
+//~^ ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
+//~| ERROR attribute `rustc_foo` is currently unknown to the compiler
+
 struct A;
 
 fn main() {
diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr
index 77be3d52723..803773db88e 100644
--- a/src/test/ui/proc-macro/expand-to-unstable-2.stderr
+++ b/src/test/ui/proc-macro/expand-to-unstable-2.stderr
@@ -1,3 +1,12 @@
+error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
+  --> $DIR/expand-to-unstable-2.rs:6:10
+   |
+LL | #[derive(Unstable)]
+   |          ^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
 error[E0658]: The attribute `rustc_foo` is currently unknown to the compiler and may have meaning added to it in the future
   --> $DIR/expand-to-unstable-2.rs:6:10
    |
@@ -7,6 +16,6 @@ LL | #[derive(Unstable)]
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/reserved/reserved-attr-on-macro.rs b/src/test/ui/reserved/reserved-attr-on-macro.rs
index 0ee6577f8a1..cb535362266 100644
--- a/src/test/ui/reserved/reserved-attr-on-macro.rs
+++ b/src/test/ui/reserved/reserved-attr-on-macro.rs
@@ -1,5 +1,7 @@
 #[rustc_attribute_should_be_reserved]
 //~^ ERROR attribute `rustc_attribute_should_be_reserved` is currently unknown
+//~| ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
+
 macro_rules! foo {
     () => (());
 }
diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr
index 34b21ecd126..0c62c82017e 100644
--- a/src/test/ui/reserved/reserved-attr-on-macro.stderr
+++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr
@@ -1,3 +1,12 @@
+error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
+  --> $DIR/reserved-attr-on-macro.rs:1:3
+   |
+LL | #[rustc_attribute_should_be_reserved]
+   |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
 error[E0658]: The attribute `rustc_attribute_should_be_reserved` is currently unknown to the compiler and may have meaning added to it in the future
   --> $DIR/reserved-attr-on-macro.rs:1:3
    |
@@ -8,13 +17,13 @@ LL | #[rustc_attribute_should_be_reserved]
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
 error: cannot determine resolution for the macro `foo`
-  --> $DIR/reserved-attr-on-macro.rs:8:5
+  --> $DIR/reserved-attr-on-macro.rs:10:5
    |
 LL |     foo!();
    |     ^^^
    |
    = note: import resolution is stuck, try simplifying macro imports
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/suggestions/attribute-typos.rs b/src/test/ui/suggestions/attribute-typos.rs
index b45acbdd920..0e10131ce8d 100644
--- a/src/test/ui/suggestions/attribute-typos.rs
+++ b/src/test/ui/suggestions/attribute-typos.rs
@@ -4,5 +4,8 @@ fn foo() {}
 #[tests] //~ ERROR attribute `tests` is currently unknown to the compiler
 fn bar() {}
 
-#[rustc_err] //~ ERROR attribute `rustc_err` is currently unknown
+#[rustc_err]
+//~^ ERROR attribute `rustc_err` is currently unknown
+//~| ERROR attributes starting with `rustc` are reserved for use by the `rustc` compiler
+
 fn main() {}
diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr
index ee063aaa122..958688b4d39 100644
--- a/src/test/ui/suggestions/attribute-typos.stderr
+++ b/src/test/ui/suggestions/attribute-typos.stderr
@@ -1,3 +1,12 @@
+error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler
+  --> $DIR/attribute-typos.rs:7:3
+   |
+LL | #[rustc_err]
+   |   ^^^^^^^^^
+   |
+   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
 error[E0658]: The attribute `rustc_err` is currently unknown to the compiler and may have meaning added to it in the future
   --> $DIR/attribute-typos.rs:7:3
    |
@@ -25,6 +34,6 @@ LL | #[deprcated]
    = note: for more information, see https://github.com/rust-lang/rust/issues/29642
    = help: add #![feature(custom_attribute)] to the crate attributes to enable
 
-error: aborting due to 3 previous errors
+error: aborting due to 4 previous errors
 
 For more information about this error, try `rustc --explain E0658`.