Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid LHS Of Assignment #2391

Closed
MahadMuhammad opened this issue Jul 7, 2023 · 0 comments · Fixed by #2629
Closed

Invalid LHS Of Assignment #2391

MahadMuhammad opened this issue Jul 7, 2023 · 0 comments · Fixed by #2629
Assignees
Labels

Comments

@MahadMuhammad
Copy link
Contributor


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)

@philberty philberty self-assigned this Sep 17, 2023
philberty added a commit that referenced this issue Sep 17, 2023
…hecks

Fixes #2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
github-merge-queue bot pushed a commit that referenced this issue Sep 17, 2023
…hecks

Fixes #2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 15, 2023
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 21, 2023
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Nov 21, 2023
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 5, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 8, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 9, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 11, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 12, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 16, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 16, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 17, 2024
…hecks

Fixes Rust-GCC#2391

gcc/rust/ChangeLog:

	* Make-lang.in: fixup formatting
	* resolve/rust-ast-resolve-expr.cc (ResolveExpr::visit): remove old check
	* rust-session-manager.cc (Session::compile_crate): call new lint
	* resolve/rust-ast-verify-assignee.h: Removed.
	* checks/errors/rust-readonly-check.cc: New file.
	* checks/errors/rust-readonly-check.h: New file.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: update error message
	* rust/compile/issue-2391.rs: New test.

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants