Rollup merge of #123525 - maurer:no-id-dyn2, r=compiler-errors
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. r? `@compiler-errors`
This commit is contained in:
commit
ad3df4919d
3 changed files with 25 additions and 41 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue