Implement TypeRef::ForLifetime

This commit is contained in:
Lukas Wirth 2021-06-30 01:34:51 +02:00
parent 1b9b2d1f40
commit af739731db
6 changed files with 64 additions and 19 deletions

View file

@ -786,6 +786,11 @@ impl<'a> TyLoweringContext<'a> {
bindings = self.lower_trait_ref_from_path(path, Some(self_ty));
bindings.clone().map(WhereClause::Implemented).map(crate::wrap_empty_binders)
}
TypeBound::ForLifetime(_, path) => {
// FIXME Don't silently drop the hrtb lifetimes here
bindings = self.lower_trait_ref_from_path(path, Some(self_ty));
bindings.clone().map(WhereClause::Implemented).map(crate::wrap_empty_binders)
}
TypeBound::Lifetime(_) => None,
TypeBound::Error => None,
};
@ -803,7 +808,7 @@ impl<'a> TyLoweringContext<'a> {
trait_ref: TraitRef,
) -> impl Iterator<Item = QuantifiedWhereClause> + 'a {
let last_segment = match bound {
TypeBound::Path(path) => path.segments().last(),
TypeBound::Path(path) | TypeBound::ForLifetime(_, path) => path.segments().last(),
TypeBound::Error | TypeBound::Lifetime(_) => None,
};
last_segment