Skip to content

Commit 7c76747

Browse files
committed
rustdoc: Remove OpaqueTy
It turns out it's never constructed anywhere.
1 parent e2cf31a commit 7c76747

File tree

14 files changed

+6
-86
lines changed

14 files changed

+6
-86
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2735,10 +2735,6 @@ fn clean_maybe_renamed_item<'tcx>(
27352735
Box::new(clean_ty(ty, cx)),
27362736
Constant { kind: ConstantKind::Local { body: body_id, def_id } },
27372737
),
2738-
ItemKind::OpaqueTy(ref ty) => OpaqueTyItem(OpaqueTy {
2739-
bounds: ty.bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect(),
2740-
generics: clean_generics(ty.generics, cx),
2741-
}),
27422738
ItemKind::TyAlias(hir_ty, generics) => {
27432739
*cx.current_type_aliases.entry(def_id).or_insert(0) += 1;
27442740
let rustdoc_ty = clean_ty(hir_ty, cx);

src/librustdoc/clean/types.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,6 @@ pub(crate) enum ItemKind {
828828
FunctionItem(Box<Function>),
829829
ModuleItem(Module),
830830
TypeAliasItem(Box<TypeAlias>),
831-
OpaqueTyItem(OpaqueTy),
832831
StaticItem(Static),
833832
TraitItem(Box<Trait>),
834833
TraitAliasItem(TraitAlias),
@@ -886,7 +885,6 @@ impl ItemKind {
886885
| ImportItem(_)
887886
| FunctionItem(_)
888887
| TypeAliasItem(_)
889-
| OpaqueTyItem(_)
890888
| StaticItem(_)
891889
| ConstantItem(_, _, _)
892890
| TraitAliasItem(_)
@@ -920,7 +918,6 @@ impl ItemKind {
920918
| ExternCrateItem { .. }
921919
| FunctionItem(_)
922920
| TypeAliasItem(_)
923-
| OpaqueTyItem(_)
924921
| StaticItem(_)
925922
| ConstantItem(_, _, _)
926923
| TraitAliasItem(_)
@@ -2341,12 +2338,6 @@ pub(crate) struct TypeAlias {
23412338
pub(crate) item_type: Option<Type>,
23422339
}
23432340

2344-
#[derive(Clone, Debug)]
2345-
pub(crate) struct OpaqueTy {
2346-
pub(crate) bounds: Vec<GenericBound>,
2347-
pub(crate) generics: Generics,
2348-
}
2349-
23502341
#[derive(Clone, PartialEq, Eq, Debug, Hash)]
23512342
pub(crate) struct BareFunctionDecl {
23522343
pub(crate) safety: hir::Safety,

src/librustdoc/fold.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ pub(crate) trait DocFolder: Sized {
7777
ExternCrateItem { src: _ }
7878
| ImportItem(_)
7979
| FunctionItem(_)
80-
| OpaqueTyItem(_)
8180
| StaticItem(_)
8281
| ConstantItem(_, _, _)
8382
| TraitAliasItem(_)

src/librustdoc/formats/cache.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,6 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
462462

463463
clean::ExternCrateItem { .. }
464464
| clean::ImportItem(..)
465-
| clean::OpaqueTyItem(..)
466465
| clean::ImplItem(..)
467466
| clean::TyMethodItem(..)
468467
| clean::MethodItem(..)

src/librustdoc/formats/item_type.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub(crate) enum ItemType {
5252
AssocConst = 19,
5353
Union = 20,
5454
ForeignType = 21,
55-
OpaqueTy = 22,
55+
// OpaqueTy used to be here, but it was removed in #127276
5656
ProcAttribute = 23,
5757
ProcDerive = 24,
5858
TraitAlias = 25,
@@ -85,7 +85,6 @@ impl<'a> From<&'a clean::Item> for ItemType {
8585
clean::EnumItem(..) => ItemType::Enum,
8686
clean::FunctionItem(..) => ItemType::Function,
8787
clean::TypeAliasItem(..) => ItemType::TypeAlias,
88-
clean::OpaqueTyItem(..) => ItemType::OpaqueTy,
8988
clean::StaticItem(..) => ItemType::Static,
9089
clean::ConstantItem(..) => ItemType::Constant,
9190
clean::TraitItem(..) => ItemType::Trait,
@@ -192,7 +191,6 @@ impl ItemType {
192191
ItemType::AssocConst => "associatedconstant",
193192
ItemType::ForeignType => "foreigntype",
194193
ItemType::Keyword => "keyword",
195-
ItemType::OpaqueTy => "opaque",
196194
ItemType::ProcAttribute => "attr",
197195
ItemType::ProcDerive => "derive",
198196
ItemType::TraitAlias => "traitalias",

src/librustdoc/html/render/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ impl AllTypes {
382382
ItemType::Macro => self.macros.insert(ItemEntry::new(new_url, name)),
383383
ItemType::Function => self.functions.insert(ItemEntry::new(new_url, name)),
384384
ItemType::TypeAlias => self.type_aliases.insert(ItemEntry::new(new_url, name)),
385-
ItemType::OpaqueTy => self.opaque_tys.insert(ItemEntry::new(new_url, name)),
386385
ItemType::Static => self.statics.insert(ItemEntry::new(new_url, name)),
387386
ItemType::Constant => self.constants.insert(ItemEntry::new(new_url, name)),
388387
ItemType::ProcAttribute => {
@@ -2284,7 +2283,6 @@ fn item_ty_to_section(ty: ItemType) -> ItemSection {
22842283
ItemType::AssocConst => ItemSection::AssociatedConstants,
22852284
ItemType::ForeignType => ItemSection::ForeignTypes,
22862285
ItemType::Keyword => ItemSection::Keywords,
2287-
ItemType::OpaqueTy => ItemSection::OpaqueTypes,
22882286
ItemType::ProcAttribute => ItemSection::AttributeMacros,
22892287
ItemType::ProcDerive => ItemSection::DeriveMacros,
22902288
ItemType::TraitAlias => ItemSection::TraitAliases,

src/librustdoc/html/render/print_item.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ pub(super) fn print_item(cx: &mut Context<'_>, item: &clean::Item, buf: &mut Buf
202202
clean::ConstantItem(..) => "Constant ",
203203
clean::ForeignTypeItem => "Foreign Type ",
204204
clean::KeywordItem => "Keyword ",
205-
clean::OpaqueTyItem(..) => "Opaque Type ",
206205
clean::TraitAliasItem(..) => "Trait Alias ",
207206
_ => {
208207
// We don't generate pages for any other type.
@@ -270,7 +269,6 @@ pub(super) fn print_item(cx: &mut Context<'_>, item: &clean::Item, buf: &mut Buf
270269
clean::ConstantItem(generics, ty, c) => item_constant(buf, cx, item, generics, ty, c),
271270
clean::ForeignTypeItem => item_foreign_type(buf, cx, item),
272271
clean::KeywordItem => item_keyword(buf, cx, item),
273-
clean::OpaqueTyItem(ref e) => item_opaque_ty(buf, cx, item, e),
274272
clean::TraitAliasItem(ref ta) => item_trait_alias(buf, cx, item, ta),
275273
_ => {
276274
// We don't generate pages for any other type.
@@ -1210,35 +1208,6 @@ fn item_trait_alias(
12101208
.unwrap();
12111209
}
12121210

1213-
fn item_opaque_ty(
1214-
w: &mut impl fmt::Write,
1215-
cx: &mut Context<'_>,
1216-
it: &clean::Item,
1217-
t: &clean::OpaqueTy,
1218-
) {
1219-
wrap_item(w, |w| {
1220-
write!(
1221-
w,
1222-
"{attrs}type {name}{generics}{where_clause} = impl {bounds};",
1223-
attrs = render_attributes_in_pre(it, "", cx),
1224-
name = it.name.unwrap(),
1225-
generics = t.generics.print(cx),
1226-
where_clause = print_where_clause(&t.generics, cx, 0, Ending::Newline),
1227-
bounds = bounds(&t.bounds, false, cx),
1228-
)
1229-
.unwrap();
1230-
});
1231-
1232-
write!(w, "{}", document(cx, it, None, HeadingOffset::H2)).unwrap();
1233-
1234-
// Render any items associated directly to this alias, as otherwise they
1235-
// won't be visible anywhere in the docs. It would be nice to also show
1236-
// associated items from the aliased type (see discussion in #32077), but
1237-
// we need #14072 to make sense of the generics.
1238-
write!(w, "{}", render_assoc_items(cx, it, it.item_id.expect_def_id(), AssocItemRender::All))
1239-
.unwrap();
1240-
}
1241-
12421211
fn item_type_alias(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, t: &clean::TypeAlias) {
12431212
wrap_item(w, |w| {
12441213
write!(

src/librustdoc/json/conversions.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,6 @@ fn from_clean_item(item: clean::Item, tcx: TyCtxt<'_>) -> ItemEnum {
323323
ForeignStaticItem(s, _) => ItemEnum::Static(s.into_tcx(tcx)),
324324
ForeignTypeItem => ItemEnum::ForeignType,
325325
TypeAliasItem(t) => ItemEnum::TypeAlias(t.into_tcx(tcx)),
326-
OpaqueTyItem(t) => ItemEnum::OpaqueTy(t.into_tcx(tcx)),
327326
// FIXME(generic_const_items): Add support for generic free consts
328327
ConstantItem(_generics, t, c) => {
329328
ItemEnum::Constant { type_: (*t).into_tcx(tcx), const_: c.into_tcx(tcx) }
@@ -819,12 +818,6 @@ impl FromWithTcx<Box<clean::TypeAlias>> for TypeAlias {
819818
}
820819
}
821820

822-
impl FromWithTcx<clean::OpaqueTy> for OpaqueTy {
823-
fn from_tcx(opaque: clean::OpaqueTy, tcx: TyCtxt<'_>) -> Self {
824-
OpaqueTy { bounds: opaque.bounds.into_tcx(tcx), generics: opaque.generics.into_tcx(tcx) }
825-
}
826-
}
827-
828821
impl FromWithTcx<clean::Static> for Static {
829822
fn from_tcx(stat: clean::Static, tcx: TyCtxt<'_>) -> Self {
830823
Static {
@@ -856,7 +849,6 @@ impl FromWithTcx<ItemType> for ItemKind {
856849
Enum => ItemKind::Enum,
857850
Function | TyMethod | Method => ItemKind::Function,
858851
TypeAlias => ItemKind::TypeAlias,
859-
OpaqueTy => ItemKind::OpaqueTy,
860852
Static => ItemKind::Static,
861853
Constant => ItemKind::Constant,
862854
Trait => ItemKind::Trait,

src/librustdoc/json/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,6 @@ impl<'tcx> FormatRenderer<'tcx> for JsonRenderer<'tcx> {
185185
| types::ItemEnum::TraitAlias(_)
186186
| types::ItemEnum::Impl(_)
187187
| types::ItemEnum::TypeAlias(_)
188-
| types::ItemEnum::OpaqueTy(_)
189188
| types::ItemEnum::Constant { .. }
190189
| types::ItemEnum::Static(_)
191190
| types::ItemEnum::ForeignType

src/librustdoc/passes/stripper.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ impl<'a, 'tcx> DocFolder for Stripper<'a, 'tcx> {
4949
return Some(ret);
5050
}
5151
// These items can all get re-exported
52-
clean::OpaqueTyItem(..)
53-
| clean::TypeAliasItem(..)
52+
clean::TypeAliasItem(..)
5453
| clean::StaticItem(..)
5554
| clean::StructItem(..)
5655
| clean::EnumItem(..)

0 commit comments

Comments
 (0)