Fix ICE for broken or-pattern in async fn
This commit is contained in:
parent
a0e52b1e82
commit
4dd47d3b78
6 changed files with 102 additions and 19 deletions
16
src/test/ui/or-patterns/mismatched-bindings-async-fn.rs
Normal file
16
src/test/ui/or-patterns/mismatched-bindings-async-fn.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
// Regression test for #71297
|
||||
// edition:2018
|
||||
|
||||
#![feature(or_patterns)]
|
||||
|
||||
async fn a((x | s): String) {}
|
||||
//~^ ERROR variable `x` is not bound in all patterns
|
||||
//~| ERROR variable `s` is not bound in all patterns
|
||||
|
||||
async fn b() {
|
||||
let x | s = String::new();
|
||||
//~^ ERROR variable `x` is not bound in all patterns
|
||||
//~| ERROR variable `s` is not bound in all patterns
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
35
src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr
Normal file
35
src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
error[E0408]: variable `x` is not bound in all patterns
|
||||
--> $DIR/mismatched-bindings-async-fn.rs:6:17
|
||||
|
|
||||
LL | async fn a((x | s): String) {}
|
||||
| - ^ pattern doesn't bind `x`
|
||||
| |
|
||||
| variable not in all patterns
|
||||
|
||||
error[E0408]: variable `s` is not bound in all patterns
|
||||
--> $DIR/mismatched-bindings-async-fn.rs:6:13
|
||||
|
|
||||
LL | async fn a((x | s): String) {}
|
||||
| ^ - variable not in all patterns
|
||||
| |
|
||||
| pattern doesn't bind `s`
|
||||
|
||||
error[E0408]: variable `x` is not bound in all patterns
|
||||
--> $DIR/mismatched-bindings-async-fn.rs:11:13
|
||||
|
|
||||
LL | let x | s = String::new();
|
||||
| - ^ pattern doesn't bind `x`
|
||||
| |
|
||||
| variable not in all patterns
|
||||
|
||||
error[E0408]: variable `s` is not bound in all patterns
|
||||
--> $DIR/mismatched-bindings-async-fn.rs:11:9
|
||||
|
|
||||
LL | let x | s = String::new();
|
||||
| ^ - variable not in all patterns
|
||||
| |
|
||||
| pattern doesn't bind `s`
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0408`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue