about summary refs log tree commit diff
path: root/compiler/rustc_symbol_mangling/src
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2024-03-30 01:22:22 +0000
committerMatthew Maurer <mmaurer@google.com>2024-04-05 23:58:15 +0000
commit5083378f166f660ff18af43a9e98b9075e8a91c7 (patch)
treeb14911c828a8f0fec9c6a7009e5c40d80df9f701 /compiler/rustc_symbol_mangling/src
parentea40fa210b87a322d2259852c149ffa212a3a0da (diff)
downloadrust-5083378f166f660ff18af43a9e98b9075e8a91c7.tar.gz
rust-5083378f166f660ff18af43a9e98b9075e8a91c7.zip
CFI: Don't rewrite ty::Dynamic directly
Now that we're using a type folder, the arguments in predicates are
processed automatically - we don't need to descend manually.

We also want to keep projection clauses around, and this does so.
Diffstat (limited to 'compiler/rustc_symbol_mangling/src')
-rw-r--r--compiler/rustc_symbol_mangling/src/typeid/typeid_itanium_cxx_abi.rs24
1 files changed, 4 insertions, 20 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 c632712f5a9..87bb44a9fe4 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
@@ -283,12 +283,12 @@ fn encode_region<'tcx>(region: Region<'tcx>, dict: &mut FxHashMap<DictKey<'tcx>,
             s.push('E');
             compress(dict, DictKey::Region(region), &mut s);
         }
-        // FIXME(@lcnr): Why is `ReEarlyParam` reachable here.
-        RegionKind::ReEarlyParam(..) | RegionKind::ReErased => {
+        RegionKind::ReErased => {
             s.push_str("u6region");
             compress(dict, DictKey::Region(region), &mut s);
         }
-        RegionKind::ReLateParam(..)
+        RegionKind::ReEarlyParam(..)
+        | RegionKind::ReLateParam(..)
         | RegionKind::ReStatic
         | RegionKind::ReError(_)
         | RegionKind::ReVar(..)
@@ -776,6 +776,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for TransformTy<'tcx> {
             | ty::Coroutine(..)
             | ty::CoroutineClosure(..)
             | ty::CoroutineWitness(..)
+            | ty::Dynamic(..)
             | ty::Float(..)
             | ty::FnDef(..)
             | ty::Foreign(..)
@@ -924,23 +925,6 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for TransformTy<'tcx> {
                 }
             }
 
-            ty::Dynamic(predicates, _region, kind) => {
-                let predicates = self.tcx.mk_poly_existential_predicates_from_iter(
-                    predicates.iter().filter_map(|predicate| match predicate.skip_binder() {
-                        ty::ExistentialPredicate::Trait(trait_ref) => {
-                            let trait_ref = ty::TraitRef::identity(self.tcx, trait_ref.def_id);
-                            Some(ty::Binder::dummy(ty::ExistentialPredicate::Trait(
-                                ty::ExistentialTraitRef::erase_self_ty(self.tcx, trait_ref),
-                            )))
-                        }
-                        ty::ExistentialPredicate::Projection(..) => None,
-                        ty::ExistentialPredicate::AutoTrait(..) => Some(predicate),
-                    }),
-                );
-
-                Ty::new_dynamic(self.tcx, predicates, self.tcx.lifetimes.re_erased, *kind)
-            }
-
             ty::Alias(..) => {
                 self.fold_ty(self.tcx.normalize_erasing_regions(ty::ParamEnv::reveal_all(), t))
             }