-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor async fn return type lowering #59286
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,32 +1,20 @@ | ||
error[E0709]: multiple different lifetimes used in arguments of `async fn` | ||
--> $DIR/async-fn-multiple-lifetimes.rs:7:47 | ||
error: ambiguous lifetime bound in `async fn` | ||
--> $DIR/async-fn-multiple-lifetimes.rs:7:65 | ||
| | ||
LL | async fn multiple_named_lifetimes<'a, 'b>(_: &'a u8, _: &'b u8) {} | ||
| ^^ ^^ different lifetime here | ||
| | | ||
| first lifetime here | ||
| ^ neither `'a` nor `'b` outlives the other | ||
| | ||
= help: `async fn` can only accept borrowed values with identical lifetimes | ||
= note: multiple unrelated lifetimes are not allowed in `async fn`. | ||
= note: if you're using argument-position elided lifetimes, consider switching to a single named lifetime. | ||
|
||
error[E0707]: multiple elided lifetimes used in arguments of `async fn` | ||
--> $DIR/async-fn-multiple-lifetimes.rs:16:39 | ||
error: ambiguous lifetime bound in `async fn` | ||
--> $DIR/async-fn-multiple-lifetimes.rs:16:52 | ||
| | ||
LL | async fn multiple_elided_lifetimes(_: &u8, _: &u8) {} | ||
| ^ ^ different lifetime here | ||
| | | ||
| first lifetime here | ||
| ^ the elided lifetimes here do not outlive one another | ||
| | ||
= help: consider giving these arguments named lifetimes | ||
= note: multiple unrelated lifetimes are not allowed in `async fn`. | ||
= note: if you're using argument-position elided lifetimes, consider switching to a single named lifetime. | ||
|
||
error[E0106]: missing lifetime specifier | ||
--> $DIR/async-fn-multiple-lifetimes.rs:16:39 | ||
| | ||
LL | async fn multiple_elided_lifetimes(_: &u8, _: &u8) {} | ||
| ^ expected lifetime parameter | ||
| | ||
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `_` | ||
|
||
error: aborting due to 3 previous errors | ||
error: aborting due to 2 previous errors | ||
|
||
Some errors occurred: E0106, E0707, E0709. | ||
For more information about an error, try `rustc --explain E0106`. |
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,16 @@ | ||
// compile-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await, await_macro, futures_api)] | ||
|
||
use std::sync::Arc; | ||
|
||
trait SomeTrait: Send + Sync + 'static { | ||
fn do_something(&self); | ||
} | ||
|
||
async fn my_task(obj: Arc<SomeTrait>) { | ||
unimplemented!() | ||
} | ||
|
||
fn main() {} |
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,14 @@ | ||
// compile-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await, await_macro, futures_api)] | ||
|
||
use std::future::Future; | ||
|
||
#[allow(unused)] | ||
async fn foo<F: Future<Output = i32>>(x: &i32, future: F) -> i32 { | ||
let y = await!(future); | ||
*x + y | ||
} | ||
|
||
fn main() {} |
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,21 @@ | ||
// compile-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await, await_macro, futures_api)] | ||
|
||
struct Xyz { | ||
a: u64, | ||
} | ||
|
||
trait Foo {} | ||
|
||
impl Xyz { | ||
async fn do_sth<'a>( | ||
&'a self, foo: &'a dyn Foo | ||
) -> bool | ||
{ | ||
true | ||
} | ||
} | ||
|
||
fn main() {} |
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 @@ | ||
// compile-pass | ||
// edition:2018 | ||
|
||
#![feature(async_await, await_macro, futures_api)] | ||
|
||
use std::future::Future; | ||
|
||
#[allow(unused)] | ||
async fn enter<'a, F, R>(mut callback: F) | ||
where | ||
F: FnMut(&'a mut i32) -> R, | ||
R: Future<Output = ()> + 'a, | ||
{ | ||
unimplemented!() | ||
} | ||
|
||
fn main() {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this one still errors as discussed in the PR description.