Skip to content

Commit 4201fd2

Browse files
committed
Remove associated opaque types
They're unused now.
1 parent 4e49e67 commit 4201fd2

File tree

36 files changed

+116
-300
lines changed

36 files changed

+116
-300
lines changed

src/librustc_hir/def.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,11 @@ pub enum DefKind {
5454
/// Refers to the variant itself, `DefKind::Ctor` refers to its constructor if it exists.
5555
Variant,
5656
Trait,
57-
/// `type Foo = impl Bar;`
58-
OpaqueTy,
5957
/// `type Foo = Bar;`
6058
TyAlias,
6159
ForeignTy,
6260
TraitAlias,
6361
AssocTy,
64-
/// `type Foo = impl Bar;`
65-
AssocOpaqueTy,
6662
TyParam,
6763

6864
// Value namespace
@@ -83,6 +79,7 @@ pub enum DefKind {
8379
Use,
8480
ForeignMod,
8581
AnonConst,
82+
OpaqueTy,
8683
Field,
8784
LifetimeParam,
8885
GlobalAsm,
@@ -115,7 +112,6 @@ impl DefKind {
115112
DefKind::TyAlias => "type alias",
116113
DefKind::TraitAlias => "trait alias",
117114
DefKind::AssocTy => "associated type",
118-
DefKind::AssocOpaqueTy => "associated opaque type",
119115
DefKind::Union => "union",
120116
DefKind::Trait => "trait",
121117
DefKind::ForeignTy => "foreign type",
@@ -143,7 +139,6 @@ impl DefKind {
143139
match *self {
144140
DefKind::AssocTy
145141
| DefKind::AssocConst
146-
| DefKind::AssocOpaqueTy
147142
| DefKind::AssocFn
148143
| DefKind::Enum
149144
| DefKind::OpaqueTy
@@ -168,7 +163,6 @@ impl DefKind {
168163
| DefKind::ForeignTy
169164
| DefKind::TraitAlias
170165
| DefKind::AssocTy
171-
| DefKind::AssocOpaqueTy
172166
| DefKind::TyParam => ns == Namespace::TypeNS,
173167

174168
DefKind::Fn

src/librustc_hir/hir.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1919,14 +1919,12 @@ pub enum ImplItemKind<'hir> {
19191919
Fn(FnSig<'hir>, BodyId),
19201920
/// An associated type.
19211921
TyAlias(&'hir Ty<'hir>),
1922-
/// An associated `type = impl Trait`.
1923-
OpaqueTy(GenericBounds<'hir>),
19241922
}
19251923

19261924
impl ImplItemKind<'_> {
19271925
pub fn namespace(&self) -> Namespace {
19281926
match self {
1929-
ImplItemKind::OpaqueTy(..) | ImplItemKind::TyAlias(..) => Namespace::TypeNS,
1927+
ImplItemKind::TyAlias(..) => Namespace::TypeNS,
19301928
ImplItemKind::Const(..) | ImplItemKind::Fn(..) => Namespace::ValueNS,
19311929
}
19321930
}
@@ -2016,8 +2014,6 @@ pub struct OpaqueTy<'hir> {
20162014
/// From whence the opaque type came.
20172015
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]
20182016
pub enum OpaqueTyOrigin {
2019-
/// `type Foo = impl Trait;`
2020-
TypeAlias,
20212017
/// `-> impl Trait`
20222018
FnReturn,
20232019
/// `async fn`
@@ -2614,7 +2610,6 @@ pub enum AssocItemKind {
26142610
Const,
26152611
Fn { has_self: bool },
26162612
Type,
2617-
OpaqueTy,
26182613
}
26192614

26202615
#[derive(RustcEncodable, RustcDecodable, Debug, HashStable_Generic)]

src/librustc_hir/intravisit.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,10 +1007,6 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
10071007
visitor.visit_id(impl_item.hir_id);
10081008
visitor.visit_ty(ty);
10091009
}
1010-
ImplItemKind::OpaqueTy(bounds) => {
1011-
visitor.visit_id(impl_item.hir_id);
1012-
walk_list!(visitor, visit_param_bound, bounds);
1013-
}
10141010
}
10151011
}
10161012

src/librustc_hir_pretty/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,12 +1003,6 @@ impl<'a> State<'a> {
10031003
hir::ImplItemKind::TyAlias(ref ty) => {
10041004
self.print_associated_type(ii.ident, &ii.generics, None, Some(ty));
10051005
}
1006-
hir::ImplItemKind::OpaqueTy(bounds) => {
1007-
self.word_space("type");
1008-
self.print_ident(ii.ident);
1009-
self.print_bounds("= impl", bounds);
1010-
self.s.word(";");
1011-
}
10121006
}
10131007
self.ann.post(self, AnnNode::SubItem(ii.hir_id))
10141008
}

src/librustc_incremental/persist/dirty_clean.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,6 @@ impl DirtyCleanVisitor<'tcx> {
336336
ImplItemKind::Fn(..) => ("Node::ImplItem", LABELS_FN_IN_IMPL),
337337
ImplItemKind::Const(..) => ("NodeImplConst", LABELS_CONST_IN_IMPL),
338338
ImplItemKind::TyAlias(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
339-
ImplItemKind::OpaqueTy(..) => ("NodeImplType", LABELS_CONST_IN_IMPL),
340339
},
341340
_ => self.tcx.sess.span_fatal(
342341
attr.span,

src/librustc_infer/infer/error_reporting/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,9 +224,7 @@ fn trait_item_scope_tag(item: &hir::TraitItem<'_>) -> &'static str {
224224
fn impl_item_scope_tag(item: &hir::ImplItem<'_>) -> &'static str {
225225
match item.kind {
226226
hir::ImplItemKind::Fn(..) => "method body",
227-
hir::ImplItemKind::Const(..)
228-
| hir::ImplItemKind::OpaqueTy(..)
229-
| hir::ImplItemKind::TyAlias(..) => "associated item",
227+
hir::ImplItemKind::Const(..) | hir::ImplItemKind::TyAlias(..) => "associated item",
230228
}
231229
}
232230

src/librustc_metadata/rmeta/decoder.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ impl EntryKind {
579579
EntryKind::ConstParam => DefKind::ConstParam,
580580
EntryKind::OpaqueTy => DefKind::OpaqueTy,
581581
EntryKind::AssocType(_) => DefKind::AssocTy,
582-
EntryKind::AssocOpaqueTy(_) => DefKind::AssocOpaqueTy,
583582
EntryKind::Mod(_) => DefKind::Mod,
584583
EntryKind::Variant(_) => DefKind::Variant,
585584
EntryKind::Trait(_) => DefKind::Trait,
@@ -1145,7 +1144,6 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
11451144
(ty::AssocKind::Fn, data.container, data.has_self)
11461145
}
11471146
EntryKind::AssocType(container) => (ty::AssocKind::Type, container, false),
1148-
EntryKind::AssocOpaqueTy(container) => (ty::AssocKind::OpaqueTy, container, false),
11491147
_ => bug!("cannot get associated-item of `{:?}`", def_key),
11501148
};
11511149

src/librustc_metadata/rmeta/encoder.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -874,7 +874,6 @@ impl EncodeContext<'tcx> {
874874
}))
875875
}
876876
ty::AssocKind::Type => EntryKind::AssocType(container),
877-
ty::AssocKind::OpaqueTy => span_bug!(ast_item.span, "opaque type in trait"),
878877
});
879878
record!(self.tables.visibility[def_id] <- trait_item.vis);
880879
record!(self.tables.span[def_id] <- ast_item.span);
@@ -892,7 +891,6 @@ impl EncodeContext<'tcx> {
892891
self.encode_item_type(def_id);
893892
}
894893
}
895-
ty::AssocKind::OpaqueTy => unreachable!(),
896894
}
897895
if trait_item.kind == ty::AssocKind::Fn {
898896
record!(self.tables.fn_sig[def_id] <- tcx.fn_sig(def_id));
@@ -957,7 +955,6 @@ impl EncodeContext<'tcx> {
957955
has_self: impl_item.fn_has_self_parameter,
958956
}))
959957
}
960-
ty::AssocKind::OpaqueTy => EntryKind::AssocOpaqueTy(container),
961958
ty::AssocKind::Type => EntryKind::AssocType(container)
962959
});
963960
record!(self.tables.visibility[def_id] <- impl_item.vis);
@@ -989,7 +986,7 @@ impl EncodeContext<'tcx> {
989986
let always_encode_mir = self.tcx.sess.opts.debugging_opts.always_encode_mir;
990987
needs_inline || is_const_fn || always_encode_mir
991988
}
992-
hir::ImplItemKind::OpaqueTy(..) | hir::ImplItemKind::TyAlias(..) => false,
989+
hir::ImplItemKind::TyAlias(..) => false,
993990
};
994991
if mir {
995992
self.encode_optimized_mir(def_id.expect_local());
@@ -1786,7 +1783,7 @@ impl<'tcx, 'v> ParItemLikeVisitor<'v> for PrefetchVisitor<'tcx> {
17861783
self.prefetch_mir(def_id)
17871784
}
17881785
}
1789-
hir::ImplItemKind::OpaqueTy(..) | hir::ImplItemKind::TyAlias(..) => (),
1786+
hir::ImplItemKind::TyAlias(..) => (),
17901787
}
17911788
}
17921789
}

src/librustc_metadata/rmeta/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,6 @@ enum EntryKind {
308308
Impl(Lazy<ImplData>),
309309
AssocFn(Lazy<AssocFnData>),
310310
AssocType(AssocContainer),
311-
AssocOpaqueTy(AssocContainer),
312311
AssocConst(AssocContainer, mir::ConstQualifs, Lazy<RenderedConst>),
313312
TraitAlias,
314313
}

src/librustc_middle/hir/map/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ impl<'hir> Map<'hir> {
228228
ImplItemKind::Const(..) => DefKind::AssocConst,
229229
ImplItemKind::Fn(..) => DefKind::AssocFn,
230230
ImplItemKind::TyAlias(..) => DefKind::AssocTy,
231-
ImplItemKind::OpaqueTy(..) => DefKind::AssocOpaqueTy,
232231
},
233232
Node::Variant(_) => DefKind::Variant,
234233
Node::Ctor(variant_data) => {
@@ -1023,9 +1022,6 @@ fn hir_id_to_string(map: &Map<'_>, id: HirId) -> String {
10231022
ImplItemKind::TyAlias(_) => {
10241023
format!("assoc type {} in {}{}", ii.ident, path_str(), id_str)
10251024
}
1026-
ImplItemKind::OpaqueTy(_) => {
1027-
format!("assoc opaque type {} in {}{}", ii.ident, path_str(), id_str)
1028-
}
10291025
},
10301026
Some(Node::TraitItem(ti)) => {
10311027
let kind = match ti.kind {

0 commit comments

Comments
 (0)