Skip to content

Commit 04f0245

Browse files
committed
using opt_values may mean we don't have infer vars
1 parent f5e6816 commit 04f0245

File tree

1 file changed

+6
-7
lines changed
  • compiler/rustc_next_trait_solver/src/solve/eval_ctxt

1 file changed

+6
-7
lines changed

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,12 @@ where
371371
if let Some(v) = opt_values[ty::BoundVar::from_usize(index)] {
372372
if let CanonicalVarKind::Ty { universe: _, sub_root } = info.kind {
373373
if let Some(prev) = var_values.get(sub_root.as_usize()) {
374-
let ty::Infer(ty::TyVar(vid)) = v.expect_ty().kind() else {
375-
unreachable!("expected `sub_root` to be an inference variable");
376-
};
377-
let ty::Infer(ty::TyVar(sub_root)) = prev.expect_ty().kind() else {
378-
unreachable!("expected `sub_root` to be an inference variable");
379-
};
380-
delegate.sub_ty_vids_raw(vid, sub_root);
374+
match (v.expect_ty().kind(), prev.expect_ty().kind()) {
375+
(ty::Infer(ty::TyVar(vid)), ty::Infer(ty::TyVar(sub_root))) => {
376+
delegate.sub_ty_vids_raw(vid, sub_root)
377+
}
378+
_ => {}
379+
}
381380
}
382381
}
383382
v

0 commit comments

Comments
 (0)