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.
This commit is contained in:
commit
16b64938c2
12 changed files with 5 additions and 38 deletions
|
@ -9,7 +9,6 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
|
||||||
use rustc_span::Symbol;
|
use rustc_span::Symbol;
|
||||||
use rustc_span::def_id::{DefId, LocalDefId};
|
use rustc_span::def_id::{DefId, LocalDefId};
|
||||||
use rustc_span::hygiene::MacroKind;
|
use rustc_span::hygiene::MacroKind;
|
||||||
use rustc_span::symbol::kw;
|
|
||||||
|
|
||||||
use crate::definitions::DefPathData;
|
use crate::definitions::DefPathData;
|
||||||
use crate::hir;
|
use crate::hir;
|
||||||
|
@ -256,7 +255,6 @@ impl DefKind {
|
||||||
|
|
||||||
pub fn def_path_data(self, name: Symbol) -> DefPathData {
|
pub fn def_path_data(self, name: Symbol) -> DefPathData {
|
||||||
match self {
|
match self {
|
||||||
DefKind::Struct | DefKind::Union if name == kw::Empty => DefPathData::AnonAdt,
|
|
||||||
DefKind::Mod
|
DefKind::Mod
|
||||||
| DefKind::Struct
|
| DefKind::Struct
|
||||||
| DefKind::Union
|
| DefKind::Union
|
||||||
|
|
|
@ -289,8 +289,6 @@ pub enum DefPathData {
|
||||||
/// An existential `impl Trait` type node.
|
/// An existential `impl Trait` type node.
|
||||||
/// Argument position `impl Trait` have a `TypeNs` with their pretty-printed name.
|
/// Argument position `impl Trait` have a `TypeNs` with their pretty-printed name.
|
||||||
OpaqueTy,
|
OpaqueTy,
|
||||||
/// An anonymous struct or union type i.e. `struct { foo: Type }` or `union { bar: Type }`
|
|
||||||
AnonAdt,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Definitions {
|
impl Definitions {
|
||||||
|
@ -415,7 +413,7 @@ impl DefPathData {
|
||||||
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
|
TypeNs(name) | ValueNs(name) | MacroNs(name) | LifetimeNs(name) => Some(name),
|
||||||
|
|
||||||
Impl | ForeignMod | CrateRoot | Use | GlobalAsm | Closure | Ctor | AnonConst
|
Impl | ForeignMod | CrateRoot | Use | GlobalAsm | Closure | Ctor | AnonConst
|
||||||
| OpaqueTy | AnonAdt => None,
|
| OpaqueTy => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +436,6 @@ impl DefPathData {
|
||||||
Ctor => DefPathDataName::Anon { namespace: sym::constructor },
|
Ctor => DefPathDataName::Anon { namespace: sym::constructor },
|
||||||
AnonConst => DefPathDataName::Anon { namespace: sym::constant },
|
AnonConst => DefPathDataName::Anon { namespace: sym::constant },
|
||||||
OpaqueTy => DefPathDataName::Anon { namespace: sym::opaque },
|
OpaqueTy => DefPathDataName::Anon { namespace: sym::opaque },
|
||||||
AnonAdt => DefPathDataName::Anon { namespace: sym::anon_adt },
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2882,8 +2882,6 @@ pub enum TyKind<'hir> {
|
||||||
Never,
|
Never,
|
||||||
/// A tuple (`(A, B, C, D, ...)`).
|
/// A tuple (`(A, B, C, D, ...)`).
|
||||||
Tup(&'hir [Ty<'hir>]),
|
Tup(&'hir [Ty<'hir>]),
|
||||||
/// An anonymous struct or union type i.e. `struct { foo: Type }` or `union { foo: Type }`
|
|
||||||
AnonAdt(ItemId),
|
|
||||||
/// A path to a type definition (`module::module::...::Type`), or an
|
/// A path to a type definition (`module::module::...::Type`), or an
|
||||||
/// associated type (e.g., `<Vec<T> as Trait>::Type` or `<T>::Target`).
|
/// associated type (e.g., `<Vec<T> as Trait>::Type` or `<T>::Target`).
|
||||||
///
|
///
|
||||||
|
|
|
@ -904,9 +904,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) -> V::Resul
|
||||||
}
|
}
|
||||||
TyKind::Typeof(ref expression) => try_visit!(visitor.visit_anon_const(expression)),
|
TyKind::Typeof(ref expression) => try_visit!(visitor.visit_anon_const(expression)),
|
||||||
TyKind::Infer | TyKind::InferDelegation(..) | TyKind::Err(_) => {}
|
TyKind::Infer | TyKind::InferDelegation(..) | TyKind::Err(_) => {}
|
||||||
TyKind::AnonAdt(item_id) => {
|
|
||||||
try_visit!(visitor.visit_nested_item(item_id));
|
|
||||||
}
|
|
||||||
TyKind::Pat(ty, pat) => {
|
TyKind::Pat(ty, pat) => {
|
||||||
try_visit!(visitor.visit_ty(ty));
|
try_visit!(visitor.visit_ty(ty));
|
||||||
try_visit!(visitor.visit_pattern_type_pattern(pat));
|
try_visit!(visitor.visit_pattern_type_pattern(pat));
|
||||||
|
|
|
@ -50,7 +50,7 @@ use rustc_span::{DUMMY_SP, Span};
|
||||||
use rustc_trait_selection::infer::InferCtxtExt;
|
use rustc_trait_selection::infer::InferCtxtExt;
|
||||||
use rustc_trait_selection::traits::wf::object_region_bounds;
|
use rustc_trait_selection::traits::wf::object_region_bounds;
|
||||||
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
use rustc_trait_selection::traits::{self, ObligationCtxt};
|
||||||
use tracing::{debug, debug_span, instrument};
|
use tracing::{debug, instrument};
|
||||||
|
|
||||||
use crate::bounds::Bounds;
|
use crate::bounds::Bounds;
|
||||||
use crate::check::check_abi_fn_ptr;
|
use crate::check::check_abi_fn_ptr;
|
||||||
|
@ -2304,19 +2304,6 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
||||||
hir::TyKind::Tup(fields) => {
|
hir::TyKind::Tup(fields) => {
|
||||||
Ty::new_tup_from_iter(tcx, fields.iter().map(|t| self.lower_ty(t)))
|
Ty::new_tup_from_iter(tcx, fields.iter().map(|t| self.lower_ty(t)))
|
||||||
}
|
}
|
||||||
hir::TyKind::AnonAdt(item_id) => {
|
|
||||||
let _guard = debug_span!("AnonAdt");
|
|
||||||
|
|
||||||
let did = item_id.owner_id.def_id;
|
|
||||||
let adt_def = tcx.adt_def(did);
|
|
||||||
|
|
||||||
let args = ty::GenericArgs::for_item(tcx, did.to_def_id(), |param, _| {
|
|
||||||
tcx.mk_param_from_def(param)
|
|
||||||
});
|
|
||||||
debug!(?args);
|
|
||||||
|
|
||||||
Ty::new_adt(tcx, adt_def, tcx.mk_args(args))
|
|
||||||
}
|
|
||||||
hir::TyKind::BareFn(bf) => {
|
hir::TyKind::BareFn(bf) => {
|
||||||
require_c_abi_if_c_variadic(tcx, bf.decl, bf.abi, hir_ty.span);
|
require_c_abi_if_c_variadic(tcx, bf.decl, bf.abi, hir_ty.span);
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,6 @@ impl<'a> State<'a> {
|
||||||
hir::TyKind::Infer | hir::TyKind::InferDelegation(..) => {
|
hir::TyKind::Infer | hir::TyKind::InferDelegation(..) => {
|
||||||
self.word("_");
|
self.word("_");
|
||||||
}
|
}
|
||||||
hir::TyKind::AnonAdt(..) => self.word("/* anonymous adt */"),
|
|
||||||
hir::TyKind::Pat(ty, pat) => {
|
hir::TyKind::Pat(ty, pat) => {
|
||||||
self.print_type(ty);
|
self.print_type(ty);
|
||||||
self.word(" is ");
|
self.word(" is ");
|
||||||
|
|
|
@ -337,7 +337,6 @@ impl<'v> hir_visit::Visitor<'v> for StatCollector<'v> {
|
||||||
BareFn,
|
BareFn,
|
||||||
Never,
|
Never,
|
||||||
Tup,
|
Tup,
|
||||||
AnonAdt,
|
|
||||||
Path,
|
Path,
|
||||||
OpaqueDef,
|
OpaqueDef,
|
||||||
TraitObject,
|
TraitObject,
|
||||||
|
|
|
@ -716,8 +716,7 @@ fn encode_ty_name(tcx: TyCtxt<'_>, def_id: DefId) -> String {
|
||||||
| hir::definitions::DefPathData::Use
|
| hir::definitions::DefPathData::Use
|
||||||
| hir::definitions::DefPathData::GlobalAsm
|
| hir::definitions::DefPathData::GlobalAsm
|
||||||
| hir::definitions::DefPathData::MacroNs(..)
|
| hir::definitions::DefPathData::MacroNs(..)
|
||||||
| hir::definitions::DefPathData::LifetimeNs(..)
|
| hir::definitions::DefPathData::LifetimeNs(..) => {
|
||||||
| hir::definitions::DefPathData::AnonAdt => {
|
|
||||||
bug!("encode_ty_name: unexpected `{:?}`", disambiguated_data.data);
|
bug!("encode_ty_name: unexpected `{:?}`", disambiguated_data.data);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -772,8 +772,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
|
||||||
| DefPathData::GlobalAsm
|
| DefPathData::GlobalAsm
|
||||||
| DefPathData::Impl
|
| DefPathData::Impl
|
||||||
| DefPathData::MacroNs(_)
|
| DefPathData::MacroNs(_)
|
||||||
| DefPathData::LifetimeNs(_)
|
| DefPathData::LifetimeNs(_) => {
|
||||||
| DefPathData::AnonAdt => {
|
|
||||||
bug!("symbol_names: unexpected DefPathData: {:?}", disambiguated_data.data)
|
bug!("symbol_names: unexpected DefPathData: {:?}", disambiguated_data.data)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1841,9 +1841,6 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
|
||||||
TyKind::BareFn(barefn) => BareFunction(Box::new(clean_bare_fn_ty(barefn, cx))),
|
TyKind::BareFn(barefn) => BareFunction(Box::new(clean_bare_fn_ty(barefn, cx))),
|
||||||
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
|
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
|
||||||
TyKind::Infer | TyKind::Err(_) | TyKind::Typeof(..) | TyKind::InferDelegation(..) => Infer,
|
TyKind::Infer | TyKind::Err(_) | TyKind::Typeof(..) | TyKind::InferDelegation(..) => Infer,
|
||||||
TyKind::AnonAdt(..) => {
|
|
||||||
unimplemented!("Anonymous structs or unions are not supported yet")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -818,7 +818,6 @@ impl TyCoercionStability {
|
||||||
| TyKind::Typeof(..)
|
| TyKind::Typeof(..)
|
||||||
| TyKind::TraitObject(..)
|
| TyKind::TraitObject(..)
|
||||||
| TyKind::InferDelegation(..)
|
| TyKind::InferDelegation(..)
|
||||||
| TyKind::AnonAdt(..)
|
|
||||||
| TyKind::Err(_) => Self::Reborrow,
|
| TyKind::Err(_) => Self::Reborrow,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -596,7 +596,6 @@ impl HirEqInterExpr<'_, '_, '_> {
|
||||||
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
|
(TyKind::Path(l), TyKind::Path(r)) => self.eq_qpath(l, r),
|
||||||
(&TyKind::Tup(l), &TyKind::Tup(r)) => over(l, r, |l, r| self.eq_ty(l, r)),
|
(&TyKind::Tup(l), &TyKind::Tup(r)) => over(l, r, |l, r| self.eq_ty(l, r)),
|
||||||
(&TyKind::Infer, &TyKind::Infer) => true,
|
(&TyKind::Infer, &TyKind::Infer) => true,
|
||||||
(TyKind::AnonAdt(l_item_id), TyKind::AnonAdt(r_item_id)) => l_item_id == r_item_id,
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1246,8 +1245,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
||||||
| TyKind::Infer
|
| TyKind::Infer
|
||||||
| TyKind::Never
|
| TyKind::Never
|
||||||
| TyKind::InferDelegation(..)
|
| TyKind::InferDelegation(..)
|
||||||
| TyKind::OpaqueDef(_)
|
| TyKind::OpaqueDef(_) => {},
|
||||||
| TyKind::AnonAdt(_) => {},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue