diff options
| author | bors <bors@rust-lang.org> | 2023-02-18 00:20:52 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-02-18 00:20:52 +0000 |
| commit | a9842c73bcd78ca4c2ec56f3e529aed79bd37df7 (patch) | |
| tree | d643279e187292a87bc8e7d78edb212c714e8fa0 /compiler/rustc_trait_selection/src/traits | |
| parent | 231bcd131d109d41e5705f48b9c5a6e70c98ff80 (diff) | |
| parent | af32411f20d4e4f79a2c8b4b645b2693a46c3d7d (diff) | |
| download | rust-a9842c73bcd78ca4c2ec56f3e529aed79bd37df7.tar.gz rust-a9842c73bcd78ca4c2ec56f3e529aed79bd37df7.zip | |
Auto merge of #108112 - nnethercote:clarify-iterator-interners, r=oli-obk,compiler-errors
Clarify iterator interners I found the iterator interners very confusing. This PR clarifies things. r? `@compiler-errors`
Diffstat (limited to 'compiler/rustc_trait_selection/src/traits')
3 files changed, 4 insertions, 6 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index a0c67f480d0..91b463800a8 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2012,7 +2012,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { let sig = match inputs.kind() { ty::Tuple(inputs) if infcx.tcx.is_fn_trait(trait_ref.def_id()) => { infcx.tcx.mk_fn_sig( - inputs.iter(), + *inputs, infcx.next_ty_var(TypeVariableOrigin { span: DUMMY_SP, kind: TypeVariableOriginKind::MiscVariable, @@ -2023,7 +2023,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ) } _ => infcx.tcx.mk_fn_sig( - std::iter::once(inputs), + [inputs], infcx.next_ty_var(TypeVariableOrigin { span: DUMMY_SP, kind: TypeVariableOriginKind::MiscVariable, diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index c2388f9fa1b..9b3249e58e8 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1923,7 +1923,7 @@ fn confirm_builtin_candidate<'cx, 'tcx>( ) -> Progress<'tcx> { let tcx = selcx.tcx(); let self_ty = obligation.predicate.self_ty(); - let substs = tcx.mk_substs([self_ty.into()].iter()); + let substs = tcx.intern_substs(&[self_ty.into()]); let lang_items = tcx.lang_items(); let item_def_id = obligation.predicate.def_id; let trait_def_id = tcx.trait_of_item(item_def_id).unwrap(); diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 1309df18e15..e4a832e4728 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -564,10 +564,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { .into() } }); - let bound_vars = tcx.mk_bound_variable_kinds(bound_vars.into_iter()); + let bound_vars = tcx.intern_bound_variable_kinds(&bound_vars); let assoc_ty_substs = tcx.intern_substs(&substs); - - let bound_vars = tcx.mk_bound_variable_kinds(bound_vars.into_iter()); let bound = bound.map_bound(|b| b.kind().skip_binder()).subst(tcx, assoc_ty_substs); tcx.mk_predicate(ty::Binder::bind_with_vars(bound, bound_vars)) |
