Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit aa4f2c5

Browse files
committed
using opt_values may mean we don't have infer vars
1 parent 08df828 commit aa4f2c5

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -376,13 +376,12 @@ where
376376
if let Some(v) = opt_values[ty::BoundVar::from_usize(index)] {
377377
if let CanonicalVarKind::Ty { universe: _, sub_root } = info.kind {
378378
if let Some(prev) = var_values.get(sub_root.as_usize()) {
379-
let ty::Infer(ty::TyVar(vid)) = v.expect_ty().kind() else {
380-
unreachable!("expected `sub_root` to be an inference variable");
381-
};
382-
let ty::Infer(ty::TyVar(sub_root)) = prev.expect_ty().kind() else {
383-
unreachable!("expected `sub_root` to be an inference variable");
384-
};
385-
delegate.sub_ty_vids_raw(vid, sub_root);
379+
match (v.expect_ty().kind(), prev.expect_ty().kind()) {
380+
(ty::Infer(ty::TyVar(vid)), ty::Infer(ty::TyVar(sub_root))) => {
381+
delegate.sub_ty_vids_raw(vid, sub_root)
382+
}
383+
_ => {}
384+
}
386385
}
387386
}
388387
v

0 commit comments

Comments
 (0)