Skip to content

Commit 472444b

Browse files
committed
Remove some unnecessary slicing
1 parent 48ea298 commit 472444b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

compiler/rustc_middle/src/ty/context.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,7 +2516,7 @@ impl<'tcx> TyCtxt<'tcx> {
25162516
self.mk_ty(Tuple(self.intern_type_list(&ts)))
25172517
}
25182518

2519-
pub fn mk_tup<I: InternAs<[Ty<'tcx>], Ty<'tcx>>>(self, iter: I) -> I::Output {
2519+
pub fn mk_tup<I: InternAs<Ty<'tcx>, Ty<'tcx>>>(self, iter: I) -> I::Output {
25202520
iter.intern_with(|ts| self.mk_ty(Tuple(self.intern_type_list(&ts))))
25212521
}
25222522

@@ -2776,33 +2776,33 @@ impl<'tcx> TyCtxt<'tcx> {
27762776
}
27772777

27782778
pub fn mk_poly_existential_predicates<
2779-
I: InternAs<[PolyExistentialPredicate<'tcx>], &'tcx List<PolyExistentialPredicate<'tcx>>>,
2779+
I: InternAs<PolyExistentialPredicate<'tcx>, &'tcx List<PolyExistentialPredicate<'tcx>>>,
27802780
>(
27812781
self,
27822782
iter: I,
27832783
) -> I::Output {
27842784
iter.intern_with(|xs| self.intern_poly_existential_predicates(xs))
27852785
}
27862786

2787-
pub fn mk_predicates<I: InternAs<[Predicate<'tcx>], &'tcx List<Predicate<'tcx>>>>(
2787+
pub fn mk_predicates<I: InternAs<Predicate<'tcx>, &'tcx List<Predicate<'tcx>>>>(
27882788
self,
27892789
iter: I,
27902790
) -> I::Output {
27912791
iter.intern_with(|xs| self.intern_predicates(xs))
27922792
}
27932793

2794-
pub fn mk_type_list<I: InternAs<[Ty<'tcx>], &'tcx List<Ty<'tcx>>>>(self, iter: I) -> I::Output {
2794+
pub fn mk_type_list<I: InternAs<Ty<'tcx>, &'tcx List<Ty<'tcx>>>>(self, iter: I) -> I::Output {
27952795
iter.intern_with(|xs| self.intern_type_list(xs))
27962796
}
27972797

2798-
pub fn mk_substs<I: InternAs<[GenericArg<'tcx>], &'tcx List<GenericArg<'tcx>>>>(
2798+
pub fn mk_substs<I: InternAs<GenericArg<'tcx>, &'tcx List<GenericArg<'tcx>>>>(
27992799
self,
28002800
iter: I,
28012801
) -> I::Output {
28022802
iter.intern_with(|xs| self.intern_substs(xs))
28032803
}
28042804

2805-
pub fn mk_place_elems<I: InternAs<[PlaceElem<'tcx>], &'tcx List<PlaceElem<'tcx>>>>(
2805+
pub fn mk_place_elems<I: InternAs<PlaceElem<'tcx>, &'tcx List<PlaceElem<'tcx>>>>(
28062806
self,
28072807
iter: I,
28082808
) -> I::Output {
@@ -2835,7 +2835,7 @@ impl<'tcx> TyCtxt<'tcx> {
28352835
}
28362836

28372837
pub fn mk_bound_variable_kinds<
2838-
I: InternAs<[ty::BoundVariableKind], &'tcx List<ty::BoundVariableKind>>,
2838+
I: InternAs<ty::BoundVariableKind, &'tcx List<ty::BoundVariableKind>>,
28392839
>(
28402840
self,
28412841
iter: I,

compiler/rustc_type_ir/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ pub trait InternAs<T: ?Sized, R> {
6060
type Output;
6161
fn intern_with<F>(self, f: F) -> Self::Output
6262
where
63-
F: FnOnce(&T) -> R;
63+
F: FnOnce(&[T]) -> R;
6464
}
6565

66-
impl<I, T, R, E> InternAs<[T], R> for I
66+
impl<I, T, R, E> InternAs<T, R> for I
6767
where
6868
E: InternIteratorElement<T, R>,
6969
I: Iterator<Item = E>,

0 commit comments

Comments
 (0)