diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index 116497109f1dd..48c6009131abd 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -94,7 +94,6 @@ pub struct Path { /// The segments in the path: the things separated by `::`. /// Global paths begin with `kw::PathRoot`. pub segments: Vec, - pub tokens: Option, } impl PartialEq for Path { @@ -117,7 +116,7 @@ impl Path { // Convert a span and an identifier to the corresponding // one-segment path. pub fn from_ident(ident: Ident) -> Path { - Path { segments: vec![PathSegment::from_ident(ident)], span: ident.span, tokens: None } + Path { segments: vec![PathSegment::from_ident(ident)], span: ident.span } } pub fn is_global(&self) -> bool { @@ -567,7 +566,6 @@ pub struct Block { /// Distinguishes between `unsafe { ... }` and `{ ... }`. pub rules: BlockCheckMode, pub span: Span, - pub tokens: Option, /// The following *isn't* a parse error, but will cause multiple errors in following stages. /// ```compile_fail /// let x = { @@ -586,7 +584,6 @@ pub struct Pat { pub id: NodeId, pub kind: PatKind, pub span: Span, - pub tokens: Option, } impl Pat { @@ -622,7 +619,7 @@ impl Pat { _ => return None, }; - Some(P(Ty { kind, id: self.id, span: self.span, tokens: None })) + Some(P(Ty { kind, id: self.id, span: self.span })) } /// Walk top-down and call `it` in each place where a pattern occurs @@ -1108,7 +1105,6 @@ pub struct Expr { pub kind: ExprKind, pub span: Span, pub attrs: AttrVec, - pub tokens: Option, } impl Expr { @@ -1213,7 +1209,7 @@ impl Expr { _ => return None, }; - Some(P(Ty { kind, id: self.id, span: self.span, tokens: None })) + Some(P(Ty { kind, id: self.id, span: self.span })) } pub fn precedence(&self) -> ExprPrecedence { @@ -1265,13 +1261,7 @@ impl Expr { pub fn take(&mut self) -> Self { mem::replace( self, - Expr { - id: DUMMY_NODE_ID, - kind: ExprKind::Err, - span: DUMMY_SP, - attrs: ThinVec::new(), - tokens: None, - }, + Expr { id: DUMMY_NODE_ID, kind: ExprKind::Err, span: DUMMY_SP, attrs: ThinVec::new() }, ) } @@ -1966,17 +1956,11 @@ pub struct Ty { pub id: NodeId, pub kind: TyKind, pub span: Span, - pub tokens: Option, } impl Clone for Ty { fn clone(&self) -> Self { - ensure_sufficient_stack(|| Self { - id: self.id, - kind: self.kind.clone(), - span: self.span, - tokens: self.tokens.clone(), - }) + ensure_sufficient_stack(|| Self { id: self.id, kind: self.kind.clone(), span: self.span }) } } @@ -2259,14 +2243,13 @@ impl Param { /// Builds a `Param` object from `ExplicitSelf`. pub fn from_self(attrs: AttrVec, eself: ExplicitSelf, eself_ident: Ident) -> Param { let span = eself.span.to(eself_ident.span); - let infer_ty = P(Ty { id: DUMMY_NODE_ID, kind: TyKind::ImplicitSelf, span, tokens: None }); + let infer_ty = P(Ty { id: DUMMY_NODE_ID, kind: TyKind::ImplicitSelf, span }); let param = |mutbl, ty| Param { attrs, pat: P(Pat { id: DUMMY_NODE_ID, kind: PatKind::Ident(BindingMode::ByValue(mutbl), eself_ident, None), span, - tokens: None, }), span, ty, @@ -2282,7 +2265,6 @@ impl Param { id: DUMMY_NODE_ID, kind: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl }), span, - tokens: None, }), ), } @@ -2596,7 +2578,6 @@ impl PolyTraitRef { pub struct Visibility { pub kind: VisibilityKind, pub span: Span, - pub tokens: Option, } #[derive(Clone, Encodable, Decodable, Debug)] @@ -3031,21 +3012,21 @@ pub type ForeignItem = Item; mod size_asserts { use super::*; // These are in alphabetical order, which is easy to maintain. - rustc_data_structures::static_assert_size!(AssocItemKind, 72); - rustc_data_structures::static_assert_size!(Attribute, 152); - rustc_data_structures::static_assert_size!(Block, 48); - rustc_data_structures::static_assert_size!(Expr, 104); + rustc_data_structures::static_assert_size!(AssocItemKind, 64); + rustc_data_structures::static_assert_size!(Attribute, 144); + rustc_data_structures::static_assert_size!(Block, 40); + rustc_data_structures::static_assert_size!(Expr, 96); rustc_data_structures::static_assert_size!(Fn, 192); - rustc_data_structures::static_assert_size!(ForeignItemKind, 72); - rustc_data_structures::static_assert_size!(GenericBound, 88); + rustc_data_structures::static_assert_size!(ForeignItemKind, 64); + rustc_data_structures::static_assert_size!(GenericBound, 80); rustc_data_structures::static_assert_size!(Generics, 72); - rustc_data_structures::static_assert_size!(Impl, 200); - rustc_data_structures::static_assert_size!(Item, 200); + rustc_data_structures::static_assert_size!(Impl, 192); + rustc_data_structures::static_assert_size!(Item, 192); rustc_data_structures::static_assert_size!(ItemKind, 112); rustc_data_structures::static_assert_size!(Lit, 48); - rustc_data_structures::static_assert_size!(Pat, 120); - rustc_data_structures::static_assert_size!(Path, 40); + rustc_data_structures::static_assert_size!(Pat, 104); + rustc_data_structures::static_assert_size!(Path, 32); rustc_data_structures::static_assert_size!(PathSegment, 24); rustc_data_structures::static_assert_size!(Stmt, 32); - rustc_data_structures::static_assert_size!(Ty, 96); + rustc_data_structures::static_assert_size!(Ty, 80); } diff --git a/compiler/rustc_ast/src/ast_traits.rs b/compiler/rustc_ast/src/ast_traits.rs index 5c30a75a140a4..38ae31fa16b5b 100644 --- a/compiler/rustc_ast/src/ast_traits.rs +++ b/compiler/rustc_ast/src/ast_traits.rs @@ -158,8 +158,22 @@ macro_rules! impl_has_tokens_none { }; } -impl_has_tokens!(AssocItem, AttrItem, Block, Expr, ForeignItem, Item, Pat, Path, Ty, Visibility); -impl_has_tokens_none!(Arm, ExprField, FieldDef, GenericParam, Param, PatField, Variant); +impl_has_tokens!(AssocItem, AttrItem, ForeignItem, Item); +impl_has_tokens_none!( + Arm, + Block, + Expr, + ExprField, + FieldDef, + GenericParam, + Param, + Pat, + Path, + PatField, + Ty, + Variant, + Visibility +); impl> HasTokens for T { fn tokens(&self) -> Option<&LazyTokenStream> { diff --git a/compiler/rustc_ast/src/attr/mod.rs b/compiler/rustc_ast/src/attr/mod.rs index 86af7769d1b0b..5bb5112a92e0b 100644 --- a/compiler/rustc_ast/src/attr/mod.rs +++ b/compiler/rustc_ast/src/attr/mod.rs @@ -444,7 +444,7 @@ impl MetaItem { } } let span = span.with_hi(segments.last().unwrap().ident.span.hi()); - Path { span, segments, tokens: None } + Path { span, segments } } Some(TokenTree::Token(Token { kind: token::Interpolated(nt), .. }, _)) => match *nt { token::Nonterminal::NtMeta(ref item) => return item.meta(item.path.span), @@ -485,7 +485,6 @@ impl MetaItemKind { kind: ast::ExprKind::Lit(lit.clone()), span: lit.span, attrs: ThinVec::new(), - tokens: None, }); MacArgs::Eq(span, MacArgsEq::Ast(expr)) } diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs index 01bd498b37780..2d80bf0de9092 100644 --- a/compiler/rustc_ast/src/mut_visit.rs +++ b/compiler/rustc_ast/src/mut_visit.rs @@ -453,7 +453,7 @@ pub fn noop_visit_constraint( } pub fn noop_visit_ty(ty: &mut P, vis: &mut T) { - let Ty { id, kind, span, tokens } = ty.deref_mut(); + let Ty { id, kind, span } = ty.deref_mut(); vis.visit_id(id); match kind { TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err | TyKind::Never | TyKind::CVarArgs => {} @@ -491,7 +491,7 @@ pub fn noop_visit_ty(ty: &mut P, vis: &mut T) { TyKind::MacCall(mac) => vis.visit_mac_call(mac), } vis.visit_span(span); - visit_lazy_tts(tokens, vis); + visit_lazy_tts(&mut None, vis); } pub fn noop_visit_foreign_mod(foreign_mod: &mut ForeignMod, vis: &mut T) { @@ -519,14 +519,14 @@ pub fn noop_visit_ident(Ident { name: _, span }: &mut Ident, vis: vis.visit_span(span); } -pub fn noop_visit_path(Path { segments, span, tokens }: &mut Path, vis: &mut T) { +pub fn noop_visit_path(Path { segments, span }: &mut Path, vis: &mut T) { vis.visit_span(span); for PathSegment { ident, id, args } in segments { vis.visit_ident(ident); vis.visit_id(id); visit_opt(args, |args| vis.visit_generic_args(args)); } - visit_lazy_tts(tokens, vis); + visit_lazy_tts(&mut None, vis); } pub fn noop_visit_qself(qself: &mut Option, vis: &mut T) { @@ -999,11 +999,11 @@ pub fn noop_visit_mt(MutTy { ty, mutbl: _ }: &mut MutTy, vis: &mu } pub fn noop_visit_block(block: &mut P, vis: &mut T) { - let Block { id, stmts, rules: _, span, tokens, could_be_bare_literal: _ } = block.deref_mut(); + let Block { id, stmts, rules: _, span, could_be_bare_literal: _ } = block.deref_mut(); vis.visit_id(id); stmts.flat_map_in_place(|stmt| vis.flat_map_stmt(stmt)); vis.visit_span(span); - visit_lazy_tts(tokens, vis); + visit_lazy_tts(&mut None, vis); } pub fn noop_visit_item_kind(kind: &mut ItemKind, vis: &mut T) { @@ -1210,7 +1210,7 @@ pub fn noop_flat_map_foreign_item( } pub fn noop_visit_pat(pat: &mut P, vis: &mut T) { - let Pat { id, kind, span, tokens } = pat.deref_mut(); + let Pat { id, kind, span } = pat.deref_mut(); vis.visit_id(id); match kind { PatKind::Wild | PatKind::Rest => {} @@ -1247,7 +1247,7 @@ pub fn noop_visit_pat(pat: &mut P, vis: &mut T) { PatKind::MacCall(mac) => vis.visit_mac_call(mac), } vis.visit_span(span); - visit_lazy_tts(tokens, vis); + visit_lazy_tts(&mut None, vis); } pub fn noop_visit_anon_const(AnonConst { id, value }: &mut AnonConst, vis: &mut T) { @@ -1283,10 +1283,7 @@ pub fn noop_visit_inline_asm_sym( vis.visit_path(path); } -pub fn noop_visit_expr( - Expr { kind, id, span, attrs, tokens }: &mut Expr, - vis: &mut T, -) { +pub fn noop_visit_expr(Expr { kind, id, span, attrs }: &mut Expr, vis: &mut T) { match kind { ExprKind::Box(expr) => vis.visit_expr(expr), ExprKind::Array(exprs) => visit_exprs(exprs, vis), @@ -1431,7 +1428,7 @@ pub fn noop_visit_expr( vis.visit_id(id); vis.visit_span(span); visit_thin_attrs(attrs, vis); - visit_lazy_tts(tokens, vis); + visit_lazy_tts(&mut None, vis); } pub fn noop_filter_map_expr(mut e: P, vis: &mut T) -> Option> { @@ -1523,11 +1520,7 @@ impl DummyAstNode for Item { attrs: Default::default(), id: DUMMY_NODE_ID, span: Default::default(), - vis: Visibility { - kind: VisibilityKind::Public, - span: Default::default(), - tokens: Default::default(), - }, + vis: Visibility { kind: VisibilityKind::Public, span: Default::default() }, ident: Ident::empty(), kind: ItemKind::ExternCrate(None), tokens: Default::default(), @@ -1542,30 +1535,19 @@ impl DummyAstNode for Expr { kind: ExprKind::Err, span: Default::default(), attrs: Default::default(), - tokens: Default::default(), } } } impl DummyAstNode for Ty { fn dummy() -> Self { - Ty { - id: DUMMY_NODE_ID, - kind: TyKind::Err, - span: Default::default(), - tokens: Default::default(), - } + Ty { id: DUMMY_NODE_ID, kind: TyKind::Err, span: Default::default() } } } impl DummyAstNode for Pat { fn dummy() -> Self { - Pat { - id: DUMMY_NODE_ID, - kind: PatKind::Wild, - span: Default::default(), - tokens: Default::default(), - } + Pat { id: DUMMY_NODE_ID, kind: PatKind::Wild, span: Default::default() } } } @@ -1582,7 +1564,6 @@ impl DummyAstNode for Block { id: DUMMY_NODE_ID, rules: BlockCheckMode::Default, span: Default::default(), - tokens: Default::default(), could_be_bare_literal: Default::default(), } } diff --git a/compiler/rustc_ast_lowering/src/asm.rs b/compiler/rustc_ast_lowering/src/asm.rs index 4166b4fc2e5bc..a37f204074dec 100644 --- a/compiler/rustc_ast_lowering/src/asm.rs +++ b/compiler/rustc_ast_lowering/src/asm.rs @@ -244,7 +244,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { kind: ExprKind::Path(sym.qself.clone(), sym.path.clone()), span: *op_sp, attrs: AttrVec::new(), - tokens: None, }; // Wrap the expression in an AnonConst. diff --git a/compiler/rustc_ast_lowering/src/item.rs b/compiler/rustc_ast_lowering/src/item.rs index 99f81afc1e25d..dea55fe2a3ce5 100644 --- a/compiler/rustc_ast_lowering/src/item.rs +++ b/compiler/rustc_ast_lowering/src/item.rs @@ -231,7 +231,7 @@ impl<'hir> LoweringContext<'_, 'hir> { ItemKind::ExternCrate(orig_name) => hir::ItemKind::ExternCrate(orig_name), ItemKind::Use(ref use_tree) => { // Start with an empty prefix. - let prefix = Path { segments: vec![], span: use_tree.span, tokens: None }; + let prefix = Path { segments: vec![], span: use_tree.span }; self.lower_use_tree(use_tree, &prefix, id, vis_span, ident, attrs) } @@ -497,7 +497,7 @@ impl<'hir> LoweringContext<'_, 'hir> { *ident = tree.ident(); // First, apply the prefix to the path. - let mut path = Path { segments, span: path.span, tokens: None }; + let mut path = Path { segments, span: path.span }; // Correctly resolve `self` imports. if path.segments.len() > 1 @@ -560,11 +560,8 @@ impl<'hir> LoweringContext<'_, 'hir> { hir::ItemKind::Use(path, hir::UseKind::Single) } UseTreeKind::Glob => { - let path = self.lower_path( - id, - &Path { segments, span: path.span, tokens: None }, - ParamMode::Explicit, - ); + let path = + self.lower_path(id, &Path { segments, span: path.span }, ParamMode::Explicit); hir::ItemKind::Use(path, hir::UseKind::Glob) } UseTreeKind::Nested(ref trees) => { @@ -592,7 +589,7 @@ impl<'hir> LoweringContext<'_, 'hir> { // for that we return the `{}` import (called the // `ListStem`). - let prefix = Path { segments, span: prefix.span.to(path.span), tokens: None }; + let prefix = Path { segments, span: prefix.span.to(path.span) }; // Add all the nested `PathListItem`s to the HIR. for &(ref use_tree, id) in trees { diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index a1bf0f94964bb..6a23557f376cb 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1019,7 +1019,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { id: node_id, kind: TyKind::ImplTrait(impl_trait_node_id, bounds.clone()), span: this.lower_span(constraint.span), - tokens: None, }, itctx, ); @@ -1124,7 +1123,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { kind: ExprKind::Path(qself.clone(), path.clone()), span, attrs: AttrVec::new(), - tokens: None, }; let ct = self.with_new_scopes(|this| hir::AnonConst { diff --git a/compiler/rustc_ast_pretty/src/pprust/tests.rs b/compiler/rustc_ast_pretty/src/pprust/tests.rs index 6c8d42f33eb5a..215bb37b5ebf9 100644 --- a/compiler/rustc_ast_pretty/src/pprust/tests.rs +++ b/compiler/rustc_ast_pretty/src/pprust/tests.rs @@ -47,7 +47,6 @@ fn test_variant_to_string() { vis: ast::Visibility { span: rustc_span::DUMMY_SP, kind: ast::VisibilityKind::Inherited, - tokens: None, }, attrs: ast::AttrVec::new(), id: ast::DUMMY_NODE_ID, diff --git a/compiler/rustc_builtin_macros/src/asm.rs b/compiler/rustc_builtin_macros/src/asm.rs index a2205c3613d92..359fb17b691df 100644 --- a/compiler/rustc_builtin_macros/src/asm.rs +++ b/compiler/rustc_builtin_macros/src/asm.rs @@ -827,7 +827,6 @@ pub(super) fn expand_asm<'cx>( kind: ast::ExprKind::InlineAsm(P(inline_asm)), span: sp, attrs: ast::AttrVec::new(), - tokens: None, }) } else { DummyResult::raw_expr(sp, true) @@ -857,7 +856,6 @@ pub(super) fn expand_global_asm<'cx>( vis: ast::Visibility { span: sp.shrink_to_lo(), kind: ast::VisibilityKind::Inherited, - tokens: None, }, span: ecx.with_def_site_ctxt(sp), tokens: None, diff --git a/compiler/rustc_builtin_macros/src/assert.rs b/compiler/rustc_builtin_macros/src/assert.rs index 925c36edb5166..09b688e581036 100644 --- a/compiler/rustc_builtin_macros/src/assert.rs +++ b/compiler/rustc_builtin_macros/src/assert.rs @@ -39,7 +39,6 @@ pub fn expand_assert<'cx>( .into_iter() .map(|ident| PathSegment::from_ident(ident)) .collect(), - tokens: None, } } else { // Before edition 2021, we call `panic!()` unqualified, diff --git a/compiler/rustc_builtin_macros/src/concat_idents.rs b/compiler/rustc_builtin_macros/src/concat_idents.rs index 297c604e02043..2556c05bfa9ef 100644 --- a/compiler/rustc_builtin_macros/src/concat_idents.rs +++ b/compiler/rustc_builtin_macros/src/concat_idents.rs @@ -52,7 +52,6 @@ pub fn expand_concat_idents<'cx>( kind: ast::ExprKind::Path(None, ast::Path::from_ident(self.ident)), span: self.ident.span, attrs: ast::AttrVec::new(), - tokens: None, })) } @@ -61,7 +60,6 @@ pub fn expand_concat_idents<'cx>( id: ast::DUMMY_NODE_ID, kind: ast::TyKind::Path(None, ast::Path::from_ident(self.ident)), span: self.ident.span, - tokens: None, })) } } diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index 735017aa5a850..72d8b09095956 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -566,7 +566,6 @@ impl<'a> TraitDef<'a> { vis: ast::Visibility { span: self.span.shrink_to_lo(), kind: ast::VisibilityKind::Inherited, - tokens: None, }, attrs: Vec::new(), kind: ast::AssocItemKind::TyAlias(Box::new(ast::TyAlias { @@ -975,11 +974,7 @@ impl<'a> MethodDef<'a> { id: ast::DUMMY_NODE_ID, attrs: self.attributes.clone(), span, - vis: ast::Visibility { - span: trait_lo_sp, - kind: ast::VisibilityKind::Inherited, - tokens: None, - }, + vis: ast::Visibility { span: trait_lo_sp, kind: ast::VisibilityKind::Inherited }, ident: method_ident, kind: ast::AssocItemKind::Fn(Box::new(ast::Fn { defaultness, diff --git a/compiler/rustc_builtin_macros/src/deriving/mod.rs b/compiler/rustc_builtin_macros/src/deriving/mod.rs index c1ca089da221f..385246662bc10 100644 --- a/compiler/rustc_builtin_macros/src/deriving/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/mod.rs @@ -101,7 +101,6 @@ fn call_unreachable(cx: &ExtCtxt<'_>, span: Span) -> P { id: ast::DUMMY_NODE_ID, rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated), span, - tokens: None, could_be_bare_literal: false, })) } diff --git a/compiler/rustc_builtin_macros/src/edition_panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs index ea0e768a58f48..79f602ad836d6 100644 --- a/compiler/rustc_builtin_macros/src/edition_panic.rs +++ b/compiler/rustc_builtin_macros/src/edition_panic.rs @@ -56,7 +56,6 @@ fn expand<'cx>( .into_iter() .map(|ident| PathSegment::from_ident(ident)) .collect(), - tokens: None, }, args: P(MacArgs::Delimited( DelimSpan::from_single(sp), diff --git a/compiler/rustc_builtin_macros/src/format.rs b/compiler/rustc_builtin_macros/src/format.rs index 082c78934262b..d0ec1bbee38c5 100644 --- a/compiler/rustc_builtin_macros/src/format.rs +++ b/compiler/rustc_builtin_macros/src/format.rs @@ -1069,7 +1069,6 @@ impl<'a, 'b> Context<'a, 'b> { id: ast::DUMMY_NODE_ID, rules: BlockCheckMode::Unsafe(UnsafeSource::CompilerGenerated), span: self.macsp, - tokens: None, could_be_bare_literal: false, })); diff --git a/compiler/rustc_builtin_macros/src/test.rs b/compiler/rustc_builtin_macros/src/test.rs index e20375689f3d1..6f49e98b2c4e9 100644 --- a/compiler/rustc_builtin_macros/src/test.rs +++ b/compiler/rustc_builtin_macros/src/test.rs @@ -37,11 +37,7 @@ pub fn expand_test_case( let sp = ecx.with_def_site_ctxt(attr_sp); let mut item = anno_item.expect_item(); item = item.map(|mut item| { - item.vis = ast::Visibility { - span: item.vis.span, - kind: ast::VisibilityKind::Public, - tokens: None, - }; + item.vis = ast::Visibility { span: item.vis.span, kind: ast::VisibilityKind::Public }; item.ident.span = item.ident.span.with_ctxt(sp.ctxt()); item.attrs.push(ecx.attribute(ecx.meta_word(sp, sym::rustc_test_marker))); item diff --git a/compiler/rustc_builtin_macros/src/test_harness.rs b/compiler/rustc_builtin_macros/src/test_harness.rs index 0ebe29df95f20..e8682f036e9ce 100644 --- a/compiler/rustc_builtin_macros/src/test_harness.rs +++ b/compiler/rustc_builtin_macros/src/test_harness.rs @@ -336,7 +336,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P { attrs: vec![main_attr], id: ast::DUMMY_NODE_ID, kind: main, - vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None }, + vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public }, span: sp, tokens: None, }); diff --git a/compiler/rustc_expand/src/base.rs b/compiler/rustc_expand/src/base.rs index 6e093811fcf6e..0afcd8fd64881 100644 --- a/compiler/rustc_expand/src/base.rs +++ b/compiler/rustc_expand/src/base.rs @@ -508,7 +508,6 @@ impl MacResult for MacEager { id: ast::DUMMY_NODE_ID, span: e.span, kind: PatKind::Lit(e), - tokens: None, })); } } @@ -549,13 +548,12 @@ impl DummyResult { kind: if is_error { ast::ExprKind::Err } else { ast::ExprKind::Tup(Vec::new()) }, span: sp, attrs: ast::AttrVec::new(), - tokens: None, }) } /// A plain dummy pattern. pub fn raw_pat(sp: Span) -> ast::Pat { - ast::Pat { id: ast::DUMMY_NODE_ID, kind: PatKind::Wild, span: sp, tokens: None } + ast::Pat { id: ast::DUMMY_NODE_ID, kind: PatKind::Wild, span: sp } } /// A plain dummy type. @@ -564,7 +562,6 @@ impl DummyResult { id: ast::DUMMY_NODE_ID, kind: if is_error { ast::TyKind::Err } else { ast::TyKind::Tup(Vec::new()) }, span: sp, - tokens: None, }) } } diff --git a/compiler/rustc_expand/src/build.rs b/compiler/rustc_expand/src/build.rs index fa3e2a4a5b81c..96f8a702c83e9 100644 --- a/compiler/rustc_expand/src/build.rs +++ b/compiler/rustc_expand/src/build.rs @@ -46,7 +46,7 @@ impl<'a> ExtCtxt<'a> { id: ast::DUMMY_NODE_ID, args, }); - ast::Path { span, segments, tokens: None } + ast::Path { span, segments } } pub fn ty_mt(&self, ty: P, mutbl: ast::Mutability) -> ast::MutTy { @@ -54,7 +54,7 @@ impl<'a> ExtCtxt<'a> { } pub fn ty(&self, span: Span, kind: ast::TyKind) -> P { - P(ast::Ty { id: ast::DUMMY_NODE_ID, span, kind, tokens: None }) + P(ast::Ty { id: ast::DUMMY_NODE_ID, span, kind }) } pub fn ty_infer(&self, span: Span) -> P { @@ -74,13 +74,7 @@ impl<'a> ExtCtxt<'a> { pub fn anon_const(&self, span: Span, kind: ast::ExprKind) -> ast::AnonConst { ast::AnonConst { id: ast::DUMMY_NODE_ID, - value: P(ast::Expr { - id: ast::DUMMY_NODE_ID, - kind, - span, - attrs: AttrVec::new(), - tokens: None, - }), + value: P(ast::Expr { id: ast::DUMMY_NODE_ID, kind, span, attrs: AttrVec::new() }), } } @@ -233,13 +227,12 @@ impl<'a> ExtCtxt<'a> { id: ast::DUMMY_NODE_ID, rules: BlockCheckMode::Default, span, - tokens: None, could_be_bare_literal: false, }) } pub fn expr(&self, span: Span, kind: ast::ExprKind) -> P { - P(ast::Expr { id: ast::DUMMY_NODE_ID, kind, span, attrs: AttrVec::new(), tokens: None }) + P(ast::Expr { id: ast::DUMMY_NODE_ID, kind, span, attrs: AttrVec::new() }) } pub fn expr_path(&self, path: ast::Path) -> P { @@ -425,7 +418,7 @@ impl<'a> ExtCtxt<'a> { } pub fn pat(&self, span: Span, kind: PatKind) -> P { - P(ast::Pat { id: ast::DUMMY_NODE_ID, kind, span, tokens: None }) + P(ast::Pat { id: ast::DUMMY_NODE_ID, kind, span }) } pub fn pat_wild(&self, span: Span) -> P { self.pat(span, PatKind::Wild) @@ -577,7 +570,6 @@ impl<'a> ExtCtxt<'a> { vis: ast::Visibility { span: span.shrink_to_lo(), kind: ast::VisibilityKind::Inherited, - tokens: None, }, span, tokens: None, diff --git a/compiler/rustc_expand/src/placeholders.rs b/compiler/rustc_expand/src/placeholders.rs index 0d5d6ee07944f..e56786213d35d 100644 --- a/compiler/rustc_expand/src/placeholders.rs +++ b/compiler/rustc_expand/src/placeholders.rs @@ -17,7 +17,7 @@ pub fn placeholder( ) -> AstFragment { fn mac_placeholder() -> ast::MacCall { ast::MacCall { - path: ast::Path { span: DUMMY_SP, segments: Vec::new(), tokens: None }, + path: ast::Path { span: DUMMY_SP, segments: Vec::new() }, args: P(ast::MacArgs::Empty), prior_type_ascription: None, } @@ -25,11 +25,8 @@ pub fn placeholder( let ident = Ident::empty(); let attrs = Vec::new(); - let vis = vis.unwrap_or(ast::Visibility { - span: DUMMY_SP, - kind: ast::VisibilityKind::Inherited, - tokens: None, - }); + let vis = + vis.unwrap_or(ast::Visibility { span: DUMMY_SP, kind: ast::VisibilityKind::Inherited }); let span = DUMMY_SP; let expr_placeholder = || { P(ast::Expr { @@ -37,13 +34,10 @@ pub fn placeholder( span, attrs: ast::AttrVec::new(), kind: ast::ExprKind::MacCall(mac_placeholder()), - tokens: None, }) }; - let ty = - || P(ast::Ty { id, kind: ast::TyKind::MacCall(mac_placeholder()), span, tokens: None }); - let pat = - || P(ast::Pat { id, kind: ast::PatKind::MacCall(mac_placeholder()), span, tokens: None }); + let ty = || P(ast::Ty { id, kind: ast::TyKind::MacCall(mac_placeholder()), span }); + let pat = || P(ast::Pat { id, kind: ast::PatKind::MacCall(mac_placeholder()), span }); match kind { AstFragmentKind::Crate => AstFragment::Crate(ast::Crate { @@ -97,14 +91,10 @@ pub fn placeholder( id, span, kind: ast::PatKind::MacCall(mac_placeholder()), - tokens: None, - })), - AstFragmentKind::Ty => AstFragment::Ty(P(ast::Ty { - id, - span, - kind: ast::TyKind::MacCall(mac_placeholder()), - tokens: None, })), + AstFragmentKind::Ty => { + AstFragment::Ty(P(ast::Ty { id, span, kind: ast::TyKind::MacCall(mac_placeholder()) })) + } AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{ let mac = P(ast::MacCallStmt { mac: mac_placeholder(), diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index 38ce50e8323b1..e4f3c4579bd88 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -525,7 +525,6 @@ impl CStore { vis: ast::Visibility { span: span.shrink_to_lo(), kind: ast::VisibilityKind::Inherited, - tokens: None, }, tokens: None, }, diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 09329f18c679d..47b2d2f994f09 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -40,9 +40,8 @@ pub(super) fn dummy_arg(ident: Ident) -> Param { id: ast::DUMMY_NODE_ID, kind: PatKind::Ident(BindingMode::ByValue(Mutability::Not), ident, None), span: ident.span, - tokens: None, }); - let ty = Ty { kind: TyKind::Err, span: ident.span, id: ast::DUMMY_NODE_ID, tokens: None }; + let ty = Ty { kind: TyKind::Err, span: ident.span, id: ast::DUMMY_NODE_ID }; Param { attrs: AttrVec::default(), id: ast::DUMMY_NODE_ID, @@ -93,12 +92,7 @@ impl RecoverQPath for Ty { Some(P(self.clone())) } fn recovered(qself: Option, path: ast::Path) -> Self { - Self { - span: path.span, - kind: TyKind::Path(qself, path), - id: ast::DUMMY_NODE_ID, - tokens: None, - } + Self { span: path.span, kind: TyKind::Path(qself, path), id: ast::DUMMY_NODE_ID } } } @@ -107,12 +101,7 @@ impl RecoverQPath for Pat { self.to_ty() } fn recovered(qself: Option, path: ast::Path) -> Self { - Self { - span: path.span, - kind: PatKind::Path(qself, path), - id: ast::DUMMY_NODE_ID, - tokens: None, - } + Self { span: path.span, kind: PatKind::Path(qself, path), id: ast::DUMMY_NODE_ID } } } @@ -126,7 +115,6 @@ impl RecoverQPath for Expr { kind: ExprKind::Path(qself, path), attrs: AttrVec::new(), id: ast::DUMMY_NODE_ID, - tokens: None, } } } @@ -731,8 +719,7 @@ impl<'a> Parser<'a> { // field: value, // } let mut snapshot = self.create_snapshot_for_diagnostic(); - let path = - Path { segments: vec![], span: self.prev_token.span.shrink_to_lo(), tokens: None }; + let path = Path { segments: vec![], span: self.prev_token.span.shrink_to_lo() }; let struct_expr = snapshot.parse_struct_expr(None, path, AttrVec::new(), false); let block_tail = self.parse_block_tail(lo, s, AttemptLocalParseRecovery::No); return Some(match (struct_expr, block_tail) { @@ -1540,7 +1527,7 @@ impl<'a> Parser<'a> { ) -> PResult<'a, P> { self.expect(&token::ModSep)?; - let mut path = ast::Path { segments: Vec::new(), span: DUMMY_SP, tokens: None }; + let mut path = ast::Path { segments: Vec::new(), span: DUMMY_SP }; self.parse_path_segments(&mut path.segments, T::PATH_STYLE, None)?; path.span = ty_span.to(self.prev_token.span); @@ -2154,8 +2141,7 @@ impl<'a> Parser<'a> { .emit(); // Pretend the pattern is `_`, to avoid duplicate errors from AST validation. - let pat = - P(Pat { kind: PatKind::Wild, span: pat.span, id: ast::DUMMY_NODE_ID, tokens: None }); + let pat = P(Pat { kind: PatKind::Wild, span: pat.span, id: ast::DUMMY_NODE_ID }); Ok((pat, ty)) } @@ -2587,7 +2573,6 @@ impl<'a> Parser<'a> { PathSegment::from_ident(*old_ident), PathSegment::from_ident(*ident), ], - tokens: None, }, ); first_pat = self.mk_pat(new_span, path); @@ -2598,7 +2583,7 @@ impl<'a> Parser<'a> { segments.push(PathSegment::from_ident(*ident)); let path = PatKind::Path( old_qself.clone(), - Path { span: new_span, segments, tokens: None }, + Path { span: new_span, segments }, ); first_pat = self.mk_pat(new_span, path); show_sugg = true; diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index e473f4d30cf09..7e99797a852db 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -3233,7 +3233,7 @@ impl<'a> Parser<'a> { } pub(crate) fn mk_expr(&self, span: Span, kind: ExprKind, attrs: AttrVec) -> P { - P(Expr { kind, span, attrs, id: DUMMY_NODE_ID, tokens: None }) + P(Expr { kind, span, attrs, id: DUMMY_NODE_ID }) } pub(super) fn mk_expr_err(&self, span: Span) -> P { diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 2c1e5807aa7f9..616c5371d53fa 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -569,12 +569,7 @@ impl<'a> Parser<'a> { Applicability::MaybeIncorrect, ) .emit(); - P(Ty { - kind: TyKind::Path(None, err_path(span)), - span, - id: DUMMY_NODE_ID, - tokens: None, - }) + P(Ty { kind: TyKind::Path(None, err_path(span)), span, id: DUMMY_NODE_ID }) } else { self.parse_ty_with_generics_recovery(&generics)? }; @@ -892,7 +887,7 @@ impl<'a> Parser<'a> { fn parse_use_tree(&mut self) -> PResult<'a, UseTree> { let lo = self.token.span; - let mut prefix = ast::Path { segments: Vec::new(), span: lo.shrink_to_lo(), tokens: None }; + let mut prefix = ast::Path { segments: Vec::new(), span: lo.shrink_to_lo() }; let kind = if self.check(&token::OpenDelim(Delimiter::Brace)) || self.check(&token::BinOp(token::Star)) || self.is_import_coupler() @@ -1211,7 +1206,7 @@ impl<'a> Parser<'a> { // The user intended that the type be inferred, // so treat this as if the user wrote e.g. `const A: _ = expr;`. - P(Ty { kind: TyKind::Infer, span: id.span, id: ast::DUMMY_NODE_ID, tokens: None }) + P(Ty { kind: TyKind::Infer, span: id.span, id: ast::DUMMY_NODE_ID }) } /// Parses an enum declaration. @@ -1616,11 +1611,8 @@ impl<'a> Parser<'a> { let (ident, is_raw) = self.ident_or_err()?; if !is_raw && ident.is_reserved() { let err = if self.check_fn_front_matter(false) { - let inherited_vis = Visibility { - span: rustc_span::DUMMY_SP, - kind: VisibilityKind::Inherited, - tokens: None, - }; + let inherited_vis = + Visibility { span: rustc_span::DUMMY_SP, kind: VisibilityKind::Inherited }; // We use `parse_fn` to get a span for the function let fn_parse_mode = FnParseMode { req_name: |_| true, req_body: true }; if let Err(mut db) = diff --git a/compiler/rustc_parse/src/parser/mod.rs b/compiler/rustc_parse/src/parser/mod.rs index 0c523ad22c205..67801db79221b 100644 --- a/compiler/rustc_parse/src/parser/mod.rs +++ b/compiler/rustc_parse/src/parser/mod.rs @@ -1279,7 +1279,6 @@ impl<'a> Parser<'a> { return Ok(Visibility { span: self.token.span.shrink_to_lo(), kind: VisibilityKind::Inherited, - tokens: None, }); } let lo = self.prev_token.span; @@ -1296,11 +1295,7 @@ impl<'a> Parser<'a> { let path = self.parse_path(PathStyle::Mod)?; // `path` self.expect(&token::CloseDelim(Delimiter::Parenthesis))?; // `)` let vis = VisibilityKind::Restricted { path: P(path), id: ast::DUMMY_NODE_ID }; - return Ok(Visibility { - span: lo.to(self.prev_token.span), - kind: vis, - tokens: None, - }); + return Ok(Visibility { span: lo.to(self.prev_token.span), kind: vis }); } else if self.look_ahead(2, |t| t == &token::CloseDelim(Delimiter::Parenthesis)) && self.is_keyword_ahead(1, &[kw::Crate, kw::Super, kw::SelfLower]) { @@ -1309,11 +1304,7 @@ impl<'a> Parser<'a> { let path = self.parse_path(PathStyle::Mod)?; // `crate`/`super`/`self` self.expect(&token::CloseDelim(Delimiter::Parenthesis))?; // `)` let vis = VisibilityKind::Restricted { path: P(path), id: ast::DUMMY_NODE_ID }; - return Ok(Visibility { - span: lo.to(self.prev_token.span), - kind: vis, - tokens: None, - }); + return Ok(Visibility { span: lo.to(self.prev_token.span), kind: vis }); } else if let FollowedByType::No = fbt { // Provide this diagnostic if a type cannot follow; // in particular, if this is not a tuple struct. @@ -1322,7 +1313,7 @@ impl<'a> Parser<'a> { } } - Ok(Visibility { span: lo, kind: VisibilityKind::Public, tokens: None }) + Ok(Visibility { span: lo, kind: VisibilityKind::Public }) } /// Recovery for e.g. `pub(something) fn ...` or `struct X { pub(something) y: Z }` diff --git a/compiler/rustc_parse/src/parser/pat.rs b/compiler/rustc_parse/src/parser/pat.rs index ba77a39584093..df9500fbfdaf3 100644 --- a/compiler/rustc_parse/src/parser/pat.rs +++ b/compiler/rustc_parse/src/parser/pat.rs @@ -1146,6 +1146,6 @@ impl<'a> Parser<'a> { } pub(super) fn mk_pat(&self, span: Span, kind: PatKind) -> P { - P(Pat { kind, span, id: ast::DUMMY_NODE_ID, tokens: None }) + P(Pat { kind, span, id: ast::DUMMY_NODE_ID }) } } diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 5cf1758c31f77..2749284736901 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -64,7 +64,7 @@ impl<'a> Parser<'a> { path_span = path_lo.to(self.prev_token.span); } else { path_span = self.token.span.to(self.token.span); - path = ast::Path { segments: Vec::new(), span: path_span, tokens: None }; + path = ast::Path { segments: Vec::new(), span: path_span }; } // See doc comment for `unmatched_angle_bracket_count`. @@ -81,10 +81,7 @@ impl<'a> Parser<'a> { let qself = QSelf { ty, path_span, position: path.segments.len() }; self.parse_path_segments(&mut path.segments, style, None)?; - Ok(( - qself, - Path { segments: path.segments, span: lo.to(self.prev_token.span), tokens: None }, - )) + Ok((qself, Path { segments: path.segments, span: lo.to(self.prev_token.span) })) } /// Recover from an invalid single colon, when the user likely meant a qualified path. @@ -187,7 +184,7 @@ impl<'a> Parser<'a> { } self.parse_path_segments(&mut segments, style, ty_generics)?; - Ok(Path { segments, span: lo.to(self.prev_token.span), tokens: None }) + Ok(Path { segments, span: lo.to(self.prev_token.span) }) } pub(super) fn parse_path_segments( diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 51bd9d2d386ad..eb8dd4599be1a 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -624,14 +624,7 @@ impl<'a> Parser<'a> { } pub(super) fn mk_block(&self, stmts: Vec, rules: BlockCheckMode, span: Span) -> P { - P(Block { - stmts, - id: DUMMY_NODE_ID, - rules, - span, - tokens: None, - could_be_bare_literal: false, - }) + P(Block { stmts, id: DUMMY_NODE_ID, rules, span, could_be_bare_literal: false }) } pub(super) fn mk_stmt(&self, span: Span, kind: StmtKind) -> Stmt { diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 31b40a83e6052..aff87495d4363 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -521,7 +521,6 @@ impl<'a> Parser<'a> { let inherited_vis = rustc_ast::Visibility { span: rustc_span::DUMMY_SP, kind: rustc_ast::VisibilityKind::Inherited, - tokens: None, }; let span_start = self.token.span; let ast::FnHeader { ext, unsafety, constness, asyncness } = @@ -886,6 +885,6 @@ impl<'a> Parser<'a> { } pub(super) fn mk_ty(&self, span: Span, kind: TyKind) -> P { - P(Ty { kind, span, id: ast::DUMMY_NODE_ID, tokens: None }) + P(Ty { kind, span, id: ast::DUMMY_NODE_ID }) } } diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 8839fb1a15120..1a2dc5ecaf8f6 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -1331,7 +1331,7 @@ impl<'a> Resolver<'a> { } segms.push(ast::PathSegment::from_ident(ident)); - let path = Path { span: name_binding.span, segments: segms, tokens: None }; + let path = Path { span: name_binding.span, segments: segms }; let did = match res { Res::Def(DefKind::Ctor(..), did) => this.opt_parent(did), _ => res.opt_def_id(), diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index ed65100ae7751..0d6181a1b6f46 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -3498,7 +3498,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> { if qself.is_none() { let path_seg = |seg: &Segment| PathSegment::from_ident(seg.ident); - let path = Path { segments: path.iter().map(path_seg).collect(), span, tokens: None }; + let path = Path { segments: path.iter().map(path_seg).collect(), span }; if let Ok((_, res)) = self.r.resolve_macro_path(&path, None, &self.parent_scope, false, false) { diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 2b1f2b88ec445..4ad5dd99e31e9 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -75,7 +75,6 @@ fn import_candidate_to_enum_paths(suggestion: &ImportSuggestion) -> (String, Str let enum_path = ast::Path { span: suggestion.path.span, segments: suggestion.path.segments[0..path_len - 1].to_vec(), - tokens: None, }; let enum_path_string = path_names_to_string(&enum_path); @@ -1626,8 +1625,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { path_segments.push(ast::PathSegment::from_ident(ident)); let module_def_id = module.def_id(); if module_def_id == def_id { - let path = - Path { span: name_binding.span, segments: path_segments, tokens: None }; + let path = Path { span: name_binding.span, segments: path_segments }; result = Some(( module, ImportSuggestion { @@ -1658,7 +1656,7 @@ impl<'a: 'ast, 'ast> LateResolutionVisitor<'a, '_, 'ast> { if let Res::Def(DefKind::Ctor(CtorOf::Variant, kind), def_id) = name_binding.res() { let mut segms = enum_import_suggestion.path.segments.clone(); segms.push(ast::PathSegment::from_ident(ident)); - let path = Path { span: name_binding.span, segments: segms, tokens: None }; + let path = Path { span: name_binding.span, segments: segms }; variants.push((path, def_id, kind)); } }); diff --git a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs index 04e2f301bfd88..248190c7338da 100644 --- a/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs +++ b/src/tools/clippy/clippy_lints/src/unnested_or_patterns.rs @@ -360,7 +360,6 @@ fn take_pat(from: &mut Pat) -> Pat { id: DUMMY_NODE_ID, kind: Wild, span: DUMMY_SP, - tokens: None, }; mem::replace(from, dummy) } diff --git a/src/tools/rustfmt/src/closures.rs b/src/tools/rustfmt/src/closures.rs index 88a6bebb68c84..9f591401ea8dd 100644 --- a/src/tools/rustfmt/src/closures.rs +++ b/src/tools/rustfmt/src/closures.rs @@ -156,7 +156,6 @@ fn rewrite_closure_with_block( }], id: ast::NodeId::root(), rules: ast::BlockCheckMode::Default, - tokens: None, span: body .attrs .first() diff --git a/src/tools/rustfmt/src/items.rs b/src/tools/rustfmt/src/items.rs index 8f35068e35f04..4d3d705c7b879 100644 --- a/src/tools/rustfmt/src/items.rs +++ b/src/tools/rustfmt/src/items.rs @@ -36,7 +36,6 @@ use crate::visitor::FmtVisitor; const DEFAULT_VISIBILITY: ast::Visibility = ast::Visibility { kind: ast::VisibilityKind::Inherited, span: DUMMY_SP, - tokens: None, }; fn type_annotation_separator(config: &Config) -> &str { diff --git a/src/tools/rustfmt/src/macros.rs b/src/tools/rustfmt/src/macros.rs index 3a641fab5d647..3d470d6f85774 100644 --- a/src/tools/rustfmt/src/macros.rs +++ b/src/tools/rustfmt/src/macros.rs @@ -1094,7 +1094,6 @@ pub(crate) fn convert_try_mac( kind: ast::ExprKind::Try(parse_expr(context, ts)?), span: mac.span(), // incorrect span, but shouldn't matter too much attrs: ast::AttrVec::new(), - tokens: None, }) } else { None