diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2020-04-19 18:17:31 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2020-04-19 18:17:31 +0100 |
| commit | 4dd47d3b78a2b6f45dd382ac58fb182e40293ca3 (patch) | |
| tree | ed8d8003fad5b785a7491440cd52aef32b624db1 /src/test | |
| parent | a0e52b1e82472e4890202082a0482b178f9d6a16 (diff) | |
Fix ICE for broken or-pattern in async fn
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/or-patterns/mismatched-bindings-async-fn.rs | 16 | ||||
| -rw-r--r-- | src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr | 35 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs b/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs new file mode 100644 index 00000000000..5c5c68f81d1 --- /dev/null +++ b/src/test/ui/or-patterns/mismatched-bindings-async-fn.rs @@ -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() {} diff --git a/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr b/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr new file mode 100644 index 00000000000..b9c74266411 --- /dev/null +++ b/src/test/ui/or-patterns/mismatched-bindings-async-fn.stderr @@ -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`. |
