1
Fork 0

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:
Weihang Lo 2023-08-30 14:19:53 +01:00
parent 61efe9d298
commit ecff1c012e
No known key found for this signature in database
GPG key ID: D7DBF189825E82E7
8 changed files with 127 additions and 0 deletions

View 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 = (); }

View 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

View 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 = (); }

View 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

View file

@ -0,0 +1,3 @@
// compile-flags:-A unknown-lints -D bogus -D dead_cod
fn main() { }

View 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`.

View 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() { }

View 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`.