Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,9 @@ impl<'tcx> InferCtxt<'tcx> {
// Note: if these two lines are combined into one we get
// dynamic borrow errors on `self.inner`.
let known = self.inner.borrow_mut().type_variables().probe(v).known();
known.map_or(ty, |t| self.shallow_resolve(t))
known.map_or(Ty::new_var(self.tcx, self.root_var(v)), |t| {
self.shallow_resolve(t)
})
}

ty::IntVar(v) => {
Expand Down
3 changes: 3 additions & 0 deletions tests/ui/coercion/issue-88097.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
// behavior has been fixed.

//@ check-pass
//@ revisions: current next
//@ ignore-compare-mode-next-solver (explicit revisions)
//@[next] compile-flags: -Znext-solver

fn peculiar() -> impl Fn(u8) -> u8 {
return |x| x + 1
Expand Down
Loading