Add tests for command line lint control
This commit is contained in:
parent
2f2db99432
commit
10cb380766
11
src/test/ui/lint/cli-lint-override.forbid_warn.stderr
Normal file
11
src/test/ui/lint/cli-lint-override.forbid_warn.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error: extern declarations without an explicit ABI are deprecated
|
||||
--> $DIR/cli-lint-override.rs:12:1
|
||||
|
|
||||
LL | extern fn foo() {}
|
||||
| ^^^^^^^^^^^^^^^ ABI should be specified here
|
||||
|
|
||||
= note: requested on the command line with `-F missing-abi`
|
||||
= help: the default ABI is C
|
||||
|
||||
error: aborting due to previous error
|
||||
|
11
src/test/ui/lint/cli-lint-override.force_warn_deny.stderr
Normal file
11
src/test/ui/lint/cli-lint-override.force_warn_deny.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
warning: extern declarations without an explicit ABI are deprecated
|
||||
--> $DIR/cli-lint-override.rs:12:1
|
||||
|
|
||||
LL | extern fn foo() {}
|
||||
| ^^^^^^^^^^^^^^^ ABI should be specified here
|
||||
|
|
||||
= note: requested on the command line with `--force-warns missing-abi`
|
||||
= help: the default ABI is C
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
17
src/test/ui/lint/cli-lint-override.rs
Normal file
17
src/test/ui/lint/cli-lint-override.rs
Normal file
@ -0,0 +1,17 @@
|
||||
// Tests that subsequent lints specified via the command line override
|
||||
// each other, except for ForceWarn and Forbid, which cannot be overriden.
|
||||
//
|
||||
// revisions: warn_deny forbid_warn force_warn_deny
|
||||
//
|
||||
//[warn_deny] compile-flags: --warn missing_abi --deny missing_abi
|
||||
//[forbid_warn] compile-flags: --warn missing_abi --forbid missing_abi
|
||||
//[force_warn_deny] compile-flags: -Z unstable-options --force-warns missing_abi --allow missing_abi
|
||||
//[force_warn_deny] check-pass
|
||||
|
||||
|
||||
extern fn foo() {}
|
||||
//[warn_deny]~^ ERROR extern declarations without an explicit ABI are deprecated
|
||||
//[forbid_warn]~^^ ERROR extern declarations without an explicit ABI are deprecated
|
||||
//[force_warn_deny]~^^^ WARN extern declarations without an explicit ABI are deprecated
|
||||
|
||||
fn main() {}
|
11
src/test/ui/lint/cli-lint-override.warn_deny.stderr
Normal file
11
src/test/ui/lint/cli-lint-override.warn_deny.stderr
Normal file
@ -0,0 +1,11 @@
|
||||
error: extern declarations without an explicit ABI are deprecated
|
||||
--> $DIR/cli-lint-override.rs:12:1
|
||||
|
|
||||
LL | extern fn foo() {}
|
||||
| ^^^^^^^^^^^^^^^ ABI should be specified here
|
||||
|
|
||||
= note: requested on the command line with `-D missing-abi`
|
||||
= help: the default ABI is C
|
||||
|
||||
error: aborting due to previous error
|
||||
|
7
src/test/ui/lint/cli-unknown-force-warn.rs
Normal file
7
src/test/ui/lint/cli-unknown-force-warn.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// Checks that rustc correctly errors when passed an invalid lint with
|
||||
// `--force-warns`. This is a regression test for issue #86958.
|
||||
//
|
||||
// compile-flags: -Z unstable-options --force-warns foo-qux
|
||||
// error-pattern: unknown lint: `foo_qux`
|
||||
|
||||
fn main() {}
|
15
src/test/ui/lint/cli-unknown-force-warn.stderr
Normal file
15
src/test/ui/lint/cli-unknown-force-warn.stderr
Normal file
@ -0,0 +1,15 @@
|
||||
error[E0602]: unknown lint: `foo_qux`
|
||||
|
|
||||
= note: requested on the command line with `--force-warns foo_qux`
|
||||
|
||||
error[E0602]: unknown lint: `foo_qux`
|
||||
|
|
||||
= note: requested on the command line with `--force-warns foo_qux`
|
||||
|
||||
error[E0602]: unknown lint: `foo_qux`
|
||||
|
|
||||
= note: requested on the command line with `--force-warns foo_qux`
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0602`.
|
Loading…
Reference in New Issue
Block a user