review comment: Remove AST AnonTy

This commit is contained in:
Esteban Küber 2023-01-23 14:29:53 +00:00
parent 12d18e4031
commit 020cca8d36
8 changed files with 4 additions and 14 deletions

View File

@ -2096,9 +2096,6 @@ pub enum TyKind {
Err,
/// Placeholder for a `va_list`.
CVarArgs,
/// Placeholder for "anonymous enums", which don't exist, but keeping their
/// information around lets us produce better diagnostics.
AnonEnum(Vec<P<Ty>>),
}
impl TyKind {

View File

@ -470,7 +470,7 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
vis.visit_fn_decl(decl);
vis.visit_span(decl_span);
}
TyKind::AnonEnum(tys) | TyKind::Tup(tys) => visit_vec(tys, |ty| vis.visit_ty(ty)),
TyKind::Tup(tys) => visit_vec(tys, |ty| vis.visit_ty(ty)),
TyKind::Paren(ty) => vis.visit_ty(ty),
TyKind::Path(qself, path) => {
vis.visit_qself(qself);

View File

@ -400,7 +400,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
visitor.visit_ty(&mutable_type.ty)
}
TyKind::AnonEnum(tys) | TyKind::Tup(tys) => {
TyKind::Tup(tys) => {
walk_list!(visitor, visit_ty, tys);
}
TyKind::BareFn(function_declaration) => {

View File

@ -1235,7 +1235,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
let kind = match &t.kind {
TyKind::Infer => hir::TyKind::Infer,
TyKind::Err => hir::TyKind::Err,
TyKind::AnonEnum(_) => hir::TyKind::Err,
TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)),
TyKind::Ref(region, mt) => {

View File

@ -1041,9 +1041,6 @@ impl<'a> State<'a> {
}
self.pclose();
}
ast::TyKind::AnonEnum(elts) => {
self.strsep("|", false, Inconsistent, elts, |s, ty| s.print_type(ty));
}
ast::TyKind::Paren(typ) => {
self.popen();
self.print_type(typ);

View File

@ -390,7 +390,7 @@ impl<'a> Parser<'a> {
.join("\n"),
));
err.emit();
return Ok(self.mk_ty(lo.to(self.prev_token.span), TyKind::AnonEnum(types)));
return Ok(self.mk_ty(lo.to(self.prev_token.span), TyKind::Err));
}
if allow_qpath_recovery { self.maybe_recover_from_bad_qpath(ty) } else { Ok(ty) }
}

View File

@ -579,7 +579,6 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
[
Slice,
Array,
AnonEnum,
Ptr,
Ref,
BareFn,

View File

@ -839,9 +839,7 @@ impl Rewrite for ast::Ty {
})
}
ast::TyKind::CVarArgs => Some("...".to_owned()),
ast::TyKind::AnonEnum(_) | ast::TyKind::Err => {
Some(context.snippet(self.span).to_owned())
}
ast::TyKind::Err => Some(context.snippet(self.span).to_owned()),
ast::TyKind::Typeof(ref anon_const) => rewrite_call(
context,
"typeof",