-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Conversation
@@ -96,14 +101,19 @@ fn async_fn_with_impl_future_named_lifetime<'a>(x: &'a u8) -> impl Future<Output | |||
} | |||
} | |||
|
|||
async fn async_fn_with_named_lifetime_multiple_args<'a>(x: &'a u8, _y: &'a u8) -> u8 { | |||
async fn async_fn_multiple_args(x: &u8, _y: &u8) -> u8 { |
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.
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
ccf0bcb
to
37e2f8c
Compare
I've pushed an improved error message and some tests. I'd like to go ahead and land this since it fixes the below issues: Fix #59001 Finishing that last will require a separate change to fix |
37e2f8c
to
5044c3e
Compare
I can take this. I'll try to review fully soon. r? @varkor |
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.
Functionally, everything looks good to me. I just have some minor nits about diagnostics and formatting.
r=me after fixing.
☔ The latest upstream changes (presumably #59478) made this pull request unmergeable. Please resolve the merge conflicts. |
async fn now lowers directly to an existential type declaration rather than reusing the `impl Trait` return type lowering. As part of this, it lowers all argument-position elided lifetimes using the in-band-lifetimes machinery, creating fresh parameter names for each of them, using each lifetime parameter as a generic argument to the generated existential type. This doesn't currently successfully allow multiple argument-position elided lifetimes since `existential type` doesn't yet support multiple lifetimes where neither outlive the other. This requires a separate fix.
5044c3e
to
749349f
Compare
@bors r=varkor |
📌 Commit 749349f has been approved by |
Refactor async fn return type lowering async fn now lowers directly to an existential type declaration rather than reusing the `impl Trait` return type lowering. As part of this, it lowers all argument-position elided lifetimes using the in-band-lifetimes machinery, creating fresh parameter names for each of them, using each lifetime parameter as a generic argument to the generated existential type. This doesn't currently successfully allow multiple argument-position elided lifetimes since `existential type` doesn't yet support multiple lifetimes where neither outlive the other: ```rust existential type Foo<'a, 'b>:; // error: ambiguous lifetime bound in `impl Trait` fn foo<'a, 'b>(_: &'a u8, _: &'b u8) -> Foo<'a, 'b> { () } ``` This requires a separate fix. Fix #59001 Fix #58885 Fix #55324 Fix #54974 Progress on #56238 r? @nikomatsakis
💔 Test failed - checks-travis |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@bors retry |
Refactor async fn return type lowering async fn now lowers directly to an existential type declaration rather than reusing the `impl Trait` return type lowering. As part of this, it lowers all argument-position elided lifetimes using the in-band-lifetimes machinery, creating fresh parameter names for each of them, using each lifetime parameter as a generic argument to the generated existential type. This doesn't currently successfully allow multiple argument-position elided lifetimes since `existential type` doesn't yet support multiple lifetimes where neither outlive the other: ```rust existential type Foo<'a, 'b>:; // error: ambiguous lifetime bound in `impl Trait` fn foo<'a, 'b>(_: &'a u8, _: &'b u8) -> Foo<'a, 'b> { () } ``` This requires a separate fix. Fix rust-lang#59001 Fix rust-lang#58885 Fix rust-lang#55324 Fix rust-lang#54974 Progress on rust-lang#56238 r? @nikomatsakis
Rollup of 8 pull requests Successful merges: - #59262 (Remove duplicated code from Iterator::{ne, lt, le, gt, ge}) - #59286 (Refactor async fn return type lowering) - #59444 (Implement useful steps_between for all integers) - #59452 (Speed up rustdoc run a bit) - #59533 (Support allocating iterators with arenas) - #59585 (Fixes for shallow borrows) - #59607 (Renames `EvalErrorKind` to `InterpError`) - #59613 (SGX target: convert a bunch of panics to aborts) Failed merges: - #59630 (Shrink `mir::Statement`.) r? @ghost
async fn now lowers directly to an existential type declaration
rather than reusing the
impl Trait
return type lowering.As part of this, it lowers all argument-position elided lifetimes
using the in-band-lifetimes machinery, creating fresh parameter
names for each of them, using each lifetime parameter as a generic
argument to the generated existential type.
This doesn't currently successfully allow multiple
argument-position elided lifetimes since
existential type
doesn't yet support multiple lifetimes where neither outlive
the other:
This requires a separate fix.
Fix #59001
Fix #58885
Fix #55324
Fix #54974
Progress on #56238
r? @nikomatsakis