Skip to content

Commit 9b4b34a

Browse files
committed
Assert type equality of a and b in compare_const_vals.
Because they're always equal.
1 parent d5a13e2 commit 9b4b34a

File tree

1 file changed

+3
-1
lines changed
  • compiler/rustc_mir_build/src/thir/pattern

1 file changed

+3
-1
lines changed

compiler/rustc_mir_build/src/thir/pattern/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,12 +754,14 @@ pub(crate) fn compare_const_vals<'tcx>(
754754
param_env: ty::ParamEnv<'tcx>,
755755
ty: Ty<'tcx>,
756756
) -> Option<Ordering> {
757+
assert_eq!(a.ty(), b.ty());
758+
757759
let from_bool = |v: bool| v.then_some(Ordering::Equal);
758760

759761
let fallback = || from_bool(a == b);
760762

761763
// Use the fallback if any type differs
762-
if a.ty() != b.ty() || a.ty() != ty {
764+
if a.ty() != ty {
763765
return fallback();
764766
}
765767

0 commit comments

Comments
 (0)