Skip to content

Commit

Permalink
gccrs: [E0070] invalid left-hand side of assignment
Browse files Browse the repository at this point in the history
gcc/rust/ChangeLog:

	* resolve/rust-ast-verify-assignee.h: called error function.

gcc/testsuite/ChangeLog:

	* rust/compile/wrong_lhs_assignment.rs: New test.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
  • Loading branch information
MahadMuhammad authored and philberty committed Jul 9, 2023
1 parent f7a29f5 commit a06cec1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcc/rust/resolve/rust-ast-verify-assignee.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class VerifyAsignee : public ResolverBase
VerifyAsignee checker;
assignee->accept_vis (checker);
if (!checker.ok)
rust_error_at (assignee->get_locus (),
rust_error_at (assignee->get_locus (), ErrorCode ("E0070"),
"invalid left-hand side of assignment");
return checker.ok;
}
Expand Down
7 changes: 7 additions & 0 deletions gcc/testsuite/rust/compile/wrong_lhs_assignment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fn foo() {
1 = 3; // { dg-error "invalid left-hand side of assignment" }
}

fn main() {
foo();
}

0 comments on commit a06cec1

Please sign in to comment.