-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't manually resolve async closures in rustc_resolve
- Loading branch information
1 parent
cd6d8f2
commit 8c2ae80
Showing
3 changed files
with
29 additions
and
29 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,12 @@ | ||
// edition:2021 | ||
|
||
#![feature(async_closure)] | ||
|
||
fn main() { | ||
let x = async move |x: &str| { | ||
//~^ ERROR lifetime may not live long enough | ||
// This error is proof that the `&str` type is higher-ranked. | ||
// This won't work until async closures are fully impl'd. | ||
println!("{x}"); | ||
}; | ||
} |
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 @@ | ||
error: lifetime may not live long enough | ||
--> $DIR/higher-ranked.rs:6:34 | ||
| | ||
LL | let x = async move |x: &str| { | ||
| ____________________________-___-_^ | ||
| | | | | ||
| | | return type of closure `{async closure body@$DIR/higher-ranked.rs:6:34: 11:6}` contains a lifetime `'2` | ||
| | let's call the lifetime of this reference `'1` | ||
LL | | | ||
LL | | // This error is proof that the `&str` type is higher-ranked. | ||
LL | | // This won't work until async closures are fully impl'd. | ||
LL | | println!("{x}"); | ||
LL | | }; | ||
| |_____^ returning this value requires that `'1` must outlive `'2` | ||
|
||
error: aborting due to 1 previous error | ||
|