Skip to content

Commit ea4a2de

Browse files
committed
Remove Representability.
Its last meaningful uses were removed in rust-lang#153493.
1 parent 801bc19 commit ea4a2de

4 files changed

Lines changed: 5 additions & 13 deletions

File tree

compiler/rustc_middle/src/queries.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ rustc_queries! {
580580
}
581581

582582
/// Checks whether a type is representable or infinitely sized
583-
query check_representability(key: LocalDefId) -> rustc_middle::ty::Representability {
583+
query check_representability(key: LocalDefId) {
584584
desc { "checking if `{}` is representable", tcx.def_path_str(key) }
585585
// Infinitely sized types will cause a cycle. The custom `FromCycleError` impl for
586586
// `Representability` will print a custom error about the infinite size and then abort
@@ -596,7 +596,7 @@ rustc_queries! {
596596

597597
/// An implementation detail for the `check_representability` query. See that query for more
598598
/// details, particularly on the modifiers.
599-
query check_representability_adt_ty(key: Ty<'tcx>) -> rustc_middle::ty::Representability {
599+
query check_representability_adt_ty(key: Ty<'tcx>) {
600600
desc { "checking if `{}` is representable", key }
601601
cycle_delay_bug
602602
anon

compiler/rustc_middle/src/query/erase.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ impl_erasable_for_simple_types! {
390390
rustc_middle::ty::Destructor,
391391
rustc_middle::ty::fast_reject::SimplifiedType,
392392
rustc_middle::ty::ImplPolarity,
393-
rustc_middle::ty::Representability,
394393
rustc_middle::ty::UnusedGenericParams,
395394
rustc_middle::ty::util::AlwaysRequiresDrop,
396395
rustc_middle::ty::Visibility<rustc_span::def_id::DefId>,

compiler/rustc_middle/src/ty/adt.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,3 @@ impl<'tcx> AdtDef<'tcx> {
751751
if self.is_struct() { tcx.adt_sizedness_constraint((self.did(), sizedness)) } else { None }
752752
}
753753
}
754-
755-
/// This type exists just so a `FromCycleError` impl can be made for the `check_representability`
756-
/// query.
757-
#[derive(Clone, Copy, Debug, HashStable)]
758-
pub struct Representability;

compiler/rustc_ty_utils/src/representability.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use rustc_hir::def::DefKind;
22
use rustc_index::bit_set::DenseBitSet;
33
use rustc_middle::bug;
44
use rustc_middle::query::Providers;
5-
use rustc_middle::ty::{self, Representability, Ty, TyCtxt};
5+
use rustc_middle::ty::{self, Ty, TyCtxt};
66
use rustc_span::def_id::LocalDefId;
77

88
pub(crate) fn provide(providers: &mut Providers) {
@@ -14,7 +14,7 @@ pub(crate) fn provide(providers: &mut Providers) {
1414
};
1515
}
1616

17-
fn check_representability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Representability {
17+
fn check_representability(tcx: TyCtxt<'_>, def_id: LocalDefId) {
1818
match tcx.def_kind(def_id) {
1919
DefKind::Struct | DefKind::Union | DefKind::Enum => {
2020
for variant in tcx.adt_def(def_id).variants() {
@@ -28,7 +28,6 @@ fn check_representability(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Representabili
2828
}
2929
def_kind => bug!("unexpected {def_kind:?}"),
3030
}
31-
Representability
3231
}
3332

3433
fn check_representability_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) {
@@ -67,7 +66,7 @@ fn check_representability_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) {
6766
// Looking at the query cycle above, we know that `Bar` is representable
6867
// because `check_representability_adt_ty(Bar<..>)` is in the cycle and
6968
// `check_representability(Bar)` is *not* in the cycle.
70-
fn check_representability_adt_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Representability {
69+
fn check_representability_adt_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) {
7170
let ty::Adt(adt, args) = ty.kind() else { bug!("expected adt") };
7271
if let Some(def_id) = adt.did().as_local() {
7372
let _ = tcx.check_representability(def_id);
@@ -82,7 +81,6 @@ fn check_representability_adt_ty<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Repre
8281
}
8382
}
8483
}
85-
Representability
8684
}
8785

8886
fn params_in_repr(tcx: TyCtxt<'_>, def_id: LocalDefId) -> DenseBitSet<u32> {

0 commit comments

Comments
 (0)