Skip to content

Commit 3a31f62

Browse files
committed
Use more slicing and slice interning over iterable interning
1 parent a58fdd1 commit 3a31f62

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

compiler/rustc_hir_analysis/src/delegation.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ fn create_generic_args<'tcx>(
276276
tcx.impl_trait_header(parent).unwrap().trait_ref.instantiate_identity().args;
277277

278278
let trait_args = ty::GenericArgs::identity_for_item(tcx, sig_id);
279-
let method_args =
280-
tcx.mk_args_from_iter(trait_args.iter().skip(callee_generics.parent_count));
279+
let method_args = tcx.mk_args(&trait_args[callee_generics.parent_count..]);
281280
let method_args = build_generic_args(tcx, sig_id, def_id, method_args);
282281

283282
tcx.mk_args_from_iter(parent_args.iter().chain(method_args))

compiler/rustc_middle/src/ty/generic_args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl<'tcx> GenericArgs<'tcx> {
588588
}
589589

590590
pub fn truncate_to(&self, tcx: TyCtxt<'tcx>, generics: &ty::Generics) -> GenericArgsRef<'tcx> {
591-
tcx.mk_args_from_iter(self.iter().take(generics.count()))
591+
tcx.mk_args(&self[..generics.count()])
592592
}
593593

594594
pub fn print_as_list(&self) -> String {

0 commit comments

Comments
 (0)