-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gccrs: feat: Made changes to ensure no wrong assignments are done.
gcc/rust/ChangeLog: * backend/rust-compile-base.cc (HIRCompileBase::is_lvalue): Created a function that checks for lvalue. * backend/rust-compile-base.h: Created the Signature for above function. * backend/rust-compile-expr.cc (CompileExpr::visit): Made changes to ensure proper readability and checking for wrong assignments in AssignmentExpr and CompoundAssignmentExpr Respectively. gcc/testsuite/ChangeLog: * rust/compile/issue-3297.rs: New test (New Feature). * rust/compile/issue-3297-2.rs: New test (Regression). * rust/compile/issue-3297-3.rs: New test (New Feature). Signed-off-by: Sri Ganesh Thota <[email protected]>
- Loading branch information
1 parent
55a9d8d
commit 4133278
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub fn main() { | ||
let mut x = 42; | ||
x += 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub fn main() { | ||
let mut x = 42; | ||
x + 1 += 1; // { dg-error "invalid left-hand side of assignment" } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pub fn main() { | ||
let mut x = 42; | ||
x + 1= 2; // { dg-error "invalid left-hand side of assignment" } | ||
} |