Skip to content

Commit ec8d01f

Browse files
committed
Allow iterators instead of requiring slices that will get turned into iterators
1 parent bd40c10 commit ec8d01f

File tree

35 files changed

+69
-68
lines changed

35 files changed

+69
-68
lines changed

compiler/rustc_borrowck/src/type_check/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
550550
let trait_ref = tcx.mk_trait_ref(
551551
tcx.require_lang_item(LangItem::Copy, Some(self.last_span)),
552552
place_ty.ty,
553-
&[],
553+
[],
554554
);
555555

556556
// To have a `Copy` operand, the type `T` of the
@@ -1277,7 +1277,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
12771277
let trait_ref = tcx.mk_trait_ref(
12781278
tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
12791279
place_ty,
1280-
&[],
1280+
[],
12811281
);
12821282
self.prove_trait_ref(
12831283
trait_ref,
@@ -1870,7 +1870,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18701870
let trait_ref = tcx.mk_trait_ref(
18711871
tcx.require_lang_item(LangItem::Copy, Some(span)),
18721872
ty,
1873-
&[],
1873+
[],
18741874
);
18751875

18761876
self.prove_trait_ref(
@@ -1887,7 +1887,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
18871887
let trait_ref = tcx.mk_trait_ref(
18881888
tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
18891889
ty,
1890-
&[],
1890+
[],
18911891
);
18921892

18931893
self.prove_trait_ref(
@@ -1903,7 +1903,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
19031903
let trait_ref = tcx.mk_trait_ref(
19041904
tcx.require_lang_item(LangItem::Sized, Some(self.last_span)),
19051905
*ty,
1906-
&[],
1906+
[],
19071907
);
19081908

19091909
self.prove_trait_ref(
@@ -2004,7 +2004,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20042004
let trait_ref = tcx.mk_trait_ref(
20052005
tcx.require_lang_item(LangItem::CoerceUnsized, Some(self.last_span)),
20062006
op.ty(body, tcx),
2007-
&[ty.into()],
2007+
[ty.into()],
20082008
);
20092009

20102010
self.prove_trait_ref(

compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl Qualif for NeedsNonConstDrop {
160160
ObligationCause::dummy(),
161161
cx.param_env,
162162
ty::Binder::dummy(ty::TraitPredicate {
163-
trait_ref: cx.tcx.mk_trait_ref(destruct, ty, &[]),
163+
trait_ref: cx.tcx.mk_trait_ref(destruct, ty, []),
164164
constness: ty::BoundConstness::ConstIfConst,
165165
polarity: ty::ImplPolarity::Positive,
166166
}),

compiler/rustc_hir_analysis/src/bounds.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<'tcx> Bounds<'tcx> {
6161
// If it could be sized, and is, add the `Sized` predicate.
6262
let sized_predicate = self.implicitly_sized.and_then(|span| {
6363
tcx.lang_items().sized_trait().map(move |sized| {
64-
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(sized, param_ty, &[]));
64+
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(sized, param_ty, []));
6565
(trait_ref.without_const().to_predicate(tcx), span)
6666
})
6767
});

compiler/rustc_hir_analysis/src/check/wfcheck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1782,7 +1782,7 @@ fn receiver_is_implemented<'tcx>(
17821782
receiver_ty: Ty<'tcx>,
17831783
) -> bool {
17841784
let tcx = wfcx.tcx();
1785-
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(receiver_trait_def_id, receiver_ty, &[]));
1785+
let trait_ref = ty::Binder::dummy(tcx.mk_trait_ref(receiver_trait_def_id, receiver_ty, []));
17861786

17871787
let obligation = traits::Obligation::new(tcx, cause, wfcx.param_env, trait_ref.without_const());
17881788

compiler/rustc_hir_typeck/src/_match.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,9 +545,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
545545
}
546546
ty::PredicateKind::Projection(mut proj_pred) => {
547547
assert_eq!(proj_pred.projection_ty.self_ty(), opaque_ty);
548-
proj_pred.projection_ty.substs = self
549-
.tcx
550-
.mk_substs_trait(ty, &proj_pred.projection_ty.substs[1..]);
548+
proj_pred.projection_ty.substs = self.tcx.mk_substs_trait(
549+
ty,
550+
proj_pred.projection_ty.substs.iter().skip(1),
551+
);
551552
ty::PredicateKind::Projection(proj_pred)
552553
}
553554
_ => continue,

compiler/rustc_hir_typeck/src/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
807807
self.param_env,
808808
ty::Binder::dummy(ty::TraitRef::new(
809809
self.tcx.require_lang_item(hir::LangItem::PointerSized, Some(self.cause.span)),
810-
self.tcx.mk_substs_trait(a, &[]),
810+
self.tcx.mk_substs_trait(a, []),
811811
))
812812
.to_poly_trait_predicate(),
813813
));

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10951095
self.param_env,
10961096
ty::Binder::dummy(self.tcx.mk_trait_ref(
10971097
into_def_id,
1098-
expr_ty, &[expected_ty.into()]
1098+
expr_ty, [expected_ty.into()]
10991099
))
11001100
.to_poly_trait_predicate(),
11011101
))

compiler/rustc_hir_typeck/src/method/suggest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
7171
let trait_ref = tcx.mk_trait_ref(
7272
fn_once,
7373
ty,
74-
&[self
74+
[self
7575
.next_ty_var(TypeVariableOrigin {
7676
kind: TypeVariableOriginKind::MiscVariable,
7777
span,

compiler/rustc_infer/src/traits/engine.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
2727
def_id: DefId,
2828
cause: ObligationCause<'tcx>,
2929
) {
30-
let trait_ref = infcx.tcx.mk_trait_ref(def_id, ty, &[]);
30+
let trait_ref = infcx.tcx.mk_trait_ref(def_id, ty, []);
3131
self.register_predicate_obligation(
3232
infcx,
3333
Obligation {

compiler/rustc_middle/src/ty/adjustment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl<'tcx> OverloadedDeref<'tcx> {
131131
.find(|m| m.kind == ty::AssocKind::Fn)
132132
.unwrap()
133133
.def_id;
134-
tcx.mk_fn_def(method_def_id, tcx.mk_substs_trait(source, &[]))
134+
tcx.mk_fn_def(method_def_id, tcx.mk_substs_trait(source, []))
135135
}
136136
}
137137

0 commit comments

Comments
 (0)