mbe::transcribe: defatalize errors.
This commit is contained in:
parent
ad26401dc1
commit
df9cec2df4
9 changed files with 68 additions and 37 deletions
|
|
@ -1,9 +1,10 @@
|
|||
// Regression test for issue #61033.
|
||||
|
||||
macro_rules! test1 {
|
||||
($x:ident, $($tt:tt)*) => { $($tt)+ } //~ERROR this must repeat at least once
|
||||
($x:ident, $($tt:tt)*) => { $($tt)+ } //~ ERROR this must repeat at least once
|
||||
}
|
||||
|
||||
fn main() {
|
||||
test1!(x,);
|
||||
let _recovery_witness: () = 0; //~ ERROR mismatched types
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,14 @@ error: this must repeat at least once
|
|||
LL | ($x:ident, $($tt:tt)*) => { $($tt)+ }
|
||||
| ^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-61033-1.rs:9:33
|
||||
|
|
||||
LL | let _recovery_witness: () = 0;
|
||||
| -- ^ expected `()`, found integer
|
||||
| |
|
||||
| expected due to this
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ macro_rules! test2 {
|
|||
$(* $id1:ident)*
|
||||
$(+ $id2:ident)*
|
||||
) => {
|
||||
$( //~ERROR meta-variable `id1` repeats 2 times
|
||||
$(
|
||||
//~^ ERROR meta-variable `id1` repeats 2 times
|
||||
//~| ERROR meta-variable `id1` repeats 2 times
|
||||
$id1 + $id2 // $id1 and $id2 may repeat different numbers of times
|
||||
)*
|
||||
}
|
||||
|
|
@ -16,4 +18,8 @@ fn main() {
|
|||
* a * b
|
||||
+ a + b + c
|
||||
}
|
||||
test2! {
|
||||
* a * b
|
||||
+ a + b + c + d
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,22 @@ error: meta-variable `id1` repeats 2 times, but `id2` repeats 3 times
|
|||
|
|
||||
LL | $(
|
||||
| __________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | $id1 + $id2 // $id1 and $id2 may repeat different numbers of times
|
||||
LL | | )*
|
||||
| |_________^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: meta-variable `id1` repeats 2 times, but `id2` repeats 4 times
|
||||
--> $DIR/issue-61033-2.rs:8:10
|
||||
|
|
||||
LL | $(
|
||||
| __________^
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | $id1 + $id2 // $id1 and $id2 may repeat different numbers of times
|
||||
LL | | )*
|
||||
| |_________^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
macro_rules! mac {
|
||||
( $($v:tt)* ) => (
|
||||
$v //~ ERROR still repeating at this depth
|
||||
)
|
||||
( $($v:tt)* ) => {
|
||||
$v
|
||||
//~^ ERROR still repeating at this depth
|
||||
//~| ERROR still repeating at this depth
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {
|
||||
mac!(0);
|
||||
mac!(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,5 +4,11 @@ error: variable 'v' is still repeating at this depth
|
|||
LL | $v
|
||||
| ^^
|
||||
|
||||
error: aborting due to previous error
|
||||
error: variable 'v' is still repeating at this depth
|
||||
--> $DIR/macro-repeat.rs:3:9
|
||||
|
|
||||
LL | $v
|
||||
| ^^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue