Skip to content

Commit ecff1c0

Browse files
committed
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.
1 parent 61efe9d commit ecff1c0

8 files changed

+127
-0
lines changed
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// The raw_pointer_derived lint warns about its removal
2+
// cc #30346
3+
4+
// compile-flags:-D renamed-and-removed-lints -D raw_pointer_derive
5+
6+
// error-pattern:lint `raw_pointer_derive` has been removed
7+
// error-pattern:requested on the command line with `-D raw_pointer_derive`
8+
9+
#![warn(unused)]
10+
11+
#[deny(warnings)]
12+
fn main() { let unused = (); }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
2+
|
3+
= note: requested on the command line with `-D raw_pointer_derive`
4+
5+
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
6+
|
7+
= note: requested on the command line with `-D raw_pointer_derive`
8+
9+
warning: lint `raw_pointer_derive` has been removed: using derive with raw pointers is ok
10+
|
11+
= note: requested on the command line with `-D raw_pointer_derive`
12+
13+
error: unused variable: `unused`
14+
--> $DIR/lint-removed-cmdline-deny.rs:12:17
15+
|
16+
LL | fn main() { let unused = (); }
17+
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
18+
|
19+
note: the lint level is defined here
20+
--> $DIR/lint-removed-cmdline-deny.rs:11:8
21+
|
22+
LL | #[deny(warnings)]
23+
| ^^^^^^^^
24+
= note: `#[deny(unused_variables)]` implied by `#[deny(warnings)]`
25+
26+
error: aborting due to previous error; 3 warnings emitted
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// compile-flags:-D renamed-and-removed-lints -D bare_trait_object
2+
3+
// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects`
4+
// error-pattern:requested on the command line with `-D bare_trait_object`
5+
// error-pattern:unused
6+
7+
#[deny(unused)]
8+
fn main() { let unused = (); }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
2+
|
3+
= note: requested on the command line with `-D bare_trait_object`
4+
5+
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
6+
|
7+
= note: requested on the command line with `-D bare_trait_object`
8+
9+
warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
10+
|
11+
= note: requested on the command line with `-D bare_trait_object`
12+
13+
error: unused variable: `unused`
14+
--> $DIR/lint-renamed-cmdline-deny.rs:8:17
15+
|
16+
LL | fn main() { let unused = (); }
17+
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_unused`
18+
|
19+
note: the lint level is defined here
20+
--> $DIR/lint-renamed-cmdline-deny.rs:7:8
21+
|
22+
LL | #[deny(unused)]
23+
| ^^^^^^
24+
= note: `#[deny(unused_variables)]` implied by `#[deny(unused)]`
25+
26+
error: aborting due to previous error; 3 warnings emitted
27+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// compile-flags:-A unknown-lints -D bogus -D dead_cod
2+
3+
fn main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0602]: unknown lint: `bogus`
2+
|
3+
= note: requested on the command line with `-D bogus`
4+
5+
error[E0602]: unknown lint: `dead_cod`
6+
|
7+
= help: did you mean: `dead_code`
8+
= note: requested on the command line with `-D dead_cod`
9+
10+
error[E0602]: unknown lint: `bogus`
11+
|
12+
= note: requested on the command line with `-D bogus`
13+
14+
error[E0602]: unknown lint: `dead_cod`
15+
|
16+
= help: did you mean: `dead_code`
17+
= note: requested on the command line with `-D dead_cod`
18+
19+
error: aborting due to 4 previous errors
20+
21+
For more information about this error, try `rustc --explain E0602`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// compile-flags:-D unknown-lints -D bogus -D dead_cod
2+
3+
// error-pattern:unknown lint: `bogus`
4+
// error-pattern:requested on the command line with `-D bogus`
5+
// error-pattern:requested on the command line with `-D dead_cod`
6+
// error-pattern:did you mean: `dead_code`
7+
8+
fn main() { }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0602]: unknown lint: `bogus`
2+
|
3+
= note: requested on the command line with `-D bogus`
4+
5+
error[E0602]: unknown lint: `dead_cod`
6+
|
7+
= help: did you mean: `dead_code`
8+
= note: requested on the command line with `-D dead_cod`
9+
10+
error[E0602]: unknown lint: `bogus`
11+
|
12+
= note: requested on the command line with `-D bogus`
13+
14+
error[E0602]: unknown lint: `dead_cod`
15+
|
16+
= help: did you mean: `dead_code`
17+
= note: requested on the command line with `-D dead_cod`
18+
19+
error: aborting due to 4 previous errors
20+
21+
For more information about this error, try `rustc --explain E0602`.

0 commit comments

Comments
 (0)