Skip to content

Commit a6bbdf0

Browse files
committed
Remove dead code stemming from the old effects desugaring
1 parent 759e07f commit a6bbdf0

File tree

12 files changed

+4
-40
lines changed

12 files changed

+4
-40
lines changed

Diff for: compiler/rustc_hir_analysis/src/check/check.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,7 @@ pub(super) fn check_specialization_validity<'tcx>(
821821
let result = opt_result.unwrap_or(Ok(()));
822822

823823
if let Err(parent_impl) = result {
824-
// FIXME(effects) the associated type from effects could be specialized
825-
if !tcx.is_impl_trait_in_trait(impl_item) && !tcx.is_effects_desugared_assoc_ty(impl_item) {
824+
if !tcx.is_impl_trait_in_trait(impl_item) {
826825
report_forbidden_specialization(tcx, impl_item, parent_impl);
827826
} else {
828827
tcx.dcx().delayed_bug(format!("parent item: {parent_impl:?} not marked as default"));

Diff for: compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ pub(super) fn check_type_bounds<'tcx>(
20422042
// A synthetic impl Trait for RPITIT desugaring or assoc type for effects desugaring has no HIR,
20432043
// which we currently use to get the span for an impl's associated type. Instead, for these,
20442044
// use the def_span for the synthesized associated type.
2045-
let impl_ty_span = if impl_ty.is_impl_trait_in_trait() || impl_ty.is_effects_desugaring {
2045+
let impl_ty_span = if impl_ty.is_impl_trait_in_trait() {
20462046
tcx.def_span(impl_ty_def_id)
20472047
} else {
20482048
match tcx.hir_node_by_def_id(impl_ty_def_id) {

Diff for: compiler/rustc_hir_analysis/src/collect/item_bounds.rs

-3
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,6 @@ pub(super) fn explicit_item_bounds_with_filter(
379379
}
380380

381381
let bounds = match tcx.hir_node_by_def_id(def_id) {
382-
_ if tcx.is_effects_desugared_assoc_ty(def_id.to_def_id()) => {
383-
associated_type_bounds(tcx, def_id, &[], tcx.def_span(def_id), filter)
384-
}
385382
hir::Node::TraitItem(hir::TraitItem {
386383
kind: hir::TraitItemKind::Type(bounds, _),
387384
span,

Diff for: compiler/rustc_hir_analysis/src/hir_ty_lowering/dyn_compatibility.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
140140
tcx.associated_items(pred.def_id())
141141
.in_definition_order()
142142
.filter(|item| item.kind == ty::AssocKind::Type)
143-
.filter(|item| {
144-
!item.is_impl_trait_in_trait() && !item.is_effects_desugaring
145-
})
143+
.filter(|item| !item.is_impl_trait_in_trait())
146144
.map(|item| item.def_id),
147145
);
148146
}

Diff for: compiler/rustc_hir_typeck/src/method/probe.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,6 @@ impl<'tcx> Pick<'tcx> {
13651365
trait_item_def_id: _,
13661366
fn_has_self_parameter: _,
13671367
opt_rpitit_info: _,
1368-
is_effects_desugaring: _,
13691368
},
13701369
kind: _,
13711370
import_ids: _,

Diff for: compiler/rustc_metadata/src/rmeta/decoder.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1317,9 +1317,7 @@ impl<'a> CrateMetadataRef<'a> {
13171317
}
13181318

13191319
fn get_associated_item(self, id: DefIndex, sess: &'a Session) -> ty::AssocItem {
1320-
let name = if self.root.tables.opt_rpitit_info.get(self, id).is_some()
1321-
|| self.root.tables.is_effects_desugaring.get(self, id)
1322-
{
1320+
let name = if self.root.tables.opt_rpitit_info.get(self, id).is_some() {
13231321
kw::Empty
13241322
} else {
13251323
self.item_name(id)
@@ -1342,7 +1340,6 @@ impl<'a> CrateMetadataRef<'a> {
13421340
container,
13431341
fn_has_self_parameter: has_self,
13441342
opt_rpitit_info,
1345-
is_effects_desugaring: self.root.tables.is_effects_desugaring.get(self, id),
13461343
}
13471344
}
13481345

Diff for: compiler/rustc_metadata/src/rmeta/encoder.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1677,9 +1677,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
16771677
self.encode_precise_capturing_args(def_id);
16781678
}
16791679
}
1680-
if item.is_effects_desugaring {
1681-
self.tables.is_effects_desugaring.set(def_id.index, true);
1682-
}
16831680
}
16841681

16851682
fn encode_precise_capturing_args(&mut self, def_id: DefId) {

Diff for: compiler/rustc_metadata/src/rmeta/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ define_tables! {
396396
inherent_impls: Table<DefIndex, LazyArray<DefIndex>>,
397397
associated_types_for_impl_traits_in_associated_fn: Table<DefIndex, LazyArray<DefId>>,
398398
opt_rpitit_info: Table<DefIndex, Option<LazyValue<ty::ImplTraitInTraitData>>>,
399-
is_effects_desugaring: Table<DefIndex, bool>,
400399
unused_generic_params: Table<DefIndex, UnusedGenericParams>,
401400
// Reexported names are not associated with individual `DefId`s,
402401
// e.g. a glob import can introduce a lot of names, all with the same `DefId`.

Diff for: compiler/rustc_middle/src/ty/assoc.rs

-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ pub struct AssocItem {
3434
/// return-position `impl Trait` in trait desugaring. The `ImplTraitInTraitData`
3535
/// provides additional information about its source.
3636
pub opt_rpitit_info: Option<ty::ImplTraitInTraitData>,
37-
38-
pub is_effects_desugaring: bool,
3937
}
4038

4139
impl AssocItem {

Diff for: compiler/rustc_middle/src/ty/mod.rs

-10
Original file line numberDiff line numberDiff line change
@@ -1625,16 +1625,6 @@ impl<'tcx> TyCtxt<'tcx> {
16251625
}
16261626
}
16271627

1628-
/// Whether the `def_id` is an associated type that was desugared from a
1629-
/// `#[const_trait]` or `impl_const`.
1630-
pub fn is_effects_desugared_assoc_ty(self, def_id: DefId) -> bool {
1631-
if let DefKind::AssocTy = self.def_kind(def_id) {
1632-
self.associated_item(def_id).is_effects_desugaring
1633-
} else {
1634-
false
1635-
}
1636-
}
1637-
16381628
pub fn find_field_index(self, ident: Ident, variant: &VariantDef) -> Option<FieldIdx> {
16391629
variant.fields.iter_enumerated().find_map(|(i, field)| {
16401630
self.hygienic_eq(ident, field.ident(self), variant.def_id).then_some(i)

Diff for: compiler/rustc_trait_selection/src/error_reporting/traits/suggestions.rs

-6
Original file line numberDiff line numberDiff line change
@@ -5226,12 +5226,6 @@ fn point_at_assoc_type_restriction<G: EmissionGuarantee>(
52265226
let ty::ClauseKind::Projection(proj) = clause else {
52275227
return;
52285228
};
5229-
// avoid ICEing since effects desugared associated types don't have names.
5230-
// this path should only be hit for `~const` on invalid places, so they
5231-
// will have an informative error already.
5232-
if tcx.is_effects_desugared_assoc_ty(proj.projection_term.def_id) {
5233-
return;
5234-
}
52355229
let name = tcx.item_name(proj.projection_term.def_id);
52365230
let mut predicates = generics.predicates.iter().peekable();
52375231
let mut prev: Option<&hir::WhereBoundPredicate<'_>> = None;

Diff for: compiler/rustc_ty_utils/src/assoc.rs

-4
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ fn associated_item_from_trait_item_ref(trait_item_ref: &hir::TraitItemRef) -> ty
143143
container: ty::TraitContainer,
144144
fn_has_self_parameter: has_self,
145145
opt_rpitit_info: None,
146-
is_effects_desugaring: false,
147146
}
148147
}
149148

@@ -163,7 +162,6 @@ fn associated_item_from_impl_item_ref(impl_item_ref: &hir::ImplItemRef) -> ty::A
163162
container: ty::ImplContainer,
164163
fn_has_self_parameter: has_self,
165164
opt_rpitit_info: None,
166-
is_effects_desugaring: false,
167165
}
168166
}
169167

@@ -275,7 +273,6 @@ fn associated_type_for_impl_trait_in_trait(
275273
fn_def_id: fn_def_id.to_def_id(),
276274
opaque_def_id: opaque_ty_def_id.to_def_id(),
277275
}),
278-
is_effects_desugaring: false,
279276
});
280277

281278
// Copy visility of the containing function.
@@ -327,7 +324,6 @@ fn associated_type_for_impl_trait_in_impl(
327324
container: ty::ImplContainer,
328325
fn_has_self_parameter: false,
329326
opt_rpitit_info: Some(ImplTraitInTraitData::Impl { fn_def_id: impl_fn_def_id.to_def_id() }),
330-
is_effects_desugaring: false,
331327
});
332328

333329
// Copy visility of the containing function.

0 commit comments

Comments
 (0)