Skip to content

Commit 020cca8

Browse files
committed
review comment: Remove AST AnonTy
1 parent 12d18e4 commit 020cca8

File tree

8 files changed

+4
-14
lines changed

8 files changed

+4
-14
lines changed

compiler/rustc_ast/src/ast.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2096,9 +2096,6 @@ pub enum TyKind {
20962096
Err,
20972097
/// Placeholder for a `va_list`.
20982098
CVarArgs,
2099-
/// Placeholder for "anonymous enums", which don't exist, but keeping their
2100-
/// information around lets us produce better diagnostics.
2101-
AnonEnum(Vec<P<Ty>>),
21022099
}
21032100

21042101
impl TyKind {

compiler/rustc_ast/src/mut_visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ pub fn noop_visit_ty<T: MutVisitor>(ty: &mut P<Ty>, vis: &mut T) {
470470
vis.visit_fn_decl(decl);
471471
vis.visit_span(decl_span);
472472
}
473-
TyKind::AnonEnum(tys) | TyKind::Tup(tys) => visit_vec(tys, |ty| vis.visit_ty(ty)),
473+
TyKind::Tup(tys) => visit_vec(tys, |ty| vis.visit_ty(ty)),
474474
TyKind::Paren(ty) => vis.visit_ty(ty),
475475
TyKind::Path(qself, path) => {
476476
vis.visit_qself(qself);

compiler/rustc_ast/src/visit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
400400
walk_list!(visitor, visit_lifetime, opt_lifetime, LifetimeCtxt::Ref);
401401
visitor.visit_ty(&mutable_type.ty)
402402
}
403-
TyKind::AnonEnum(tys) | TyKind::Tup(tys) => {
403+
TyKind::Tup(tys) => {
404404
walk_list!(visitor, visit_ty, tys);
405405
}
406406
TyKind::BareFn(function_declaration) => {

compiler/rustc_ast_lowering/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
12351235
let kind = match &t.kind {
12361236
TyKind::Infer => hir::TyKind::Infer,
12371237
TyKind::Err => hir::TyKind::Err,
1238-
TyKind::AnonEnum(_) => hir::TyKind::Err,
12391238
TyKind::Slice(ty) => hir::TyKind::Slice(self.lower_ty(ty, itctx)),
12401239
TyKind::Ptr(mt) => hir::TyKind::Ptr(self.lower_mt(mt, itctx)),
12411240
TyKind::Ref(region, mt) => {

compiler/rustc_ast_pretty/src/pprust/state.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1041,9 +1041,6 @@ impl<'a> State<'a> {
10411041
}
10421042
self.pclose();
10431043
}
1044-
ast::TyKind::AnonEnum(elts) => {
1045-
self.strsep("|", false, Inconsistent, elts, |s, ty| s.print_type(ty));
1046-
}
10471044
ast::TyKind::Paren(typ) => {
10481045
self.popen();
10491046
self.print_type(typ);

compiler/rustc_parse/src/parser/ty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ impl<'a> Parser<'a> {
390390
.join("\n"),
391391
));
392392
err.emit();
393-
return Ok(self.mk_ty(lo.to(self.prev_token.span), TyKind::AnonEnum(types)));
393+
return Ok(self.mk_ty(lo.to(self.prev_token.span), TyKind::Err));
394394
}
395395
if allow_qpath_recovery { self.maybe_recover_from_bad_qpath(ty) } else { Ok(ty) }
396396
}

compiler/rustc_passes/src/hir_stats.rs

-1
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,6 @@ impl<'v> ast_visit::Visitor<'v> for StatCollector<'v> {
579579
[
580580
Slice,
581581
Array,
582-
AnonEnum,
583582
Ptr,
584583
Ref,
585584
BareFn,

src/tools/rustfmt/src/types.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -839,9 +839,7 @@ impl Rewrite for ast::Ty {
839839
})
840840
}
841841
ast::TyKind::CVarArgs => Some("...".to_owned()),
842-
ast::TyKind::AnonEnum(_) | ast::TyKind::Err => {
843-
Some(context.snippet(self.span).to_owned())
844-
}
842+
ast::TyKind::Err => Some(context.snippet(self.span).to_owned()),
845843
ast::TyKind::Typeof(ref anon_const) => rewrite_call(
846844
context,
847845
"typeof",

0 commit comments

Comments
 (0)