diff options
| author | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-25 21:18:16 +0000 |
|---|---|---|
| committer | Yotam Ofek <yotam.ofek@gmail.com> | 2025-01-25 21:18:16 +0000 |
| commit | e485cc5e0217fbb3f495ee0db56d6dcb5f36de22 (patch) | |
| tree | f8629ca53078cc5ae6794a5723bddc57d420fe4f | |
| parent | f7cc13af822fe68c64fec0b05aa9dd1412451f7c (diff) | |
| download | rust-e485cc5e0217fbb3f495ee0db56d6dcb5f36de22.tar.gz rust-e485cc5e0217fbb3f495ee0db56d6dcb5f36de22.zip | |
Simplify slice indexing in next trait solver
| -rw-r--r-- | compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs index e99cd3d2727..a56ffbc8500 100644 --- a/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs +++ b/compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs @@ -442,13 +442,11 @@ where { // In case any fresh inference variables have been created between `state` // and the previous instantiation, extend `orig_values` for it. - assert!(orig_values.len() <= state.value.var_values.len()); - for &arg in &state.value.var_values.var_values.as_slice() - [orig_values.len()..state.value.var_values.len()] - { - let unconstrained = delegate.fresh_var_for_kind_with_span(arg, span); - orig_values.push(unconstrained); - } + orig_values.extend( + state.value.var_values.var_values.as_slice()[orig_values.len()..] + .iter() + .map(|&arg| delegate.fresh_var_for_kind_with_span(arg, span)), + ); let instantiation = EvalCtxt::compute_query_response_instantiation_values(delegate, orig_values, &state); |
