Skip to main content

declared_bounds_from_definition

Function declared_bounds_from_definition 

Source
pub fn declared_bounds_from_definition<I>(
    cx: I,
    alias_ty: AliasTy<I>,
) -> impl Iterator<Item = <I as Interner>::Region>
where I: Interner,
Expand description

Given a projection like <T as Foo<'x>>::Bar, returns any bounds declared in the trait definition. For example, if the trait were

trait Foo<'a> {
    type Bar: 'a;
}

If we were given <T as Foo<'b>>::Bar, we would return 'b. This doesn’t work for higher-ranked bounds such as:

trait Foo<'a, 'b>
where for<'x> <Self as Foo<'x, 'b>>::Bar: 'x
{
    type Bar;
}

This is for simplicity, and because we are not really smart enough to cope with such bounds anywhere.