Implement impl Trait lifetime elision#46616
Conversation
There was a problem hiding this comment.
There's a bit of duplicated code here, but I couldn't figure out a good way to factor it out-- it seems too little code for its own function, but a closure would have a signature like for<'a, 'tcx> Fn(&mut LifetimeContext<'a, 'tcx>, &'tcx Generics) and I don't believe there's a way to write that ATM (though I could be wrong)
nikomatsakis
left a comment
There was a problem hiding this comment.
I'm not sure what's the ICE, will investigate.
src/librustc/hir/lowering.rs
Outdated
There was a problem hiding this comment.
I think we have to save and restore the flag; what about Fn(dyn Fn(&u32)) or something?
There was a problem hiding this comment.
This should be equivalent to collecting and restoring it-- note that this if branch is only entered if collect_elided_lifetimes starts out as true, so the logic is: "if true, set to false, run thing then set to true, else, run thing (equivalent to set to false, run thing, set to false)". I'm happy to change it if you think it's too confusing (or if I'm mistaken and my logic is actually incorrect).
src/librustc/hir/lowering.rs
Outdated
There was a problem hiding this comment.
As above-- the collect_elided_lifetimes in the if check should prevent us from needing to split it out, but I think it's unnecessarily "clever", so I'll change it.
54cab78 to
6c3cab9
Compare
|
☔ The latest upstream changes (presumably #46657) made this pull request unmergeable. Please resolve the merge conflicts. |
6c3cab9 to
be7270f
Compare
There was a problem hiding this comment.
This ICE is #46685, and is unrelated to this PR.
be7270f to
018c403
Compare
|
@bors r+ |
|
📌 Commit 018c403 has been approved by |
|
⌛ Testing commit 018c403 with merge 40bd2cbc492d3a009333301e70d27870c46b910f... |
|
@bors retry — Prioritizing rollup (no PRs will pass before #46694 is merged or travis-ci/travis-ci#8891 is fixed). |
|
@bors rollup- 😑 |
Implement impl Trait lifetime elision Fixes #43396. There's one weird ICE in the interaction with argument-position `impl Trait`. I'm still debugging it-- I've left a test for it commented out with a FIXME. Also included a FIXME to ensure that `impl Trait` traits are caught under the lint in #45992. r? @nikomatsakis
|
☀️ Test successful - status-appveyor, status-travis |
Fixes #43396.
There's one weird ICE in the interaction with argument-position
impl Trait. I'm still debugging it-- I've left a test for it commented out with a FIXME.Also included a FIXME to ensure that
impl Traittraits are caught under the lint in #45992.r? @nikomatsakis