1
Fork 0

Avoid cycle in nested obligations for object candidate

Bounds of the form `type Future: Future<Result=Self::Result>` exist in
some ecosystem crates. To validate these bounds for trait objects we
need to normalize `Self::Result` in a way that doesn't cause a cycle.
This commit is contained in:
Matthew Jasper 2020-07-05 12:16:25 +01:00
parent 582ccec1c5
commit f52b2d8890
12 changed files with 382 additions and 52 deletions

View file

@ -1513,6 +1513,7 @@ impl<'tcx> ExistentialProjection<'tcx> {
/// then this function would return a `exists T. T: Iterator` existential trait
/// reference.
pub fn trait_ref(&self, tcx: TyCtxt<'_>) -> ty::ExistentialTraitRef<'tcx> {
// FIXME(generic_associated_types): truncate substs to have the right length.
let def_id = tcx.associated_item(self.item_def_id).container.id();
ty::ExistentialTraitRef { def_id, substs: self.substs }
}