test(ui/lint): demonstrate the current cmdline lint behavior
This demonstrates the current behavior of adding lint form the command line. generally the lint levels are ignored as the current implementation unconditionally emit errors for those lints.
This commit is contained in:
parent
61efe9d298
commit
ecff1c012e
8 changed files with 127 additions and 0 deletions
12
tests/ui/lint/lint-removed-cmdline-deny.rs
Normal file
12
tests/ui/lint/lint-removed-cmdline-deny.rs
Normal file
|
@ -0,0 +1,12 @@
|
|||
// The raw_pointer_derived lint warns about its removal
|
||||
// cc #30346
|
||||
|
||||
// compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive
|
||||
|
||||
// error-pattern:lint `raw_pointer_derive` has been removed
|
||||
// error-pattern:requested on the command line with `-D raw_pointer_derive`
|
||||
|
||||
#![warn(unused)]
|
||||
|
||||
#[deny(warnings)]
|
||||
fn main() { let unused = (); }
|
27
tests/ui/lint/lint-removed-cmdline-deny.stderr
Normal file
27
tests/ui/lint/lint-removed-cmdline-deny.stderr
Normal file
|
@ -0,0 +1,27 @@
|
|||
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
||||
|
|
||||
= note: requested on the command line with `-D raw_pointer_derive`
|
||||
|
||||
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
||||
|
|
||||
= note: requested on the command line with `-D raw_pointer_derive`
|
||||
|
||||
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
|
||||
|
|
||||
= note: requested on the command line with `-D raw_pointer_derive`
|
||||
|
||||
error: unused variable: `unused`
|
||||
--> $DIR/lint-removed-cmdline-deny.rs:12:17
|
||||
|
|
||||
LL | fn main() { let unused = (); }
|
||||
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-removed-cmdline-deny.rs:11:8
|
||||
|
|
||||
LL | #[deny(warnings)]
|
||||
| ^^^^^^^^
|
||||
= note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
|
||||
|
||||
error: aborting due to previous error; 3 warnings emitted
|
||||
|
8
tests/ui/lint/lint-renamed-cmdline-deny.rs
Normal file
8
tests/ui/lint/lint-renamed-cmdline-deny.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// compile-flags:-D renamed-and-removed-lints -D bare_trait_object
|
||||
|
||||
// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
||||
// error-pattern:requested on the command line with `-D bare_trait_object`
|
||||
// error-pattern:unused
|
||||
|
||||
#[deny(unused)]
|
||||
fn main() { let unused = (); }
|
27
tests/ui/lint/lint-renamed-cmdline-deny.stderr
Normal file
27
tests/ui/lint/lint-renamed-cmdline-deny.stderr
Normal file
|
@ -0,0 +1,27 @@
|
|||
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
||||
|
|
||||
= note: requested on the command line with `-D bare_trait_object`
|
||||
|
||||
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
||||
|
|
||||
= note: requested on the command line with `-D bare_trait_object`
|
||||
|
||||
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
|
||||
|
|
||||
= note: requested on the command line with `-D bare_trait_object`
|
||||
|
||||
error: unused variable: `unused`
|
||||
--> $DIR/lint-renamed-cmdline-deny.rs:8:17
|
||||
|
|
||||
LL | fn main() { let unused = (); }
|
||||
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-renamed-cmdline-deny.rs:7:8
|
||||
|
|
||||
LL | #[deny(unused)]
|
||||
| ^^^^^^
|
||||
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
|
||||
|
||||
error: aborting due to previous error; 3 warnings emitted
|
||||
|
3
tests/ui/lint/lint-unknown-lint-cmdline-allow.rs
Normal file
3
tests/ui/lint/lint-unknown-lint-cmdline-allow.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
// compile-flags:-A unknown-lints -D bogus -D dead_cod
|
||||
|
||||
fn main() { }
|
21
tests/ui/lint/lint-unknown-lint-cmdline-allow.stderr
Normal file
21
tests/ui/lint/lint-unknown-lint-cmdline-allow.stderr
Normal file
|
@ -0,0 +1,21 @@
|
|||
error[E0602]: unknown lint: `bogus`
|
||||
|
|
||||
= note: requested on the command line with `-D bogus`
|
||||
|
||||
error[E0602]: unknown lint: `dead_cod`
|
||||
|
|
||||
= help: did you mean: `dead_code`
|
||||
= note: requested on the command line with `-D dead_cod`
|
||||
|
||||
error[E0602]: unknown lint: `bogus`
|
||||
|
|
||||
= note: requested on the command line with `-D bogus`
|
||||
|
||||
error[E0602]: unknown lint: `dead_cod`
|
||||
|
|
||||
= help: did you mean: `dead_code`
|
||||
= note: requested on the command line with `-D dead_cod`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0602`.
|
8
tests/ui/lint/lint-unknown-lint-cmdline-deny.rs
Normal file
8
tests/ui/lint/lint-unknown-lint-cmdline-deny.rs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// compile-flags:-D unknown-lints -D bogus -D dead_cod
|
||||
|
||||
// error-pattern:unknown lint: `bogus`
|
||||
// error-pattern:requested on the command line with `-D bogus`
|
||||
// error-pattern:requested on the command line with `-D dead_cod`
|
||||
// error-pattern:did you mean: `dead_code`
|
||||
|
||||
fn main() { }
|
21
tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
Normal file
21
tests/ui/lint/lint-unknown-lint-cmdline-deny.stderr
Normal file
|
@ -0,0 +1,21 @@
|
|||
error[E0602]: unknown lint: `bogus`
|
||||
|
|
||||
= note: requested on the command line with `-D bogus`
|
||||
|
||||
error[E0602]: unknown lint: `dead_cod`
|
||||
|
|
||||
= help: did you mean: `dead_code`
|
||||
= note: requested on the command line with `-D dead_cod`
|
||||
|
||||
error[E0602]: unknown lint: `bogus`
|
||||
|
|
||||
= note: requested on the command line with `-D bogus`
|
||||
|
||||
error[E0602]: unknown lint: `dead_cod`
|
||||
|
|
||||
= help: did you mean: `dead_code`
|
||||
= note: requested on the command line with `-D dead_cod`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0602`.
|
Loading…
Add table
Add a link
Reference in a new issue