Update error annotations positions

Since 8ec9d7242c, in the case of a local
macro expansion, the errors are now matched to macro definition
location. Update test cases accordingly.
This commit is contained in:
Tomasz Miąsko 2019-10-24 00:00:00 +00:00
parent 23ada9495f
commit f6c2c4dc43
4 changed files with 13 additions and 9 deletions

View file

@ -4,6 +4,8 @@ fn macros() {
macro_rules! foo{
($p:pat, $e:expr, $b:block) => {{
if let $p = $e $b
//~^ WARN irrefutable if-let
//~| WARN irrefutable if-let
}}
}
macro_rules! bar{
@ -12,10 +14,10 @@ fn macros() {
}}
}
foo!(a, 1, { //~ WARN irrefutable if-let
foo!(a, 1, {
println!("irrefutable pattern");
});
bar!(a, 1, { //~ WARN irrefutable if-let
bar!(a, 1, {
println!("irrefutable pattern");
});
}

View file

@ -23,7 +23,7 @@ LL | | });
| |_______- in this macro invocation
warning: irrefutable if-let pattern
--> $DIR/if-let.rs:24:5
--> $DIR/if-let.rs:26:5
|
LL | / if let a = 1 {
LL | | println!("irrefutable pattern");
@ -31,7 +31,7 @@ LL | | }
| |_____^
warning: irrefutable if-let pattern
--> $DIR/if-let.rs:28:5
--> $DIR/if-let.rs:30:5
|
LL | / if let a = 1 {
LL | | println!("irrefutable pattern");
@ -43,7 +43,7 @@ LL | | }
| |_____^
warning: irrefutable if-let pattern
--> $DIR/if-let.rs:38:12
--> $DIR/if-let.rs:40:12
|
LL | } else if let a = 1 {
| ____________^
@ -52,7 +52,7 @@ LL | | }
| |_____^
warning: irrefutable if-let pattern
--> $DIR/if-let.rs:44:12
--> $DIR/if-let.rs:46:12
|
LL | } else if let a = 1 {
| ____________^

View file

@ -5,6 +5,8 @@ fn macros() {
macro_rules! foo{
($p:pat, $e:expr, $b:block) => {{
while let $p = $e $b
//~^ WARN irrefutable while-let
//~| WARN irrefutable while-let
}}
}
macro_rules! bar{
@ -13,10 +15,10 @@ fn macros() {
}}
}
foo!(_a, 1, { //~ WARN irrefutable while-let
foo!(_a, 1, {
println!("irrefutable pattern");
});
bar!(_a, 1, { //~ WARN irrefutable while-let
bar!(_a, 1, {
println!("irrefutable pattern");
});
}

View file

@ -23,7 +23,7 @@ LL | | });
| |_______- in this macro invocation
warning: irrefutable while-let pattern
--> $DIR/while-let.rs:25:5
--> $DIR/while-let.rs:27:5
|
LL | / while let _a = 1 {
LL | | println!("irrefutable pattern");