Skip to content

Commit 5fe84c8

Browse files
committed
always eagerly eval consts in Relate
1 parent 4d0dd02 commit 5fe84c8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

compiler/rustc_middle/src/ty/relate.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,14 @@ pub fn super_relate_tys<R: TypeRelation<'tcx>>(
421421
let t = relation.relate(a_t, b_t)?;
422422
match relation.relate(sz_a, sz_b) {
423423
Ok(sz) => Ok(tcx.mk_ty(ty::Array(t, sz))),
424-
// FIXME(#72219) Implement improved diagnostics for mismatched array
425-
// length?
426-
Err(err) if relation.tcx().lazy_normalization() => Err(err),
427424
Err(err) => {
428425
// Check whether the lengths are both concrete/known values,
429426
// but are unequal, for better diagnostics.
427+
//
428+
// It might seem dubious to eagerly evaluate these constants here,
429+
// we however cannot end up with errors in `Relate` during both
430+
// `type_of` and `predicates_of`. This means that evaluating the
431+
// constants should not cause cycle errors here.
430432
let sz_a = sz_a.try_eval_usize(tcx, relation.param_env());
431433
let sz_b = sz_b.try_eval_usize(tcx, relation.param_env());
432434
match (sz_a, sz_b) {

0 commit comments

Comments
 (0)