Skip to content

Commit 8b85053

Browse files
committed
don't resolve param env regions
fixes stage2
1 parent bcbfbe6 commit 8b85053

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

compiler/rustc_infer/src/infer/canonical/canonicalizer.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,21 @@ impl CanonicalizeMode for CanonicalizeQueryResponse {
206206
fn canonicalize_free_region<'tcx>(
207207
&self,
208208
canonicalizer: &mut Canonicalizer<'_, 'tcx>,
209-
r: ty::Region<'tcx>,
209+
mut r: ty::Region<'tcx>,
210210
) -> ty::Region<'tcx> {
211+
if let ty::ReVar(vid) = *r {
212+
r = canonicalizer
213+
.infcx
214+
.inner
215+
.borrow_mut()
216+
.unwrap_region_constraints()
217+
.opportunistic_resolve_var(canonicalizer.tcx, vid);
218+
debug!(
219+
"canonical: region var found with vid {vid:?}, \
220+
opportunistically resolved to {r:?}",
221+
);
222+
};
223+
211224
match *r {
212225
ty::ReLateParam(_) | ty::ReErased | ty::ReStatic | ty::ReEarlyParam(..) => r,
213226

@@ -385,25 +398,12 @@ impl<'cx, 'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'cx, 'tcx> {
385398
}
386399
}
387400

388-
ty::ReVar(vid) => {
389-
let resolved = self
390-
.infcx
391-
.inner
392-
.borrow_mut()
393-
.unwrap_region_constraints()
394-
.opportunistic_resolve_var(self.tcx, vid);
395-
debug!(
396-
"canonical: region var found with vid {vid:?}, \
397-
opportunistically resolved to {resolved:?}",
398-
);
399-
self.canonicalize_mode.canonicalize_free_region(self, resolved)
400-
}
401-
402401
ty::ReStatic
403402
| ty::ReEarlyParam(..)
404403
| ty::ReError(_)
405404
| ty::ReLateParam(_)
406405
| ty::RePlaceholder(..)
406+
| ty::ReVar(_)
407407
| ty::ReErased => self.canonicalize_mode.canonicalize_free_region(self, r),
408408
}
409409
}

0 commit comments

Comments
 (0)