-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Prevent mutating immutable bindings to mutable types (#3075)
- Loading branch information
1 parent
c3087bb
commit 19b05a3
Showing
3 changed files
with
57 additions
and
23 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
7 changes: 7 additions & 0 deletions
7
tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/Nargo.toml
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,7 @@ | ||
[package] | ||
name = "mutability_regression_2911" | ||
type = "bin" | ||
authors = [""] | ||
compiler_version = "0.9.0" | ||
|
||
[dependencies] |
5 changes: 5 additions & 0 deletions
5
tooling/nargo_cli/tests/compile_failure/mutability_regression_2911/src/main.nr
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,5 @@ | ||
// Expect 'Variable must be mutable to be assigned to' error | ||
fn main() { | ||
let slice : &mut [Field] = &mut []; | ||
slice = &mut (*slice).push_back(1); | ||
} |