-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
Description
Some examples:
fn main() {
S {..} = ();
|| { } = ();
break { } = ();
}
we get the following diagnostics in rustc
error[E0070]: invalid left-hand side of assignment
--> src/main.rs:4:13
|
4 | || { } = ();
| ---- ^
| |
| cannot assign to this expression
error[E0070]: invalid left-hand side of assignment
--> src/main.rs:5:16
|
5 | break { } = ();
| ---- ^
| |
| cannot assign to this expression
which clearly show that these are expression statements containing a binary expression each, yet in r-a the second one is considered a statement containing a closure expression and the third a statement containing a break expresson (with a nested binary expression inside each). This is very much wrong and most likely causes issue in other places as well.
Meanwhile in fn func() { let Some(_) = || {Some(1)} else { panic!("h") };}
we should error with error: right curly brace
}before
elsein a
let...else statement not allowed
yet we accept this just fine.
#16289 might be related to this.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity