333388fd3c
There was an incomplete version of the check in parsing and a second version in AST validation. This meant that some, but not all, invalid uses were allowed inside macros/disabled cfgs. It also means that later passes have a hard time knowing when the let expression is in a valid location, sometimes causing ICEs. - Add a field to ExprKind::Let in AST/HIR to mark whether it's in a valid location. - Suppress later errors and MIR construction for invalid let expressions.
21 lines
605 B
Plaintext
21 lines
605 B
Plaintext
error: expected expression, found `let` statement
|
|
--> $DIR/ast-validate-guards.rs:5:20
|
|
|
|
|
LL | Ok(opt) if let Some(4) = opt || false => {}
|
|
| ^^^^^^^^^^^^^^^^^
|
|
|
|
|
note: `||` operators are not supported in let chain expressions
|
|
--> $DIR/ast-validate-guards.rs:5:38
|
|
|
|
|
LL | Ok(opt) if let Some(4) = opt || false => {}
|
|
| ^^
|
|
|
|
error: module cannot be declared unsafe
|
|
--> $DIR/ast-validate-guards.rs:15:17
|
|
|
|
|
LL | unsafe mod a {};
|
|
| ^^^^^^
|
|
|
|
error: aborting due to 2 previous errors
|
|
|