diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2021-02-19 17:00:31 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2021-02-19 17:00:31 -0800 |
| commit | f0637e4e185e8c3dda694004d1dfd31126ed1fbd (patch) | |
| tree | de8f1bd64394d24f136003f45252145a46eb055c /src/test | |
| parent | 8fe989dd768f5dfdb0fc90933f3f74fa4579fefd (diff) | |
| download | rust-f0637e4e185e8c3dda694004d1dfd31126ed1fbd.tar.gz rust-f0637e4e185e8c3dda694004d1dfd31126ed1fbd.zip | |
Lower condition of `if` expression before it's "then" block
Fix #82290, fix #82250.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/pattern/issue-82290.rs | 7 | ||||
| -rw-r--r-- | src/test/ui/pattern/issue-82290.stderr | 20 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/pattern/issue-82290.rs b/src/test/ui/pattern/issue-82290.rs new file mode 100644 index 00000000000..67f0274fe74 --- /dev/null +++ b/src/test/ui/pattern/issue-82290.rs @@ -0,0 +1,7 @@ +#![feature(let_chains)] //~ WARN the feature `let_chains` is incomplete + +fn main() { + if true && let x = 1 { //~ ERROR `let` expressions are not supported here + let _ = x; + } +} diff --git a/src/test/ui/pattern/issue-82290.stderr b/src/test/ui/pattern/issue-82290.stderr new file mode 100644 index 00000000000..65ef018dc97 --- /dev/null +++ b/src/test/ui/pattern/issue-82290.stderr @@ -0,0 +1,20 @@ +error: `let` expressions are not supported here + --> $DIR/issue-82290.rs:4:16 + | +LL | if true && let x = 1 { + | ^^^^^^^^^ + | + = note: only supported directly in conditions of `if`- and `while`-expressions + = note: as well as when nested within `&&` and parenthesis in those conditions + +warning: the feature `let_chains` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/issue-82290.rs:1:12 + | +LL | #![feature(let_chains)] + | ^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + = note: see issue #53667 <https://github.com/rust-lang/rust/issues/53667> for more information + +error: aborting due to previous error; 1 warning emitted + |
