Skip to content

Commit d60df53

Browse files
committed
Add tests for modifying lint levels for lints reported at expansion time
1 parent 217a745 commit d60df53

File tree

3 files changed

+83
-0
lines changed

3 files changed

+83
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// ignore-test auxiliary file for expansion-time.rs
2+
3+
1
4+
2

src/test/ui/lint/expansion-time.rs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// check-pass
2+
3+
#[warn(meta_variable_misuse)]
4+
macro_rules! foo {
5+
( $($i:ident)* ) => { $($i)+ }; //~ WARN meta-variable repeats with different Kleene operator
6+
}
7+
8+
#[warn(missing_fragment_specifier)]
9+
macro_rules! m { ($i) => {} } //~ WARN missing fragment specifier
10+
//~| WARN this was previously accepted
11+
12+
#[warn(soft_unstable)]
13+
mod benches {
14+
#[bench] //~ WARN use of unstable library feature 'test'
15+
//~| WARN this was previously accepted
16+
fn foo() {}
17+
}
18+
19+
#[warn(incomplete_include)]
20+
fn main() {
21+
// WARN see in the stderr file, the warning points to the included file.
22+
include!("expansion-time-include.rs");
23+
}
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
warning: meta-variable repeats with different Kleene operator
2+
--> $DIR/expansion-time.rs:5:29
3+
|
4+
LL | ( $($i:ident)* ) => { $($i)+ };
5+
| - ^^ - conflicting repetition
6+
| |
7+
| expected repetition
8+
|
9+
note: the lint level is defined here
10+
--> $DIR/expansion-time.rs:3:8
11+
|
12+
LL | #[warn(meta_variable_misuse)]
13+
| ^^^^^^^^^^^^^^^^^^^^
14+
15+
warning: missing fragment specifier
16+
--> $DIR/expansion-time.rs:9:19
17+
|
18+
LL | macro_rules! m { ($i) => {} }
19+
| ^^
20+
|
21+
note: the lint level is defined here
22+
--> $DIR/expansion-time.rs:8:8
23+
|
24+
LL | #[warn(missing_fragment_specifier)]
25+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
27+
= note: for more information, see issue #40107 <https://github.com/rust-lang/rust/issues/40107>
28+
29+
warning: use of unstable library feature 'test': `bench` is a part of custom test frameworks which are unstable
30+
--> $DIR/expansion-time.rs:14:7
31+
|
32+
LL | #[bench]
33+
| ^^^^^
34+
|
35+
note: the lint level is defined here
36+
--> $DIR/expansion-time.rs:12:8
37+
|
38+
LL | #[warn(soft_unstable)]
39+
| ^^^^^^^^^^^^^
40+
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
41+
= note: for more information, see issue #64266 <https://github.com/rust-lang/rust/issues/64266>
42+
43+
warning: include macro expected single expression in source
44+
--> $DIR/expansion-time-include.rs:4:1
45+
|
46+
LL | 2
47+
| ^
48+
|
49+
note: the lint level is defined here
50+
--> $DIR/expansion-time.rs:19:8
51+
|
52+
LL | #[warn(incomplete_include)]
53+
| ^^^^^^^^^^^^^^^^^^
54+
55+
warning: 4 warnings emitted
56+

0 commit comments

Comments
 (0)