-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account for an additional reborrow inserted by UniqueImmBorrow and Mu…
…tBorrow
- Loading branch information
1 parent
49c4ebc
commit ad0fcac
Showing
2 changed files
with
35 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
//@ aux-build:block-on.rs | ||
//@ run-pass | ||
//@ check-run-results | ||
//@ revisions: e2021 e2018 | ||
//@[e2018] edition:2018 | ||
//@[e2021] edition:2021 | ||
|
||
#![feature(async_closure)] | ||
|
||
extern crate block_on; | ||
|
||
async fn call_once(f: impl async FnOnce()) { f().await; } | ||
|
||
pub async fn async_closure(x: &mut i32) { | ||
let c = async move || { | ||
*x += 1; | ||
}; | ||
call_once(c).await; | ||
} | ||
|
||
fn main() { | ||
block_on::block_on(async { | ||
let mut x = 0; | ||
async_closure(&mut x).await; | ||
assert_eq!(x, 1); | ||
}); | ||
} |