Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ensure that new_self_ty has no escaping bound vars
Otherwise inserting it to the `Binder` used by `trait_ref` would cause
problems. This is just to be extra carefult: we aren't going to
start recommending that the user start using HKTs anytime soon.
  • Loading branch information
ecstatic-morse committed May 22, 2020
1 parent 4d9e9c6 commit d2bacb1
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/librustc_trait_selection/traits/error_reporting/mod.rs
Expand Up @@ -1385,6 +1385,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
trait_ref: &ty::PolyTraitRef<'tcx>,
new_self_ty: Ty<'tcx>,
) -> PredicateObligation<'tcx> {
assert!(!new_self_ty.has_escaping_bound_vars());

let trait_ref = trait_ref.map_bound_ref(|tr| ty::TraitRef {
substs: self.tcx.mk_substs_trait(new_self_ty, &tr.substs[1..]),
..*tr
Expand Down

0 comments on commit d2bacb1

Please sign in to comment.