Skip to content

Commit e485cc5

Browse files
committed
Simplify slice indexing in next trait solver
1 parent f7cc13a commit e485cc5

File tree

1 file changed

+5
-7
lines changed
  • compiler/rustc_next_trait_solver/src/solve/eval_ctxt

1 file changed

+5
-7
lines changed

compiler/rustc_next_trait_solver/src/solve/eval_ctxt/canonical.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -442,13 +442,11 @@ where
442442
{
443443
// In case any fresh inference variables have been created between `state`
444444
// and the previous instantiation, extend `orig_values` for it.
445-
assert!(orig_values.len() <= state.value.var_values.len());
446-
for &arg in &state.value.var_values.var_values.as_slice()
447-
[orig_values.len()..state.value.var_values.len()]
448-
{
449-
let unconstrained = delegate.fresh_var_for_kind_with_span(arg, span);
450-
orig_values.push(unconstrained);
451-
}
445+
orig_values.extend(
446+
state.value.var_values.var_values.as_slice()[orig_values.len()..]
447+
.iter()
448+
.map(|&arg| delegate.fresh_var_for_kind_with_span(arg, span)),
449+
);
452450

453451
let instantiation =
454452
EvalCtxt::compute_query_response_instantiation_values(delegate, orig_values, &state);

0 commit comments

Comments
 (0)