Skip to content

Commit 2e71b5f

Browse files
lcnrcompiler-errors
authored andcommitted
using opt_values may mean we don't have infer vars
1 parent f246fe4 commit 2e71b5f

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
@@ -361,13 +361,12 @@ where
361361
if let Some(v) = opt_values[ty::BoundVar::from_usize(index)] {
362362
if let CanonicalVarKind::Ty { universe: _, sub_root } = info.kind {
363363
if let Some(prev) = var_values.get(sub_root.as_usize()) {
364-
let ty::Infer(ty::TyVar(vid)) = v.expect_ty().kind() else {
365-
unreachable!("expected `sub_root` to be an inference variable");
366-
};
367-
let ty::Infer(ty::TyVar(sub_root)) = prev.expect_ty().kind() else {
368-
unreachable!("expected `sub_root` to be an inference variable");
369-
};
370-
delegate.sub_ty_vids_raw(vid, sub_root);
364+
match (v.expect_ty().kind(), prev.expect_ty().kind()) {
365+
(ty::Infer(ty::TyVar(vid)), ty::Infer(ty::TyVar(sub_root))) => {
366+
delegate.sub_ty_vids_raw(vid, sub_root)
367+
}
368+
_ => {}
369+
}
371370
}
372371
}
373372
v

0 commit comments

Comments
 (0)