Skip to content

Commit d2bacb1

Browse files
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.
1 parent 4d9e9c6 commit d2bacb1

File tree

1 file changed

+2
-0
lines changed
  • src/librustc_trait_selection/traits/error_reporting

1 file changed

+2
-0
lines changed

src/librustc_trait_selection/traits/error_reporting/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,8 @@ impl<'a, 'tcx> InferCtxtPrivExt<'tcx> for InferCtxt<'a, 'tcx> {
13851385
trait_ref: &ty::PolyTraitRef<'tcx>,
13861386
new_self_ty: Ty<'tcx>,
13871387
) -> PredicateObligation<'tcx> {
1388+
assert!(!new_self_ty.has_escaping_bound_vars());
1389+
13881390
let trait_ref = trait_ref.map_bound_ref(|tr| ty::TraitRef {
13891391
substs: self.tcx.mk_substs_trait(new_self_ty, &tr.substs[1..]),
13901392
..*tr

0 commit comments

Comments
 (0)