mirror of
https://github.com/rust-lang/rust.git
synced 2026-08-09 16:20:17 -04:00
add move expression parser ambiguity tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user