Rollup merge of #132374 - fmease:rm-dead-eff-code, r=compiler-errors
Remove dead code stemming from the old effects desugaring r? project-const-traits
This commit is contained in:
commit
7d0dbc5f53
@ -821,8 +821,7 @@ pub(super) fn check_specialization_validity<'tcx>(
|
||||
let result = opt_result.unwrap_or(Ok(()));
|
||||
|
||||
if let Err(parent_impl) = result {
|
||||
// FIXME(effects) the associated type from effects could be specialized
|
||||
if !tcx.is_impl_trait_in_trait(impl_item) && !tcx.is_effects_desugared_assoc_ty(impl_item) {
|
||||
if !tcx.is_impl_trait_in_trait(impl_item) {
|
||||
report_forbidden_specialization(tcx, impl_item, parent_impl);
|
||||
} else {
|
||||
tcx.dcx().delayed_bug(format!("parent item: {parent_impl:?} not marked as default"));
|
||||
|
@ -2042,7 +2042,7 @@ pub(super) fn check_type_bounds<'tcx>(
|
||||
// A synthetic impl Trait for RPITIT desugaring or assoc type for effects desugaring has no HIR,
|
||||
// which we currently use to get the span for an impl's associated type. Instead, for these,
|
||||
// use the def_span for the synthesized associated type.
|
||||
let impl_ty_span = if impl_ty.is_impl_trait_in_trait() || impl_ty.is_effects_desugaring {
|
||||
let impl_ty_span = if impl_ty.is_impl_trait_in_trait() {
|
||||
tcx.def_span(impl_ty_def_id)
|
||||
} else {
|
||||
match tcx.hir_node_by_def_id(impl_ty_def_id) {
|
||||
|
@ -379,9 +379,6 @@ pub(super) fn explicit_item_bounds_with_filter(
|
||||
}
|
||||
|
||||
let bounds = match tcx.hir_node_by_def_id(def_id) {
|
||||
_ if tcx.is_effects_desugared_assoc_ty(def_id.to_def_id()) => {
|
||||
associated_type_bounds(tcx, def_id, &[], tcx.def_span(def_id), filter)
|
||||
}
|
||||
hir::Node::TraitItem(hir::TraitItem {
|
||||
kind: hir::TraitItemKind::Type(bounds, _),
|
||||
span,
|
||||
|
@ -140,9 +140,7 @@ pub(super) fn lower_trait_object_ty(
|
||||
tcx.associated_items(pred.def_id())
|
||||
.in_definition_order()
|
||||
.filter(|item| item.kind == ty::AssocKind::Type)
|
||||
.filter(|item| {
|
||||
!item.is_impl_trait_in_trait() && !item.is_effects_desugaring
|
||||
})
|
||||
.filter(|item| !item.is_impl_trait_in_trait())
|
||||
.map(|item| item.def_id),
|
||||
);
|
||||
}
|
||||
|
@ -1365,7 +1365,6 @@ pub(crate) fn differs_from(&self, other: &Self) -> bool {
|
||||
trait_item_def_id: _,
|
||||
fn_has_self_parameter: _,
|
||||
opt_rpitit_info: _,
|
||||
is_effects_desugaring: _,
|
||||
},
|
||||
kind: _,
|
||||
import_ids: _,
|
||||
|
@ -1317,9 +1317,7 @@ fn get_associated_item_or_field_def_ids(
|
||||
}
|
||||
|
||||
fn get_associated_item(self, id: DefIndex, sess: &'a Session) -> ty::AssocItem {
|
||||
let name = if self.root.tables.opt_rpitit_info.get(self, id).is_some()
|
||||
|| self.root.tables.is_effects_desugaring.get(self, id)
|
||||
{
|
||||
let name = if self.root.tables.opt_rpitit_info.get(self, id).is_some() {
|
||||
kw::Empty
|
||||
} else {
|
||||
self.item_name(id)
|
||||
@ -1342,7 +1340,6 @@ fn get_associated_item(self, id: DefIndex, sess: &'a Session) -> ty::AssocItem {
|
||||
container,
|
||||
fn_has_self_parameter: has_self,
|
||||
opt_rpitit_info,
|
||||
is_effects_desugaring: self.root.tables.is_effects_desugaring.get(self, id),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1677,9 +1677,6 @@ fn encode_info_for_assoc_item(&mut self, def_id: DefId) {
|
||||
self.encode_precise_capturing_args(def_id);
|
||||
}
|
||||
}
|
||||
if item.is_effects_desugaring {
|
||||
self.tables.is_effects_desugaring.set(def_id.index, true);
|
||||
}
|
||||
}
|
||||
|
||||
fn encode_precise_capturing_args(&mut self, def_id: DefId) {
|
||||
|
@ -396,7 +396,6 @@ fn encode(&self, buf: &mut FileEncoder) -> LazyTables {
|
||||
inherent_impls: Table<DefIndex, LazyArray<DefIndex>>,
|
||||
associated_types_for_impl_traits_in_associated_fn: Table<DefIndex, LazyArray<DefId>>,
|
||||
opt_rpitit_info: Table<DefIndex, Option<LazyValue<ty::ImplTraitInTraitData>>>,
|
||||
is_effects_desugaring: Table<DefIndex, bool>,
|
||||
unused_generic_params: Table<DefIndex, UnusedGenericParams>,
|
||||
// Reexported names are not associated with individual `DefId`s,
|
||||
// e.g. a glob import can introduce a lot of names, all with the same `DefId`.
|
||||
|
@ -34,8 +34,6 @@ pub struct AssocItem {
|
||||
/// return-position `impl Trait` in trait desugaring. The `ImplTraitInTraitData`
|
||||
/// provides additional information about its source.
|
||||
pub opt_rpitit_info: Option<ty::ImplTraitInTraitData>,
|
||||
|
||||
pub is_effects_desugaring: bool,
|
||||
}
|
||||
|
||||
impl AssocItem {
|
||||
|
@ -1625,16 +1625,6 @@ pub fn opt_rpitit_info(self, def_id: DefId) -> Option<ImplTraitInTraitData> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether the `def_id` is an associated type that was desugared from a
|
||||
/// `#[const_trait]` or `impl_const`.
|
||||
pub fn is_effects_desugared_assoc_ty(self, def_id: DefId) -> bool {
|
||||
if let DefKind::AssocTy = self.def_kind(def_id) {
|
||||
self.associated_item(def_id).is_effects_desugaring
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
pub fn find_field_index(self, ident: Ident, variant: &VariantDef) -> Option<FieldIdx> {
|
||||
variant.fields.iter_enumerated().find_map(|(i, field)| {
|
||||
self.hygienic_eq(ident, field.ident(self), variant.def_id).then_some(i)
|
||||
|
@ -5226,12 +5226,6 @@ fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
|
||||
let ty::ClauseKind::Projection(proj) = clause else {
|
||||
return;
|
||||
};
|
||||
// avoid ICEing since effects desugared associated types don't have names.
|
||||
// this path should only be hit for `~const` on invalid places, so they
|
||||
// will have an informative error already.
|
||||
if tcx.is_effects_desugared_assoc_ty(proj.projection_term.def_id) {
|
||||
return;
|
||||
}
|
||||
let name = tcx.item_name(proj.projection_term.def_id);
|
||||
let mut predicates = generics.predicates.iter().peekable();
|
||||
let mut prev: Option<&hir::WhereBoundPredicate<'_>> = None;
|
||||
|
@ -143,7 +143,6 @@ fn associated_item_from_trait_item_ref(trait_item_ref: &hir::TraitItemRef) -> ty
|
||||
container: ty::TraitContainer,
|
||||
fn_has_self_parameter: has_self,
|
||||
opt_rpitit_info: None,
|
||||
is_effects_desugaring: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,7 +162,6 @@ fn associated_item_from_impl_item_ref(impl_item_ref: &hir::ImplItemRef) -> ty::A
|
||||
container: ty::ImplContainer,
|
||||
fn_has_self_parameter: has_self,
|
||||
opt_rpitit_info: None,
|
||||
is_effects_desugaring: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +273,6 @@ fn associated_type_for_impl_trait_in_trait(
|
||||
fn_def_id: fn_def_id.to_def_id(),
|
||||
opaque_def_id: opaque_ty_def_id.to_def_id(),
|
||||
}),
|
||||
is_effects_desugaring: false,
|
||||
});
|
||||
|
||||
// Copy visility of the containing function.
|
||||
@ -327,7 +324,6 @@ fn associated_type_for_impl_trait_in_impl(
|
||||
container: ty::ImplContainer,
|
||||
fn_has_self_parameter: false,
|
||||
opt_rpitit_info: Some(ImplTraitInTraitData::Impl { fn_def_id: impl_fn_def_id.to_def_id() }),
|
||||
is_effects_desugaring: false,
|
||||
});
|
||||
|
||||
// Copy visility of the containing function.
|
||||
|
Loading…
Reference in New Issue
Block a user