add move expression parser ambiguity tests

This commit is contained in:
Takayuki Maeda
2026-05-07 22:23:38 +09:00
parent cf937b8da2
commit aac8bd23bb
3 changed files with 41 additions and 0 deletions
@@ -0,0 +1,14 @@
#![allow(incomplete_features)]
#![feature(move_expr)]
fn main() {
let x: bool = true;
let y: bool = true;
let _ = move(x) || y;
//~^ ERROR `move(expr)` is only supported in plain closures
let x: bool = true;
let y: bool = true;
let _ = move[x] || y;
//~^ ERROR expected one of
}
@@ -0,0 +1,14 @@
error: expected one of `async`, `|`, or `||`, found `[`
--> $DIR/parse-ambiguity-errors.rs:12:17
|
LL | let _ = move[x] || y;
| ^ expected one of `async`, `|`, or `||`
error: `move(expr)` is only supported in plain closures
--> $DIR/parse-ambiguity-errors.rs:7:13
|
LL | let _ = move(x) || y;
| ^^^^
error: aborting due to 2 previous errors
+13
View File
@@ -0,0 +1,13 @@
//@ check-pass
#![allow(incomplete_features)]
#![feature(move_expr)]
fn main() {
let x: bool = true;
let y: bool = true;
let _ = || move(x) || y;
let x: bool = true;
let y: bool = true;
let _ = move || move(x) || y;
}