diff options
Diffstat (limited to 'compiler/rustc_hir_analysis/src/collect.rs')
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect.rs | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs index d724dce89f4..c160cf2df6e 100644 --- a/compiler/rustc_hir_analysis/src/collect.rs +++ b/compiler/rustc_hir_analysis/src/collect.rs @@ -401,13 +401,13 @@ impl<'tcx> AstConv<'tcx> for ItemCtxt<'tcx> { poly_trait_ref: ty::PolyTraitRef<'tcx>, ) -> Ty<'tcx> { if let Some(trait_ref) = poly_trait_ref.no_bound_vars() { - let item_substs = self.astconv().create_substs_for_associated_item( + let item_args = self.astconv().create_args_for_associated_item( span, item_def_id, item_segment, - trait_ref.substs, + trait_ref.args, ); - Ty::new_projection(self.tcx(), item_def_id, item_substs) + Ty::new_projection(self.tcx(), item_def_id, item_args) } else { // There are no late-bound regions; we can just ignore the binder. let (mut mpart_sugg, mut inferred_sugg) = (None, None); @@ -1145,8 +1145,8 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig< } Ctor(data) | Variant(hir::Variant { data, .. }) if data.ctor().is_some() => { - let ty = tcx.type_of(tcx.hir().get_parent_item(hir_id)).subst_identity(); - let inputs = data.fields().iter().map(|f| tcx.type_of(f.def_id).subst_identity()); + let ty = tcx.type_of(tcx.hir().get_parent_item(hir_id)).instantiate_identity(); + let inputs = data.fields().iter().map(|f| tcx.type_of(f.def_id).instantiate_identity()); ty::Binder::dummy(tcx.mk_fn_sig( inputs, ty, @@ -1161,15 +1161,13 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::EarlyBinder<ty::PolyFnSig< // signatures and cannot be accessed through `fn_sig`. For // example, a closure signature excludes the `self` // argument. In any case they are embedded within the - // closure type as part of the `ClosureSubsts`. + // closure type as part of the `ClosureArgs`. // // To get the signature of a closure, you should use the - // `sig` method on the `ClosureSubsts`: + // `sig` method on the `ClosureArgs`: // - // substs.as_closure().sig(def_id, tcx) - bug!( - "to get the signature of a closure, use `substs.as_closure().sig()` not `fn_sig()`", - ); + // args.as_closure().sig(def_id, tcx) + bug!("to get the signature of a closure, use `args.as_closure().sig()` not `fn_sig()`",); } x => { @@ -1266,7 +1264,7 @@ fn suggest_impl_trait<'tcx>( ) -> Option<String> { let format_as_assoc: fn(_, _, _, _, _) -> _ = |tcx: TyCtxt<'tcx>, - _: ty::SubstsRef<'tcx>, + _: ty::GenericArgsRef<'tcx>, trait_def_id: DefId, assoc_item_def_id: DefId, item_ty: Ty<'tcx>| { @@ -1276,12 +1274,12 @@ fn suggest_impl_trait<'tcx>( }; let format_as_parenthesized: fn(_, _, _, _, _) -> _ = |tcx: TyCtxt<'tcx>, - substs: ty::SubstsRef<'tcx>, + args: ty::GenericArgsRef<'tcx>, trait_def_id: DefId, _: DefId, item_ty: Ty<'tcx>| { let trait_name = tcx.item_name(trait_def_id); - let args_tuple = substs.type_at(1); + let args_tuple = args.type_at(1); let ty::Tuple(types) = *args_tuple.kind() else { return None; }; @@ -1328,24 +1326,23 @@ fn suggest_impl_trait<'tcx>( } let param_env = tcx.param_env(def_id); let infcx = tcx.infer_ctxt().build(); - let substs = ty::InternalSubsts::for_item(tcx, trait_def_id, |param, _| { + let args = ty::GenericArgs::for_item(tcx, trait_def_id, |param, _| { if param.index == 0 { ret_ty.into() } else { infcx.var_for_def(span, param) } }); - if !infcx.type_implements_trait(trait_def_id, substs, param_env).must_apply_modulo_regions() - { + if !infcx.type_implements_trait(trait_def_id, args, param_env).must_apply_modulo_regions() { continue; } let ocx = ObligationCtxt::new(&infcx); let item_ty = ocx.normalize( &ObligationCause::misc(span, def_id), param_env, - Ty::new_projection(tcx, assoc_item_def_id, substs), + Ty::new_projection(tcx, assoc_item_def_id, args), ); // FIXME(compiler-errors): We may benefit from resolving regions here. if ocx.select_where_possible().is_empty() && let item_ty = infcx.resolve_vars_if_possible(item_ty) && let Some(item_ty) = item_ty.make_suggestable(tcx, false) - && let Some(sugg) = formatter(tcx, infcx.resolve_vars_if_possible(substs), trait_def_id, assoc_item_def_id, item_ty) + && let Some(sugg) = formatter(tcx, infcx.resolve_vars_if_possible(args), trait_def_id, assoc_item_def_id, item_ty) { return Some(sugg); } @@ -1363,7 +1360,7 @@ fn impl_trait_ref( .of_trait .as_ref() .map(|ast_trait_ref| { - let selfty = tcx.type_of(def_id).subst_identity(); + let selfty = tcx.type_of(def_id).instantiate_identity(); icx.astconv().instantiate_mono_trait_ref( ast_trait_ref, selfty, |
