Skip to content

Commit e6d6b1d

Browse files
committedDec 19, 2023
Do not evaluate in structurally_relate_tys
1 parent 558ac1c commit e6d6b1d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed
 

Diff for: ‎compiler/rustc_middle/src/ty/relate.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,9 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>(
505505
Err(err) => {
506506
// Check whether the lengths are both concrete/known values,
507507
// but are unequal, for better diagnostics.
508-
//
509-
// It might seem dubious to eagerly evaluate these constants here,
510-
// we however cannot end up with errors in `Relate` during both
511-
// `type_of` and `predicates_of`. This means that evaluating the
512-
// constants should not cause cycle errors here.
513-
let sz_a = sz_a.try_eval_target_usize(tcx, relation.param_env());
514-
let sz_b = sz_b.try_eval_target_usize(tcx, relation.param_env());
508+
let sz_a = sz_a.try_to_target_usize(tcx);
509+
let sz_b = sz_b.try_to_target_usize(tcx);
510+
515511
match (sz_a, sz_b) {
516512
(Some(sz_a_val), Some(sz_b_val)) if sz_a_val != sz_b_val => Err(
517513
TypeError::FixedArraySize(expected_found(relation, sz_a_val, sz_b_val)),

0 commit comments

Comments
 (0)