-
Notifications
You must be signed in to change notification settings - Fork 550
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed modifying closure mutable params
- Loading branch information
1 parent
872a69f
commit 122cfdf
Showing
5 changed files
with
56 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,17 @@ | ||
fn call_with<F, +Drop<F>, +core::ops::Fn<F, (A,)>[Output: usize]>(func: F) -> usize { | ||
func(A { inner: array![] }) | ||
} | ||
|
||
|
||
#[derive(Drop)] | ||
struct A { | ||
inner: Array<usize>, | ||
} | ||
|
||
fn main() { | ||
let aclosure = |mut a: A| { | ||
a.inner.append(3); | ||
*a.inner[0] | ||
}; | ||
call_with(aclosure); | ||
} |
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