From 65b28a987bfce11c37634fff2be129ffc16096d5 Mon Sep 17 00:00:00 2001 From: Eric Holk Date: Fri, 25 Jun 2021 14:28:03 -0700 Subject: [PATCH] Add ui test for command line lints with tool names This adds a ui test to make sure rustc accepts lint arguments such as `-A clippy::foo` when clippy is disabled. --- src/test/ui/lint/command-line-register-lint-tool.rs | 7 +++++++ .../lint/command-line-register-unknown-lint-tool.rs | 4 ++++ .../command-line-register-unknown-lint-tool.stderr | 11 +++++++++++ 3 files changed, 22 insertions(+) create mode 100644 src/test/ui/lint/command-line-register-lint-tool.rs create mode 100644 src/test/ui/lint/command-line-register-unknown-lint-tool.rs create mode 100644 src/test/ui/lint/command-line-register-unknown-lint-tool.stderr diff --git a/src/test/ui/lint/command-line-register-lint-tool.rs b/src/test/ui/lint/command-line-register-lint-tool.rs new file mode 100644 index 000000000000..d6e95fd3ec40 --- /dev/null +++ b/src/test/ui/lint/command-line-register-lint-tool.rs @@ -0,0 +1,7 @@ +// compile-flags: -A known_tool::foo +// check-pass + +#![feature(register_tool)] +#![register_tool(known_tool)] + +fn main() {} diff --git a/src/test/ui/lint/command-line-register-unknown-lint-tool.rs b/src/test/ui/lint/command-line-register-unknown-lint-tool.rs new file mode 100644 index 000000000000..435e951c809b --- /dev/null +++ b/src/test/ui/lint/command-line-register-unknown-lint-tool.rs @@ -0,0 +1,4 @@ +// compile-flags: -A unknown_tool::foo +// check-fail + +fn main() {} diff --git a/src/test/ui/lint/command-line-register-unknown-lint-tool.stderr b/src/test/ui/lint/command-line-register-unknown-lint-tool.stderr new file mode 100644 index 000000000000..9e0177c47da2 --- /dev/null +++ b/src/test/ui/lint/command-line-register-unknown-lint-tool.stderr @@ -0,0 +1,11 @@ +error[E0602]: unknown lint: `unknown_tool::foo` + | + = note: requested on the command line with `-A unknown_tool::foo` + +error[E0602]: unknown lint: `unknown_tool::foo` + | + = note: requested on the command line with `-A unknown_tool::foo` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0602`.