Identify subpatterns by the path to them instead of spans
This commit is contained in:
parent
0162d603b3
commit
307a278d5c
6 changed files with 253 additions and 133 deletions
|
|
@ -103,8 +103,8 @@ fn main() {
|
|||
}
|
||||
macro_rules! t_or_f {
|
||||
() => {
|
||||
(true // FIXME: should be unreachable
|
||||
| false)
|
||||
(true //~ ERROR unreachable
|
||||
| false)
|
||||
};
|
||||
}
|
||||
match (true, None) {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,17 @@ error: unreachable pattern
|
|||
LL | (true | false, None | Some(true
|
||||
| ^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:106:14
|
||||
|
|
||||
LL | (true
|
||||
| ^^^^
|
||||
...
|
||||
LL | (true | false, None | Some(t_or_f!())) => {}
|
||||
| --------- in this macro invocation
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/exhaustiveness-unreachable-pattern.rs:117:14
|
||||
|
|
||||
|
|
@ -155,5 +166,5 @@ error: unreachable pattern
|
|||
LL | | true,
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to 25 previous errors
|
||||
error: aborting due to 26 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// check-pass
|
||||
#![deny(unreachable_patterns)]
|
||||
//~^ NOTE: lint level is defined here
|
||||
pub enum TypeCtor {
|
||||
Slice,
|
||||
Array,
|
||||
|
|
@ -9,13 +9,13 @@ pub struct ApplicationTy(TypeCtor);
|
|||
|
||||
macro_rules! ty_app {
|
||||
($ctor:pat) => {
|
||||
ApplicationTy($ctor) //~ ERROR unreachable pattern
|
||||
ApplicationTy($ctor)
|
||||
};
|
||||
}
|
||||
|
||||
fn _foo(ty: ApplicationTy) {
|
||||
match ty {
|
||||
ty_app!(TypeCtor::Array) | ty_app!(TypeCtor::Slice) => {} //~ NOTE: in this expansion
|
||||
ty_app!(TypeCtor::Array) | ty_app!(TypeCtor::Slice) => {}
|
||||
}
|
||||
|
||||
// same as above, with the macro expanded
|
||||
|
|
|
|||
|
|
@ -1,18 +0,0 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/issue-80501-or-pat-and-macro.rs:12:9
|
||||
|
|
||||
LL | ApplicationTy($ctor)
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
LL | ty_app!(TypeCtor::Array) | ty_app!(TypeCtor::Slice) => {}
|
||||
| ------------------------ in this macro invocation
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/issue-80501-or-pat-and-macro.rs:1:9
|
||||
|
|
||||
LL | #![deny(unreachable_patterns)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue