-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RFC: extended_hrtbs #3261
base: master
Are you sure you want to change the base?
RFC: extended_hrtbs #3261
Conversation
Could you please, somewhere in the RFC, define HRTBs as higher-rank trait bounds? I had to look that up even though I understand the |
So, two thoughts: First, I'd like for this to not really be needed in most cases if ever. We should be able to use some form of implied bounds here. We've had some discussion around a-mir-formality about this. Second, I personally prefer |
I'm not sure what do you want here. With
Such syntax feels strange with closures: |
Related to HRTBs with two lifetimes and implied bounds: |
I'm trying to define a trait abstraction for trait SupportScoped {
type Scope<'scope, 'env: 'scope>;
fn scope<'env, F>(f: F)
where
for<'scope> F: FnOnce(&'scope Self::Scope<'scope, 'env>);
}
struct Thread;
impl SupportScoped for Thread {
type Scope<'scope, 'env: 'scope> = std::thread::Scope<'scope, 'env>;
fn scope<'env, F>(f: F)
where
for<'scope> F: FnOnce(&'scope Self::Scope<'scope, 'env>),
// ^ error[E0478]: lifetime bound not satisfied
{
std::thread::scope(f);
}
} I think the explicit type of fn scope<'env, F>(f: F)
where
for<'scope where 'env: 'scope> F: FnOnce(&'scope Self::Scope<'scope, 'env>); |
RFC for bounded universal quantification for lifetimes
Rendered
Internals thread