745c1ea438
``` error: expected one of `,`, `:`, or `}`, found `.` --> $DIR/missing-fat-arrow.rs:25:14 | LL | Some(a) if a.value == b { | - while parsing this struct LL | a.value = 1; | -^ expected one of `,`, `:`, or `}` | | | while parsing this struct field | help: try naming a field | LL | a: a.value = 1; | ++ help: you might have meant to start a match arm after the match guard | LL | Some(a) if a.value == b => { | ++ ``` Fix #78585.
42 lines
872 B
Rust
42 lines
872 B
Rust
fn main() {
|
|
let x = 1;
|
|
let y = 2;
|
|
let value = 3;
|
|
|
|
match value {
|
|
Some(x) if x == y {
|
|
self.next_token()?; //~ ERROR expected identifier, found keyword `self`
|
|
Ok(true)
|
|
},
|
|
_ => {
|
|
Ok(false)
|
|
}
|
|
}
|
|
let _: i32 = (); //~ ERROR mismatched types
|
|
}
|
|
|
|
struct Foo {
|
|
value: usize
|
|
}
|
|
|
|
fn foo(a: Option<&mut Foo>, b: usize) {
|
|
match a {
|
|
Some(a) if a.value == b {
|
|
a.value = 1; //~ ERROR expected one of `,`, `:`, or `}`, found `.`
|
|
},
|
|
_ => {}
|
|
}
|
|
let _: i32 = (); //~ ERROR mismatched types
|
|
}
|
|
|
|
fn bar(a: Option<&mut Foo>, b: usize) {
|
|
match a {
|
|
Some(a) if a.value == b {
|
|
a.value, //~ ERROR expected one of `,`, `:`, or `}`, found `.`
|
|
} => {
|
|
}
|
|
_ => {}
|
|
}
|
|
let _: i32 = (); //~ ERROR mismatched types
|
|
}
|