Skip to content

Commit a06f284

Browse files
committed
Turn error into a warning
1 parent 3401ecb commit a06f284

9 files changed

+24
-12
lines changed

src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ fn check_matcher_core(sess: &ParseSess,
788788
} else {
789789
format!("`{}`", quoted_tt_to_string(tok))
790790
};
791-
let mut err = sess.span_diagnostic.struct_span_err(
791+
let mut err = sess.span_diagnostic.struct_span_warn(
792792
*sp,
793793
&format!(
794794
"`${name}:{frag}` is followed (through repetition) by \

src/test/ui/issues/issue-42755.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
macro_rules! foo {
1313
($($p:vis)*) => {}
14-
//~^ ERROR `$p:vis` is followed (through repetition) by itself, which is not allowed for `vis`
14+
//~^ WARN `$p:vis` is followed (through repetition) by itself, which is not allowed for `vis`
1515
//~| ERROR repetition matches empty token tree
1616
}
1717

src/test/ui/issues/issue-42755.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `$p:vis` is followed (through repetition) by itself, which is not allowed for `vis` fragments
1+
warning: `$p:vis` is followed (through repetition) by itself, which is not allowed for `vis` fragments
22
--> $DIR/issue-42755.rs:13:8
33
|
44
LL | ($($p:vis)*) => {}
@@ -16,5 +16,5 @@ error: repetition matches empty token tree
1616
LL | ($($p:vis)*) => {}
1717
| ^^^^^^^^
1818

19-
error: aborting due to 2 previous errors
19+
error: aborting due to previous error
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
macro_rules! foo {
22
($($a:expr)*) => {};
3-
//~^ ERROR `$a:expr` is followed (through repetition) by itself, which is not allowed for
3+
//~^ WARN `$a:expr` is followed (through repetition) by itself, which is not allowed for
44
}

src/test/ui/macros/incorrrect-repetition-2.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `$a:expr` is followed (through repetition) by itself, which is not allowed for `expr` fragments
1+
warning: `$a:expr` is followed (through repetition) by itself, which is not allowed for `expr` fragments
22
--> $DIR/incorrrect-repetition-2.rs:2:8
33
|
44
LL | ($($a:expr)*) => {};
@@ -14,6 +14,6 @@ error[E0601]: `main` function not found in crate `incorrrect_repetition_2`
1414
|
1515
= note: consider adding a `main` function to `$DIR/incorrrect-repetition-2.rs`
1616

17-
error: aborting due to 2 previous errors
17+
error: aborting due to previous error
1818

1919
For more information about this error, try `rustc --explain E0601`.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
macro_rules! sneaky {
22
($($i:ident $e:expr)*) => {}
3-
//~^ ERROR `$e:expr` is followed (through repetition) by `$i:ident`, which is not allowed for
3+
//~^ WARN `$e:expr` is followed (through repetition) by `$i:ident`, which is not allowed for
44
}
55

66
fn main() {
77
sneaky!(a b c d);
8+
let x: () = 1;
9+
//~^ ERROR
810
}

src/test/ui/macros/incorrrect-repetition.stderr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: `$e:expr` is followed (through repetition) by `$i:ident`, which is not allowed for `expr` fragments
1+
warning: `$e:expr` is followed (through repetition) by `$i:ident`, which is not allowed for `expr` fragments
22
--> $DIR/incorrrect-repetition.rs:2:17
33
|
44
LL | ($($i:ident $e:expr)*) => {}
@@ -12,5 +12,15 @@ help: add a valid separator for the repetition to be unambiguous, for example
1212
LL | ($($i:ident $e:expr);*) => {}
1313
| ^
1414

15+
error[E0308]: mismatched types
16+
--> $DIR/incorrrect-repetition.rs:8:17
17+
|
18+
LL | let x: () = 1;
19+
| ^ expected (), found integral variable
20+
|
21+
= note: expected type `()`
22+
found type `{integer}`
23+
1524
error: aborting due to previous error
1625

26+
For more information about this error, try `rustc --explain E0308`.

src/test/ui/macros/macro-input-future-proofing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ macro_rules! errors_everywhere {
2929
( $a:expr $($b:tt)* ) => { };
3030
//~^ ERROR `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
3131
( $($a:expr)* $($b:tt)* ) => { };
32-
//~^ ERROR `$a:expr` is followed (through repetition) by itself, which is not allowed for
32+
//~^ WARN `$a:expr` is followed (through repetition) by itself, which is not allowed for
3333
//~| ERROR `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
3434
( $($a:expr),* $($b:tt)* ) => { };
3535
//~^ ERROR `$a:expr` may be followed by `$b:tt`, which is not allowed for `expr` fragments

src/test/ui/macros/macro-input-future-proofing.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ LL | ( $a:expr $($b:tt)* ) => { };
7070
|
7171
= note: allowed there are: `;`, `=>` or `,`
7272

73-
error: `$a:expr` is followed (through repetition) by itself, which is not allowed for `expr` fragments
73+
warning: `$a:expr` is followed (through repetition) by itself, which is not allowed for `expr` fragments
7474
--> $DIR/macro-input-future-proofing.rs:31:9
7575
|
7676
LL | ( $($a:expr)* $($b:tt)* ) => { };
@@ -98,5 +98,5 @@ LL | ( $($a:expr),* $($b:tt)* ) => { };
9898
|
9999
= note: allowed there are: `;`, `=>` or `,`
100100

101-
error: aborting due to 12 previous errors
101+
error: aborting due to 11 previous errors
102102

0 commit comments

Comments
 (0)