Skip to content

Commit dd7e4e9

Browse files
Auto merge of #147193 - BoxyUwU:shallow_resolve_to_root, r=<try>
Shallow resolve ty vars to their root var
2 parents 1e1a394 + d821286 commit dd7e4e9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_infer/src/infer/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,7 +1125,9 @@ impl<'tcx> InferCtxt<'tcx> {
11251125
// Note: if these two lines are combined into one we get
11261126
// dynamic borrow errors on `self.inner`.
11271127
let known = self.inner.borrow_mut().type_variables().probe(v).known();
1128-
known.map_or(ty, |t| self.shallow_resolve(t))
1128+
known.map_or(Ty::new_var(self.tcx, self.root_var(v)), |t| {
1129+
self.shallow_resolve(t)
1130+
})
11291131
}
11301132

11311133
ty::IntVar(v) => {

tests/ui/coercion/issue-88097.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
// behavior has been fixed.
44

55
//@ check-pass
6+
//@ revisions: current next
7+
//@ ignore-compare-mode-next-solver (explicit revisions)
8+
//@[next] compile-flags: -Znext-solver
69

710
fn peculiar() -> impl Fn(u8) -> u8 {
811
return |x| x + 1

0 commit comments

Comments
 (0)