mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 10:05:06 +03:00
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:
@@ -1385,6 +1385,8 @@ fn mk_trait_obligation_with_new_self_ty(
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user