-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Labels
diagnosticdiagnostic static analysisdiagnostic static analysis
Description
Summary
gccrs does not check if something is assignable, and gccrs accepts many un-assignable expressions.
Reproducer
I tried this code:
fn main() -> i32 {
let mut x = 42;
x + 1 = 2;
x
}
Does the code make use of any (1.49) nightly feature ?
- Nightly
Godbolt link
No response
Actual behavior
The current behavior is that gccrs accepts this kind of semantically invalid code and even successfully generates machine code for them (in this case, gccrs generates code to make the function return 42
).
Expected behavior
I expected to see an error thrown like rustc
does:
error[E0070]: invalid left-hand side of assignment
--> test1.rs:3:11
|
3 | x + 1 = 2;
| ----- ^
| |
| cannot assign to this expression
GCC Version
Metadata
Metadata
Assignees
Labels
diagnosticdiagnostic static analysisdiagnostic static analysis
Type
Projects
Status
Todo