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.
This commit is contained in:
parent
4d9e9c6d4e
commit
d2bacb18d2
1 changed files with 2 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue