Skip to content

Commit 16b6493

Browse files
authored
Rollup merge of #134141 - compiler-errors:anon-adt, r=lqd
Remove more traces of anonymous ADTs Anonymous ADTs were removed in #131045, but I forgot to remove this.
2 parents 2891a92 + 916d279 commit 16b6493

File tree

12 files changed

+5
-38
lines changed

12 files changed

+5
-38
lines changed

compiler/rustc_hir/src/def.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
99
use rustc_span::Symbol;
1010
use rustc_span::def_id::{DefId, LocalDefId};
1111
use rustc_span::hygiene::MacroKind;
12-
use rustc_span::symbol::kw;
1312

1413
use crate::definitions::DefPathData;
1514
use crate::hir;
@@ -256,7 +255,6 @@ impl DefKind {
256255

257256
pub fn def_path_data(self, name: Symbol) -> DefPathData {
258257
match self {
259-
DefKind::Struct | DefKind::Union if name == kw::Empty => DefPathData::AnonAdt,
260258
DefKind::Mod
261259
| DefKind::Struct
262260
| DefKind::Union

compiler/rustc_hir/src/definitions.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,6 @@ pub enum DefPathData {
289289
/// An existential `impl Trait` type node.
290290
/// Argument position `impl Trait` have a `TypeNs` with their pretty-printed name.
291291
OpaqueTy,
292-
/// An anonymous struct or union type i.e. `struct { foo: Type }` or `union { bar: Type }`
293-
AnonAdt,
294292
}
295293

296294
impl Definitions {
@@ -415,7 +413,7 @@ impl DefPathData {
415413
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
416414

417415
Impl | ForeignMod | CrateRoot | Use | GlobalAsm | Closure | Ctor | AnonConst
418-
| OpaqueTy | AnonAdt => None,
416+
| OpaqueTy => None,
419417
}
420418
}
421419

@@ -438,7 +436,6 @@ impl DefPathData {
438436
Ctor => DefPathDataName::Anon { namespace: sym::constructor },
439437
AnonConst => DefPathDataName::Anon { namespace: sym::constant },
440438
OpaqueTy => DefPathDataName::Anon { namespace: sym::opaque },
441-
AnonAdt => DefPathDataName::Anon { namespace: sym::anon_adt },
442439
}
443440
}
444441
}

compiler/rustc_hir/src/hir.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2882,8 +2882,6 @@ pub enum TyKind<'hir> {
28822882
Never,
28832883
/// A tuple (`(A, B, C, D, ...)`).
28842884
Tup(&'hir [Ty<'hir>]),
2885-
/// An anonymous struct or union type i.e. `struct { foo: Type }` or `union { foo: Type }`
2886-
AnonAdt(ItemId),
28872885
/// A path to a type definition (`module::module::...::Type`), or an
28882886
/// associated type (e.g., `<Vec<T> as Trait>::Type` or `<T>::Target`).
28892887
///

compiler/rustc_hir/src/intravisit.rs

-3
Original file line numberDiff line numberDiff line change
@@ -904,9 +904,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
904904
}
905905
TyKind::Typeof(ref expression) => try_visit!(visitor.visit_anon_const(expression)),
906906
TyKind::Infer | TyKind::InferDelegation(..) | TyKind::Err(_) => {}
907-
TyKind::AnonAdt(item_id) => {
908-
try_visit!(visitor.visit_nested_item(item_id));
909-
}
910907
TyKind::Pat(ty, pat) => {
911908
try_visit!(visitor.visit_ty(ty));
912909
try_visit!(visitor.visit_pattern_type_pattern(pat));

compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs

+1-14
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ use rustc_span::{DUMMY_SP, Span};
5050
use rustc_trait_selection::infer::InferCtxtExt;
5151
use rustc_trait_selection::traits::wf::object_region_bounds;
5252
use rustc_trait_selection::traits::{self, ObligationCtxt};
53-
use tracing::{debug, debug_span, instrument};
53+
use tracing::{debug, instrument};
5454

5555
use crate::bounds::Bounds;
5656
use crate::check::check_abi_fn_ptr;
@@ -2304,19 +2304,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
23042304
hir::TyKind::Tup(fields) => {
23052305
Ty::new_tup_from_iter(tcx, fields.iter().map(|t| self.lower_ty(t)))
23062306
}
2307-
hir::TyKind::AnonAdt(item_id) => {
2308-
let _guard = debug_span!("AnonAdt");
2309-
2310-
let did = item_id.owner_id.def_id;
2311-
let adt_def = tcx.adt_def(did);
2312-
2313-
let args = ty::GenericArgs::for_item(tcx, did.to_def_id(), |param, _| {
2314-
tcx.mk_param_from_def(param)
2315-
});
2316-
debug!(?args);
2317-
2318-
Ty::new_adt(tcx, adt_def, tcx.mk_args(args))
2319-
}
23202307
hir::TyKind::BareFn(bf) => {
23212308
require_c_abi_if_c_variadic(tcx, bf.decl, bf.abi, hir_ty.span);
23222309

compiler/rustc_hir_pretty/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ impl<'a> State<'a> {
330330
hir::TyKind::Infer | hir::TyKind::InferDelegation(..) => {
331331
self.word("_");
332332
}
333-
hir::TyKind::AnonAdt(..) => self.word("/* anonymous adt */"),
334333
hir::TyKind::Pat(ty, pat) => {
335334
self.print_type(ty);
336335
self.word(" is ");

compiler/rustc_passes/src/input_stats.rs

-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
337337
BareFn,
338338
Never,
339339
Tup,
340-
AnonAdt,
341340
Path,
342341
OpaqueDef,
343342
TraitObject,

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/encode.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,7 @@ fn encode_ty_name(tcx: TyCtxt<'_>, def_id: DefId) -> String {
716716
| hir::definitions::DefPathData::Use
717717
| hir::definitions::DefPathData::GlobalAsm
718718
| hir::definitions::DefPathData::MacroNs(..)
719-
| hir::definitions::DefPathData::LifetimeNs(..)
720-
| hir::definitions::DefPathData::AnonAdt => {
719+
| hir::definitions::DefPathData::LifetimeNs(..) => {
721720
bug!("encode_ty_name: unexpected `{:?}`", disambiguated_data.data);
722721
}
723722
});

compiler/rustc_symbol_mangling/src/v0.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -772,8 +772,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
772772
| DefPathData::GlobalAsm
773773
| DefPathData::Impl
774774
| DefPathData::MacroNs(_)
775-
| DefPathData::LifetimeNs(_)
776-
| DefPathData::AnonAdt => {
775+
| DefPathData::LifetimeNs(_) => {
777776
bug!("symbol_names: unexpected DefPathData: {:?}", disambiguated_data.data)
778777
}
779778
};

src/librustdoc/clean/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1841,9 +1841,6 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
18411841
TyKind::BareFn(barefn) => BareFunction(Box::new(clean_bare_fn_ty(barefn, cx))),
18421842
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
18431843
TyKind::Infer | TyKind::Err(_) | TyKind::Typeof(..) | TyKind::InferDelegation(..) => Infer,
1844-
TyKind::AnonAdt(..) => {
1845-
unimplemented!("Anonymous structs or unions are not supported yet")
1846-
}
18471844
}
18481845
}
18491846

src/tools/clippy/clippy_lints/src/dereference.rs

-1
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,6 @@ impl TyCoercionStability {
818818
| TyKind::Typeof(..)
819819
| TyKind::TraitObject(..)
820820
| TyKind::InferDelegation(..)
821-
| TyKind::AnonAdt(..)
822821
| TyKind::Err(_) => Self::Reborrow,
823822
};
824823
}

src/tools/clippy/clippy_utils/src/hir_utils.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,6 @@ impl HirEqInterExpr<'_, '_, '_> {
596596
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
597597
(&TyKind::Tup(l), &TyKind::Tup(r)) => over(l, r, |l, r| self.eq_ty(l, r)),
598598
(&TyKind::Infer, &TyKind::Infer) => true,
599-
(TyKind::AnonAdt(l_item_id), TyKind::AnonAdt(r_item_id)) => l_item_id == r_item_id,
600599
_ => false,
601600
}
602601
}
@@ -1246,8 +1245,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12461245
| TyKind::Infer
12471246
| TyKind::Never
12481247
| TyKind::InferDelegation(..)
1249-
| TyKind::OpaqueDef(_)
1250-
| TyKind::AnonAdt(_) => {},
1248+
| TyKind::OpaqueDef(_) => {},
12511249
}
12521250
}
12531251

0 commit comments

Comments
 (0)