rust/tests/ui/parser/recover/recover-pat-lets.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
483 B
Rust
Raw Normal View History

2024-07-04 07:10:17 -05:00
fn main() {
let x = Some(2);
let x.expect("foo");
//~^ error: expected a pattern, found an expression
let x.unwrap(): u32;
//~^ error: expected a pattern, found an expression
let x[0] = 1;
//~^ error: expected a pattern, found an expression
let Some(1 + 1) = x else { //~ error: expected a pattern, found an expression
return;
};
if let Some(1 + 1) = x { //~ error: expected a pattern, found an expression
return;
}
}