Skip to content

Permit higher-ranked qualifiers to enclose the self type #20022

Closed
@nikomatsakis

Description

@nikomatsakis

There is a need to permit for qualifiers that appear in more places. In particular, I'd like to be able to write something like this:

where for<'a, 'b> &'a T : Foo<&'b T>

but today the parser only accepts for after the :. the rest of the code already considers 'a and 'b to be in scope for the self-type of the trait, so it's just the parser that has to be changed. I imagine that the for, in that case, would distribute over all the attached where clauses, so:

where for<'a> T : Foo<&'a T> + Bar<&'a T>

would be equivalent to:

where T : for<'a> Foo<&'a T> + for<'a> Bar<&'a T>

Nested for qualifiers would be illegal, I think:

where for<'a> T : for<'b> Foo<&'a &'b T> // ERROR

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions