-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue with generic parameters that are marked
mut
(#865)
- Loading branch information
Showing
6 changed files
with
99 additions
and
57 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
3 changes: 2 additions & 1 deletion
3
...c/snapshots/fe_compiler_tests_legacy__features__execution_tests@generic_functions.fe.snap
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
source: crates/tests-legacy/src/features.rs | ||
assertion_line: 2231 | ||
expression: "format!(\"{}\", harness.gas_reporter)" | ||
--- | ||
run_test([]) used 32 gas | ||
run_test([]) used 459 gas | ||
|
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,20 @@ | ||
Fixed an issue where generic parameters that were `mut` could not be satisfied at callsite. | ||
|
||
For instance, the following code would previously cause a compile error but now works as expected: | ||
|
||
```rust | ||
struct Runner { | ||
pub fn run<T: Computable>(self, mut _ val: T) -> u256 { | ||
return val.compute(val: 1000) | ||
} | ||
} | ||
|
||
contract Example { | ||
pub fn run_test(self) { | ||
let runner: Runner = Runner(); | ||
let mut mac: Mac = Mac(); | ||
|
||
assert runner.run(mac) == 1001 | ||
} | ||
} | ||
``` |