-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Labels
Description
- Fixing this issue, help [E0070] invalid left-hand side of assignment #2390 to emit more user friendly error code and error emission similiar to rustc.
- You can view the same on
compiler-explorer
I tried code:
#![allow(unused)]
const SOME_CONST: i32 = 12;
fn some_function() {
SOME_CONST = 15; // error: a constant value cannot be changed!
}
fn main(){
some_function();
}
I expected to see this happen:
- Emit error message, similiar to rustc .i.e.,
invalid left-hand side of assignment
- Error message emitted by rustc:
error[E0070]: invalid left-hand side of assignment
--> <source>:6:16
|
6 | SOME_CONST = 15; // error: a constant value cannot be changed!
| ---------- ^
| |
| cannot assign to this expression
error: aborting due to previous error
For more information about this error, try `rustc --explain E0070`.
Compiler returned: 1
Instead, this happened:
- COmpiled Successfully.
- This is the output of gccrs:
Compiler returned: 0
Meta
- What version of Rust GCC were you using, git sha b9566fd.
- gccrs (Compiler-Explorer-Build-gcc-2f91d511200bf85558c9013b09a458c06edd1e02-binutils-2.40) 13.0.1 20230417 (experimental)