diff options
Diffstat (limited to 'compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs')
-rw-r--r-- | compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs b/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs index 0759b95bd..1a679f32c 100644 --- a/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs +++ b/compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs @@ -299,6 +299,7 @@ fn encode_region<'tcx>( RegionKind::ReEarlyBound(..) | RegionKind::ReFree(..) | RegionKind::ReStatic + | RegionKind::ReError(_) | RegionKind::ReVar(..) | RegionKind::RePlaceholder(..) => { bug!("encode_region: unexpected `{:?}`", region.kind()); @@ -395,6 +396,7 @@ fn encode_ty_name(tcx: TyCtxt<'_>, def_id: DefId) -> String { hir::definitions::DefPathData::CrateRoot | hir::definitions::DefPathData::Use | hir::definitions::DefPathData::GlobalAsm + | hir::definitions::DefPathData::ImplTraitAssocTy | hir::definitions::DefPathData::MacroNs(..) | hir::definitions::DefPathData::LifetimeNs(..) => { bug!("encode_ty_name: unexpected `{:?}`", disambiguated_data.data); @@ -640,6 +642,7 @@ fn encode_ty<'tcx>( ty::Bound(..) | ty::Error(..) | ty::GeneratorWitness(..) + | ty::GeneratorWitnessMIR(..) | ty::Infer(..) | ty::Alias(..) | ty::Param(..) @@ -672,7 +675,7 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio _ if ty.is_unit() => {} ty::Tuple(tys) => { - ty = tcx.mk_tup(tys.iter().map(|ty| transform_ty(tcx, ty, options))); + ty = tcx.mk_tup_from_iter(tys.iter().map(|ty| transform_ty(tcx, ty, options))); } ty::Array(ty0, len) => { @@ -694,13 +697,13 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio let variant = adt_def.non_enum_variant(); let param_env = tcx.param_env(variant.def_id); let field = variant.fields.iter().find(|field| { - let ty = tcx.type_of(field.did); + let ty = tcx.type_of(field.did).subst_identity(); let is_zst = tcx.layout_of(param_env.and(ty)).map_or(false, |layout| layout.is_zst()); !is_zst }); if let Some(field) = field { - let ty0 = tcx.bound_type_of(field.did).subst(tcx, substs); + let ty0 = tcx.type_of(field.did).subst(tcx, substs); // Generalize any repr(transparent) user-defined type that is either a pointer // or reference, and either references itself or any other type that contains or // references itself, to avoid a reference cycle. @@ -779,8 +782,8 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio let output = transform_ty(tcx, fn_sig.skip_binder().output(), options); ty = tcx.mk_fn_ptr(ty::Binder::bind_with_vars( tcx.mk_fn_sig( - parameters.iter(), - &output, + parameters, + output, fn_sig.c_variadic(), fn_sig.unsafety(), fn_sig.abi(), @@ -793,6 +796,7 @@ fn transform_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, options: TransformTyOptio ty::Bound(..) | ty::Error(..) | ty::GeneratorWitness(..) + | ty::GeneratorWitnessMIR(..) | ty::Infer(..) | ty::Alias(..) | ty::Param(..) @@ -810,21 +814,18 @@ fn transform_substs<'tcx>( substs: SubstsRef<'tcx>, options: TransformTyOptions, ) -> SubstsRef<'tcx> { - let substs: Vec<GenericArg<'tcx>> = substs - .iter() - .map(|subst| { - if let GenericArgKind::Type(ty) = subst.unpack() { - if is_c_void_ty(tcx, ty) { - tcx.mk_unit().into() - } else { - transform_ty(tcx, ty, options).into() - } + let substs = substs.iter().map(|subst| { + if let GenericArgKind::Type(ty) = subst.unpack() { + if is_c_void_ty(tcx, ty) { + tcx.mk_unit().into() } else { - subst + transform_ty(tcx, ty, options).into() } - }) - .collect(); - tcx.mk_substs(substs.iter()) + } else { + subst + } + }); + tcx.mk_substs_from_iter(substs) } /// Returns a type metadata identifier for the specified FnAbi using the Itanium C++ ABI with vendor |