diff options
| author | Michael Goulet <michael@errs.io> | 2023-12-18 21:21:56 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-12-19 15:10:26 +0000 |
| commit | e6d6b1d92cd4641867ce244418af3a5690d853fe (patch) | |
| tree | df7ccdf99b8e1dacb67fa89e676acd31c787db35 | |
| parent | 558ac1cfb7c214d06ca471885a57caa6c8301bae (diff) | |
| download | rust-e6d6b1d92cd4641867ce244418af3a5690d853fe.tar.gz rust-e6d6b1d92cd4641867ce244418af3a5690d853fe.zip | |
Do not evaluate in structurally_relate_tys
| -rw-r--r-- | compiler/rustc_middle/src/ty/relate.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index d7d9afc30e7..adb3e992491 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -505,13 +505,9 @@ pub fn structurally_relate_tys<'tcx, R: TypeRelation<'tcx>>( Err(err) => { // Check whether the lengths are both concrete/known values, // but are unequal, for better diagnostics. - // - // It might seem dubious to eagerly evaluate these constants here, - // we however cannot end up with errors in `Relate` during both - // `type_of` and `predicates_of`. This means that evaluating the - // constants should not cause cycle errors here. - let sz_a = sz_a.try_eval_target_usize(tcx, relation.param_env()); - let sz_b = sz_b.try_eval_target_usize(tcx, relation.param_env()); + let sz_a = sz_a.try_to_target_usize(tcx); + let sz_b = sz_b.try_to_target_usize(tcx); + match (sz_a, sz_b) { (Some(sz_a_val), Some(sz_b_val)) if sz_a_val != sz_b_val => Err( TypeError::FixedArraySize(expected_found(relation, sz_a_val, sz_b_val)), |
