Skip to content

Commit a85de16

Browse files
committed
Auto merge of rust-lang#96924 - petrochenkov:nonon, r=nnethercote
ast: Introduce some traits to get AST node properties generically And use them to avoid constructing some artificial `Nonterminal` tokens during expansion r? `@nnethercote` `@Aaron1011`
2 parents f296b9a + f2b7fa4 commit a85de16

File tree

24 files changed

+593
-500
lines changed

24 files changed

+593
-500
lines changed

compiler/rustc_ast/src/ast.rs

-17
Original file line numberDiff line numberDiff line change
@@ -929,16 +929,6 @@ pub struct Stmt {
929929
}
930930

931931
impl Stmt {
932-
pub fn tokens(&self) -> Option<&LazyTokenStream> {
933-
match self.kind {
934-
StmtKind::Local(ref local) => local.tokens.as_ref(),
935-
StmtKind::Item(ref item) => item.tokens.as_ref(),
936-
StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => expr.tokens.as_ref(),
937-
StmtKind::Empty => None,
938-
StmtKind::MacCall(ref mac) => mac.tokens.as_ref(),
939-
}
940-
}
941-
942932
pub fn has_trailing_semicolon(&self) -> bool {
943933
match &self.kind {
944934
StmtKind::Semi(_) => true,
@@ -2684,13 +2674,6 @@ impl Item {
26842674
}
26852675
}
26862676

2687-
impl<K: Into<ItemKind>> Item<K> {
2688-
pub fn into_item(self) -> Item {
2689-
let Item { attrs, id, span, vis, ident, kind, tokens } = self;
2690-
Item { attrs, id, span, vis, ident, kind: kind.into(), tokens }
2691-
}
2692-
}
2693-
26942677
/// `extern` qualifier on a function item or function type.
26952678
#[derive(Clone, Copy, Encodable, Decodable, Debug)]
26962679
pub enum Extern {

compiler/rustc_ast/src/ast_like.rs

-320
This file was deleted.

0 commit comments

Comments
 (0)