about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-11-04 16:47:03 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-11-09 18:19:34 +0300
commit83f553c95c4a7cfd44ec00ce056708a7022b7bf7 (patch)
tree062d55fdcb81ccdbe5b224148e5efcf7f9ea90f1 /src/test
parent09fff5063749662973456a076dd3f9133dc01ecf (diff)
downloadrust-83f553c95c4a7cfd44ec00ce056708a7022b7bf7.tar.gz
rust-83f553c95c4a7cfd44ec00ce056708a7022b7bf7.zip
Address review comments
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/attributes/register-attr-tool-import.rs14
-rw-r--r--src/test/ui/attributes/register-attr-tool-import.stderr26
-rw-r--r--src/test/ui/attributes/register-attr-tool-prelude.rs14
-rw-r--r--src/test/ui/attributes/register-attr-tool-prelude.stderr15
-rw-r--r--src/test/ui/attributes/register-attr-tool-unused.rs10
-rw-r--r--src/test/ui/attributes/register-attr-tool-unused.stderr33
-rw-r--r--src/test/ui/feature-gates/feature-gate-register_attr.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-register_tool.stderr2
8 files changed, 114 insertions, 2 deletions
diff --git a/src/test/ui/attributes/register-attr-tool-import.rs b/src/test/ui/attributes/register-attr-tool-import.rs
new file mode 100644
index 00000000000..3d0cf9154fb
--- /dev/null
+++ b/src/test/ui/attributes/register-attr-tool-import.rs
@@ -0,0 +1,14 @@
+// edition:2018
+
+#![feature(register_attr)]
+#![feature(register_tool)]
+
+#![register_attr(attr)]
+#![register_tool(tool)]
+
+use attr as renamed_attr; // OK
+use tool as renamed_tool; // OK
+
+#[renamed_attr] //~ ERROR cannot use an explicitly registered attribute through an import
+#[renamed_tool::attr] //~ ERROR cannot use a tool module through an import
+fn main() {}
diff --git a/src/test/ui/attributes/register-attr-tool-import.stderr b/src/test/ui/attributes/register-attr-tool-import.stderr
new file mode 100644
index 00000000000..6f280c8e0d9
--- /dev/null
+++ b/src/test/ui/attributes/register-attr-tool-import.stderr
@@ -0,0 +1,26 @@
+error: cannot use an explicitly registered attribute through an import
+  --> $DIR/register-attr-tool-import.rs:12:3
+   |
+LL | #[renamed_attr]
+   |   ^^^^^^^^^^^^
+   |
+note: the explicitly registered attribute imported here
+  --> $DIR/register-attr-tool-import.rs:9:5
+   |
+LL | use attr as renamed_attr; // OK
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: cannot use a tool module through an import
+  --> $DIR/register-attr-tool-import.rs:13:3
+   |
+LL | #[renamed_tool::attr]
+   |   ^^^^^^^^^^^^
+   |
+note: the tool module imported here
+  --> $DIR/register-attr-tool-import.rs:10:5
+   |
+LL | use tool as renamed_tool; // OK
+   |     ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/attributes/register-attr-tool-prelude.rs b/src/test/ui/attributes/register-attr-tool-prelude.rs
new file mode 100644
index 00000000000..a491773f5eb
--- /dev/null
+++ b/src/test/ui/attributes/register-attr-tool-prelude.rs
@@ -0,0 +1,14 @@
+#![feature(register_attr)]
+#![feature(register_tool)]
+
+#![register_attr(attr)]
+#![register_tool(tool)]
+
+#[no_implicit_prelude]
+mod m {
+    #[attr] //~ ERROR cannot find attribute `attr` in this scope
+    #[tool::attr] //~ ERROR failed to resolve: use of undeclared type or module `tool`
+    fn check() {}
+}
+
+fn main() {}
diff --git a/src/test/ui/attributes/register-attr-tool-prelude.stderr b/src/test/ui/attributes/register-attr-tool-prelude.stderr
new file mode 100644
index 00000000000..66a4eeb6aa4
--- /dev/null
+++ b/src/test/ui/attributes/register-attr-tool-prelude.stderr
@@ -0,0 +1,15 @@
+error[E0433]: failed to resolve: use of undeclared type or module `tool`
+  --> $DIR/register-attr-tool-prelude.rs:10:7
+   |
+LL |     #[tool::attr]
+   |       ^^^^ use of undeclared type or module `tool`
+
+error: cannot find attribute `attr` in this scope
+  --> $DIR/register-attr-tool-prelude.rs:9:7
+   |
+LL |     #[attr]
+   |       ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/attributes/register-attr-tool-unused.rs b/src/test/ui/attributes/register-attr-tool-unused.rs
new file mode 100644
index 00000000000..546e372f5e3
--- /dev/null
+++ b/src/test/ui/attributes/register-attr-tool-unused.rs
@@ -0,0 +1,10 @@
+#![deny(unused)]
+
+#![feature(register_attr)]
+#![feature(register_tool)]
+
+#[register_attr(attr)] //~ ERROR crate-level attribute should be an inner attribute
+                       //~| ERROR unused attribute
+#[register_tool(tool)] //~ ERROR crate-level attribute should be an inner attribute
+                       //~| ERROR unused attribute
+fn main() {}
diff --git a/src/test/ui/attributes/register-attr-tool-unused.stderr b/src/test/ui/attributes/register-attr-tool-unused.stderr
new file mode 100644
index 00000000000..0756c572c35
--- /dev/null
+++ b/src/test/ui/attributes/register-attr-tool-unused.stderr
@@ -0,0 +1,33 @@
+error: unused attribute
+  --> $DIR/register-attr-tool-unused.rs:6:1
+   |
+LL | #[register_attr(attr)]
+   | ^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: lint level defined here
+  --> $DIR/register-attr-tool-unused.rs:1:9
+   |
+LL | #![deny(unused)]
+   |         ^^^^^^
+   = note: `#[deny(unused_attributes)]` implied by `#[deny(unused)]`
+
+error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/register-attr-tool-unused.rs:6:1
+   |
+LL | #[register_attr(attr)]
+   | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+  --> $DIR/register-attr-tool-unused.rs:8:1
+   |
+LL | #[register_tool(tool)]
+   | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: crate-level attribute should be an inner attribute: add an exclamation mark: `#![foo]`
+  --> $DIR/register-attr-tool-unused.rs:8:1
+   |
+LL | #[register_tool(tool)]
+   | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/feature-gates/feature-gate-register_attr.stderr b/src/test/ui/feature-gates/feature-gate-register_attr.stderr
index b097f578bf2..3965d481d9b 100644
--- a/src/test/ui/feature-gates/feature-gate-register_attr.stderr
+++ b/src/test/ui/feature-gates/feature-gate-register_attr.stderr
@@ -4,7 +4,7 @@ error[E0658]: the `#[register_attr]` attribute is an experimental feature
 LL | #![register_attr(attr)]
    | ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/29642
+   = note: for more information, see https://github.com/rust-lang/rust/issues/66080
    = help: add `#![feature(register_attr)]` to the crate attributes to enable
 
 error: aborting due to previous error
diff --git a/src/test/ui/feature-gates/feature-gate-register_tool.stderr b/src/test/ui/feature-gates/feature-gate-register_tool.stderr
index 85a86d2daf8..177342aed90 100644
--- a/src/test/ui/feature-gates/feature-gate-register_tool.stderr
+++ b/src/test/ui/feature-gates/feature-gate-register_tool.stderr
@@ -4,7 +4,7 @@ error[E0658]: the `#[register_tool]` attribute is an experimental feature
 LL | #![register_tool(tool)]
    | ^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: for more information, see https://github.com/rust-lang/rust/issues/44690
+   = note: for more information, see https://github.com/rust-lang/rust/issues/66079
    = help: add `#![feature(register_tool)]` to the crate attributes to enable
 
 error: aborting due to previous error