resolve type vars *before* entering type_must_outlive

All recursive calls only use type-vars that should already be
resolved, because they were obtained from `ty`.
This commit is contained in:
Niko Matsakis 2018-06-07 04:35:53 -04:00
parent 13e77934e5
commit 5829746ddd

View file

@ -186,6 +186,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
|| infer::RelateParamBound(cause.span, sup_type),
);
let sup_type = self.resolve_type_vars_if_possible(&sup_type);
outlives.type_must_outlive(origin, sup_type, sub_region);
}
}
@ -203,6 +204,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
) {
let outlives =
TypeOutlives::new(self, region_bound_pairs, implicit_region_bound, param_env);
let ty = self.resolve_type_vars_if_possible(&ty);
outlives.type_must_outlive(origin, ty, region);
}
}
@ -246,8 +248,6 @@ impl<'cx, 'gcx, 'tcx> TypeOutlives<'cx, 'gcx, 'tcx> {
ty: Ty<'tcx>,
region: ty::Region<'tcx>,
) {
let ty = self.infcx.resolve_type_vars_if_possible(&ty);
debug!(
"type_must_outlive(ty={:?}, region={:?}, origin={:?})",
ty,