diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-11-17 13:06:37 +0000 |
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2022-11-21 20:34:28 +0000 |
| commit | 9e4c3f41c105a93178a6962bfc2e416f520134a9 (patch) | |
| tree | d720c5574b8d6212b64969016c3dc0eb9dc2a763 | |
| parent | ec8d01fdccbe68d9a2ad6f2c2fbe000a9a6da530 (diff) | |
| download | rust-9e4c3f41c105a93178a6962bfc2e416f520134a9.tar.gz rust-9e4c3f41c105a93178a6962bfc2e416f520134a9.zip | |
Use iterators instead of slices at more sites
7 files changed, 10 insertions, 9 deletions
diff --git a/compiler/rustc_hir_analysis/src/coherence/builtin.rs b/compiler/rustc_hir_analysis/src/coherence/builtin.rs index 6f74ef3ccad..558c9789cf0 100644 --- a/compiler/rustc_hir_analysis/src/coherence/builtin.rs +++ b/compiler/rustc_hir_analysis/src/coherence/builtin.rs @@ -316,7 +316,7 @@ fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did: dispatch_from_dyn_trait, 0, field.ty(tcx, substs_a), - &[field.ty(tcx, substs_b).into()], + [field.ty(tcx, substs_b).into()], ) }), ); @@ -558,7 +558,7 @@ pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn // Register an obligation for `A: Trait<B>`. let cause = traits::ObligationCause::misc(span, impl_hir_id); let predicate = - predicate_for_trait_def(tcx, param_env, cause, trait_def_id, 0, source, &[target.into()]); + predicate_for_trait_def(tcx, param_env, cause, trait_def_id, 0, source, [target.into()]); let errors = traits::fully_solve_obligation(&infcx, predicate); if !errors.is_empty() { infcx.err_ctxt().report_fulfillment_errors(&errors, None); diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index 12cbc743bf9..30cc7de07ac 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -631,7 +631,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { coerce_unsized_did, 0, coerce_source, - &[coerce_target.into()] + [coerce_target.into()] )]; let mut has_unsized_tuple_coercion = false; diff --git a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs index 80c250f044d..1ed954bdd46 100644 --- a/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs +++ b/compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs @@ -241,7 +241,7 @@ impl<'tcx> ConstToPat<'tcx> { partial_eq_trait_id, 0, ty, - &[any_ty], + [any_ty], ); // FIXME: should this call a `predicate_must_hold` variant instead? diff --git a/compiler/rustc_trait_selection/src/lib.rs b/compiler/rustc_trait_selection/src/lib.rs index 2dce18e2d3c..975ff31a607 100644 --- a/compiler/rustc_trait_selection/src/lib.rs +++ b/compiler/rustc_trait_selection/src/lib.rs @@ -11,6 +11,7 @@ //! This API is completely unstable and subject to change. #![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")] +#![feature(associated_type_bounds)] #![feature(box_patterns)] #![feature(control_flow_enum)] #![feature(drain_filter)] diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 5c3a132bb5c..32683eb9822 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -1108,7 +1108,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { obligation.predicate.def_id(), obligation.recursion_depth + 1, source_tail, - &[target_tail.into()], + [target_tail.into()], )); } @@ -1139,7 +1139,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { obligation.predicate.def_id(), obligation.recursion_depth + 1, a_last, - &[b_last.into()], + [b_last.into()], ) })); } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index a9314b1b85e..06e507eb729 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -2101,7 +2101,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { trait_def_id, recursion_depth, normalized_ty, - &[], + [], ); obligations.push(placeholder_obligation); obligations diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index 41798e00caa..87c534bad96 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -239,9 +239,9 @@ pub fn predicate_for_trait_def<'tcx>( trait_def_id: DefId, recursion_depth: usize, self_ty: Ty<'tcx>, - params: &[GenericArg<'tcx>], + params: impl IntoIterator<Item = GenericArg<'tcx>, IntoIter: ExactSizeIterator>, ) -> PredicateObligation<'tcx> { - let trait_ref = tcx.mk_trait_ref(trait_def_id, self_ty, params.iter().copied()); + let trait_ref = tcx.mk_trait_ref(trait_def_id, self_ty, params); predicate_for_trait_ref(tcx, cause, param_env, trait_ref, recursion_depth) } |
