gccrs: port over readonly_error from c-family for lvalue assignment checks
commite47a980566050a290e1fbf9fb4792065ea772a47
authorPhilip Herron <herron.philip@googlemail.com>
Sun, 17 Sep 2023 19:11:23 +0000 (17 20:11 +0100)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:04:37 +0000 (16 19:04 +0100)
tree3ef43e89a2592692ac89240d0f108f89cb5c1100
parent718b65a93d194a97a88f96780b97023ce9ed9378
gccrs: port over readonly_error from c-family for lvalue assignment checks

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>
gcc/rust/Make-lang.in
gcc/rust/checks/errors/rust-readonly-check.cc [new file with mode: 0644]
gcc/rust/checks/errors/rust-readonly-check.h [new file with mode: 0644]
gcc/rust/resolve/rust-ast-resolve-expr.cc
gcc/rust/resolve/rust-ast-verify-assignee.h [deleted file]
gcc/rust/rust-session-manager.cc
gcc/testsuite/rust/compile/issue-2391.rs [new file with mode: 0644]
gcc/testsuite/rust/compile/wrong_lhs_assignment.rs