forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#64292 - davidtwco:issue-63832-await-tempora…
…ry-lifetimes, r=matthewjasper lowering: extend temporary lifetimes around await Fixes rust-lang#63832. r? @matthewjasper cc @nikomatsakis
- Loading branch information
Showing
4 changed files
with
58 additions
and
32 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
19 changes: 19 additions & 0 deletions
19
src/test/ui/async-await/issue-63832-await-short-temporary-lifetime-1.rs
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,19 @@ | ||
// check-pass | ||
// edition:2018 | ||
|
||
struct Test(String); | ||
|
||
impl Test { | ||
async fn borrow_async(&self) {} | ||
|
||
fn with(&mut self, s: &str) -> &mut Self { | ||
self.0 = s.into(); | ||
self | ||
} | ||
} | ||
|
||
async fn test() { | ||
Test("".to_string()).with("123").borrow_async().await; | ||
} | ||
|
||
fn main() { } |
12 changes: 12 additions & 0 deletions
12
src/test/ui/async-await/issue-63832-await-short-temporary-lifetime.rs
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,12 @@ | ||
// check-pass | ||
// edition:2018 | ||
|
||
async fn foo(x: &[Vec<u32>]) -> u32 { | ||
0 | ||
} | ||
|
||
async fn bar() { | ||
foo(&[vec![123]]).await; | ||
} | ||
|
||
fn main() { } |