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

[E0070] invalid left-hand side of assignment #2390

Merged
merged 1 commit into from
Jul 9, 2023

Conversation

MahadMuhammad
Copy link
Contributor

E0070 invalid left-hand side of assignment

  • Added error code support for an assignment operator which was used on a non-place expression.

Code Tested:

fn foo() {
    1 = 3; // { dg-error "invalid left-hand side of assignment" }
}

fn main() {
    foo();
}

Output:

gccrs/gcc/testsuite/rust/compile/wrong_lhs_assignment.rs:4:5: error: invalid left-hand side of assignment [E0070]
compiler exited with status 1
PASS: rust/compile/wrong_lhs_assignment.rs  (test for errors, line 4)

gcc/rust/ChangeLog:

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

gcc/testsuite/ChangeLog:

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

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>
Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@CohenArthur CohenArthur added the diagnostic diagnostic static analysis label Jul 7, 2023
@philberty philberty added this to the GCC 14 Stage 3 milestone Jul 9, 2023
Copy link
Member

@philberty philberty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM not sure this rust-ast-verify-assignee.h will be kept around like this there is code in GCC we can reuse to get this so it might change in the future.

@philberty philberty added this pull request to the merge queue Jul 9, 2023
Merged via the queue into Rust-GCC:master with commit a06cec1 Jul 9, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic diagnostic static analysis
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants