Conversation
This makes GAT lifetimes late-bound regions
|
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
| let param_ty = ty::fold::shift_vars(tcx, ¶m_ty, 1); | ||
| let outlives = ty::OutlivesPredicate(param_ty, region_bound); | ||
| (ty::Binder::dummy(outlives).to_predicate(), span) | ||
| (ty::Binder::bind(outlives).to_predicate(), span) |
There was a problem hiding this comment.
I was flying blind here, and just tried to implement what the previous comment said, with a bit of trial and error. If someone who knows this code could review this that'd be appreciated.
|
r? @nikomatsakis cc @rust-lang/wg-traits |
There was a problem hiding this comment.
Hmm. I have to think about this. I do not believe these should be late-bound, but rather early-bound -- we basically want to substitute them. In general, it'd be good @PlasmaPower if you wanted to pop into the #wg-traits channel on Zulip. We've been discussing on and off whether to pursue GATs in the context of Rust's current trait solver or postpone that work until we've made more progress on chalk (with an inclination to the latter).
|
According to the RFC, specifically the Iterable example here, |
|
@PlasmaPower You can always synthesize Presumably the only thing missing is converting the (early-bound) lifetime parameter of a GAT to late-bound when generating the bounds. I think we have a similar problem with constructors and their lifetimes not being turned into late-bound ones when computing the signature (#30904). |
|
To clarify, you're talking about something like |
|
For a (To be clear, I was talking about the ADT constructors provided by the language, not user-written methods). |
|
Well it sounds like this approach isn't correct, and that it's planned to wait on chalk for GAT implementation, so I'll close this PR. |
|
How close is Chalk to being ready for things like this? |
|
GAT and all the other goodness that comes with chalk is one of the things I'm most interested. I'd be glad to help if I can. |
This makes GAT lifetimes in traits (not impls) late-bound regions, which matches the RFC, stating that bounds placed on the GAT should be interpreted as HRTBs.
This fixes most of #62521, but the last code block in that issue fails because GAT impls are unimplemented (pun not intended).