about summary refs log tree commit diff
path: root/tests/ui/tool-attributes
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2024-05-19 16:11:46 -0700
committerJubilee Young <workingjubilee@gmail.com>2024-05-20 19:55:59 -0700
commitd89500843caf666998619bbc0c88d5857726963d (patch)
treea004fb459e4d686f805a5f22882fc10ed743b87c /tests/ui/tool-attributes
parent8e7517d99a8aaab02b512483ae91f8b79553fa3d (diff)
downloadrust-d89500843caf666998619bbc0c88d5857726963d.tar.gz
rust-d89500843caf666998619bbc0c88d5857726963d.zip
Move 100 entries from tests/ui into subdirs
- Move super-fast-paren-parsing test into ui/parser
- Move stmt_expr_attrs test into ui/feature-gates
- Move macro tests into ui/macros
- Move global_asm tests into ui/asm
- Move env tests into ui/process
- Move xcrate tests into ui/cross-crate
- Move unop tests into ui/unop
- Move backtrace tests into ui/backtrace
- Move check-static tests into ui/statics
- Move expr tests into ui/expr
- Move optimization fuel tests into ui/fuel
- Move ffi attribute tests into ui/ffi-attrs
- Move suggestion tests into ui/suggestions
- Move main tests into ui/fn-main
- Move lint tests into ui/lint
- Move repr tests into ui/repr
- Move intrinsics tests into ui/intrinsics
- Move tool lint tests into ui/tool-attributes
- Move return tests into ui/return
- Move pattern tests into ui/patttern
- Move range tests into ui/range
- Move foreign-fn tests into ui/foreign
- Move orphan-check tests into ui/coherence
- Move inference tests into ui/inference
- Reduce ROOT_ENTRY_LIMIT
Diffstat (limited to 'tests/ui/tool-attributes')
-rw-r--r--tests/ui/tool-attributes/tool_lints-fail.rs8
-rw-r--r--tests/ui/tool-attributes/tool_lints-fail.stderr14
-rw-r--r--tests/ui/tool-attributes/tool_lints-rpass.rs6
-rw-r--r--tests/ui/tool-attributes/tool_lints.rs4
-rw-r--r--tests/ui/tool-attributes/tool_lints.stderr20
-rw-r--r--tests/ui/tool-attributes/tool_lints_2018_preview.rs6
-rw-r--r--tests/ui/tool-attributes/unknown-lint-tool-name.rs6
-rw-r--r--tests/ui/tool-attributes/unknown-lint-tool-name.stderr37
-rw-r--r--tests/ui/tool-attributes/unknown-tool-name.rs2
-rw-r--r--tests/ui/tool-attributes/unknown-tool-name.stderr9
10 files changed, 112 insertions, 0 deletions
diff --git a/tests/ui/tool-attributes/tool_lints-fail.rs b/tests/ui/tool-attributes/tool_lints-fail.rs
new file mode 100644
index 00000000000..5cbd63be597
--- /dev/null
+++ b/tests/ui/tool-attributes/tool_lints-fail.rs
@@ -0,0 +1,8 @@
+// Don't allow tool_lints, which aren't scoped
+
+
+#![deny(unknown_lints)]
+
+#![deny(clippy)] //~ ERROR: unknown lint: `clippy`
+
+fn main() {}
diff --git a/tests/ui/tool-attributes/tool_lints-fail.stderr b/tests/ui/tool-attributes/tool_lints-fail.stderr
new file mode 100644
index 00000000000..7d80e0728f7
--- /dev/null
+++ b/tests/ui/tool-attributes/tool_lints-fail.stderr
@@ -0,0 +1,14 @@
+error: unknown lint: `clippy`
+  --> $DIR/tool_lints-fail.rs:6:9
+   |
+LL | #![deny(clippy)]
+   |         ^^^^^^
+   |
+note: the lint level is defined here
+  --> $DIR/tool_lints-fail.rs:4:9
+   |
+LL | #![deny(unknown_lints)]
+   |         ^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/tool-attributes/tool_lints-rpass.rs b/tests/ui/tool-attributes/tool_lints-rpass.rs
new file mode 100644
index 00000000000..458eca19ed6
--- /dev/null
+++ b/tests/ui/tool-attributes/tool_lints-rpass.rs
@@ -0,0 +1,6 @@
+//@ run-pass
+
+#![deny(unknown_lints)]
+
+#[allow(clippy::almost_swapped)]
+fn main() {}
diff --git a/tests/ui/tool-attributes/tool_lints.rs b/tests/ui/tool-attributes/tool_lints.rs
new file mode 100644
index 00000000000..ef27532f6de
--- /dev/null
+++ b/tests/ui/tool-attributes/tool_lints.rs
@@ -0,0 +1,4 @@
+#[warn(foo::bar)]
+//~^ ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
+//~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
+fn main() {}
diff --git a/tests/ui/tool-attributes/tool_lints.stderr b/tests/ui/tool-attributes/tool_lints.stderr
new file mode 100644
index 00000000000..f1d825caba1
--- /dev/null
+++ b/tests/ui/tool-attributes/tool_lints.stderr
@@ -0,0 +1,20 @@
+error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
+  --> $DIR/tool_lints.rs:1:8
+   |
+LL | #[warn(foo::bar)]
+   |        ^^^
+   |
+   = help: add `#![register_tool(foo)]` to the crate root
+
+error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
+  --> $DIR/tool_lints.rs:1:8
+   |
+LL | #[warn(foo::bar)]
+   |        ^^^
+   |
+   = help: add `#![register_tool(foo)]` to the crate root
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0710`.
diff --git a/tests/ui/tool-attributes/tool_lints_2018_preview.rs b/tests/ui/tool-attributes/tool_lints_2018_preview.rs
new file mode 100644
index 00000000000..458eca19ed6
--- /dev/null
+++ b/tests/ui/tool-attributes/tool_lints_2018_preview.rs
@@ -0,0 +1,6 @@
+//@ run-pass
+
+#![deny(unknown_lints)]
+
+#[allow(clippy::almost_swapped)]
+fn main() {}
diff --git a/tests/ui/tool-attributes/unknown-lint-tool-name.rs b/tests/ui/tool-attributes/unknown-lint-tool-name.rs
new file mode 100644
index 00000000000..cd5d2f028af
--- /dev/null
+++ b/tests/ui/tool-attributes/unknown-lint-tool-name.rs
@@ -0,0 +1,6 @@
+#![deny(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
+                   //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
+
+#[allow(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
+                   //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar`
+fn main() {}
diff --git a/tests/ui/tool-attributes/unknown-lint-tool-name.stderr b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr
new file mode 100644
index 00000000000..72731ab1e3d
--- /dev/null
+++ b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr
@@ -0,0 +1,37 @@
+error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
+  --> $DIR/unknown-lint-tool-name.rs:1:9
+   |
+LL | #![deny(foo::bar)]
+   |         ^^^
+   |
+   = help: add `#![register_tool(foo)]` to the crate root
+
+error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
+  --> $DIR/unknown-lint-tool-name.rs:4:9
+   |
+LL | #[allow(foo::bar)]
+   |         ^^^
+   |
+   = help: add `#![register_tool(foo)]` to the crate root
+
+error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
+  --> $DIR/unknown-lint-tool-name.rs:1:9
+   |
+LL | #![deny(foo::bar)]
+   |         ^^^
+   |
+   = help: add `#![register_tool(foo)]` to the crate root
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar`
+  --> $DIR/unknown-lint-tool-name.rs:4:9
+   |
+LL | #[allow(foo::bar)]
+   |         ^^^
+   |
+   = help: add `#![register_tool(foo)]` to the crate root
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0710`.
diff --git a/tests/ui/tool-attributes/unknown-tool-name.rs b/tests/ui/tool-attributes/unknown-tool-name.rs
new file mode 100644
index 00000000000..73fca61c65d
--- /dev/null
+++ b/tests/ui/tool-attributes/unknown-tool-name.rs
@@ -0,0 +1,2 @@
+#[foo::bar] //~ ERROR failed to resolve: use of undeclared crate or module `foo`
+fn main() {}
diff --git a/tests/ui/tool-attributes/unknown-tool-name.stderr b/tests/ui/tool-attributes/unknown-tool-name.stderr
new file mode 100644
index 00000000000..361d359a10e
--- /dev/null
+++ b/tests/ui/tool-attributes/unknown-tool-name.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: use of undeclared crate or module `foo`
+  --> $DIR/unknown-tool-name.rs:1:3
+   |
+LL | #[foo::bar]
+   |   ^^^ use of undeclared crate or module `foo`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0433`.