Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e809e02

Browse files
committedMar 12, 2020
ast: Mac/Macro -> MacCall
1 parent 23de827 commit e809e02

File tree

43 files changed

+200
-197
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+200
-197
lines changed
 

‎src/librustc_ast/ast.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
//! - [`Generics`], [`GenericParam`], [`WhereClause`]: Metadata associated with generic parameters.
1515
//! - [`EnumDef`] and [`Variant`]: Enum declaration.
1616
//! - [`Lit`] and [`LitKind`]: Literal expressions.
17-
//! - [`MacroDef`], [`MacStmtStyle`], [`Mac`], [`MacDelimeter`]: Macro definition and invocation.
17+
//! - [`MacroDef`], [`MacStmtStyle`], [`MacCall`], [`MacDelimeter`]: Macro definition and invocation.
1818
//! - [`Attribute`]: Metadata associated with item.
1919
//! - [`UnOp`], [`UnOpKind`], [`BinOp`], [`BinOpKind`]: Unary and binary operators.
2020
@@ -513,7 +513,7 @@ impl Pat {
513513
TyKind::Path(None, Path::from_ident(*ident))
514514
}
515515
PatKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()),
516-
PatKind::Mac(mac) => TyKind::Mac(mac.clone()),
516+
PatKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
517517
// `&mut? P` can be reinterpreted as `&mut? T` where `T` is `P` reparsed as a type.
518518
PatKind::Ref(pat, mutbl) => {
519519
pat.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?
@@ -567,7 +567,7 @@ impl Pat {
567567
| PatKind::Range(..)
568568
| PatKind::Ident(..)
569569
| PatKind::Path(..)
570-
| PatKind::Mac(_) => {}
570+
| PatKind::MacCall(_) => {}
571571
}
572572
}
573573

@@ -682,7 +682,7 @@ pub enum PatKind {
682682
Paren(P<Pat>),
683683

684684
/// A macro pattern; pre-expansion.
685-
Mac(Mac),
685+
MacCall(MacCall),
686686
}
687687

688688
#[derive(
@@ -881,9 +881,9 @@ impl Stmt {
881881
pub fn add_trailing_semicolon(mut self) -> Self {
882882
self.kind = match self.kind {
883883
StmtKind::Expr(expr) => StmtKind::Semi(expr),
884-
StmtKind::Mac(mac) => {
885-
StmtKind::Mac(mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)))
886-
}
884+
StmtKind::MacCall(mac) => StmtKind::MacCall(
885+
mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)),
886+
),
887887
kind => kind,
888888
};
889889
self
@@ -917,7 +917,7 @@ pub enum StmtKind {
917917
/// Just a trailing semi-colon.
918918
Empty,
919919
/// Macro.
920-
Mac(P<(Mac, MacStmtStyle, AttrVec)>),
920+
MacCall(P<(MacCall, MacStmtStyle, AttrVec)>),
921921
}
922922

923923
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
@@ -1057,7 +1057,7 @@ impl Expr {
10571057
let kind = match &self.kind {
10581058
// Trivial conversions.
10591059
ExprKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()),
1060-
ExprKind::Mac(mac) => TyKind::Mac(mac.clone()),
1060+
ExprKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
10611061

10621062
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,
10631063

@@ -1127,7 +1127,7 @@ impl Expr {
11271127
ExprKind::Continue(..) => ExprPrecedence::Continue,
11281128
ExprKind::Ret(..) => ExprPrecedence::Ret,
11291129
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
1130-
ExprKind::Mac(..) => ExprPrecedence::Mac,
1130+
ExprKind::MacCall(..) => ExprPrecedence::Mac,
11311131
ExprKind::Struct(..) => ExprPrecedence::Struct,
11321132
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
11331133
ExprKind::Paren(..) => ExprPrecedence::Paren,
@@ -1259,7 +1259,7 @@ pub enum ExprKind {
12591259
InlineAsm(P<InlineAsm>),
12601260

12611261
/// A macro invocation; pre-expansion.
1262-
Mac(Mac),
1262+
MacCall(MacCall),
12631263

12641264
/// A struct literal expression.
12651265
///
@@ -1345,13 +1345,13 @@ pub enum Movability {
13451345
/// Represents a macro invocation. The `path` indicates which macro
13461346
/// is being invoked, and the `args` are arguments passed to it.
13471347
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
1348-
pub struct Mac {
1348+
pub struct MacCall {
13491349
pub path: Path,
13501350
pub args: P<MacArgs>,
13511351
pub prior_type_ascription: Option<(Span, bool)>,
13521352
}
13531353

1354-
impl Mac {
1354+
impl MacCall {
13551355
pub fn span(&self) -> Span {
13561356
self.path.span.to(self.args.span().unwrap_or(self.path.span))
13571357
}
@@ -1881,7 +1881,7 @@ pub enum TyKind {
18811881
/// Inferred type of a `self` or `&self` argument in a method.
18821882
ImplicitSelf,
18831883
/// A macro in the type position.
1884-
Mac(Mac),
1884+
MacCall(MacCall),
18851885
/// Placeholder for a kind that has failed to be defined.
18861886
Err,
18871887
/// Placeholder for a `va_list`.
@@ -2574,7 +2574,7 @@ pub enum ItemKind {
25742574
/// A macro invocation.
25752575
///
25762576
/// E.g., `foo!(..)`.
2577-
Mac(Mac),
2577+
MacCall(MacCall),
25782578

25792579
/// A macro definition.
25802580
MacroDef(MacroDef),
@@ -2586,7 +2586,7 @@ impl ItemKind {
25862586
match self {
25872587
Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..)
25882588
| Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..) => "a",
2589-
ExternCrate(..) | ForeignMod(..) | Mac(..) | Enum(..) | Impl { .. } => "an",
2589+
ExternCrate(..) | ForeignMod(..) | MacCall(..) | Enum(..) | Impl { .. } => "an",
25902590
}
25912591
}
25922592

@@ -2606,7 +2606,7 @@ impl ItemKind {
26062606
ItemKind::Union(..) => "union",
26072607
ItemKind::Trait(..) => "trait",
26082608
ItemKind::TraitAlias(..) => "trait alias",
2609-
ItemKind::Mac(..) => "item macro invocation",
2609+
ItemKind::MacCall(..) => "item macro invocation",
26102610
ItemKind::MacroDef(..) => "macro definition",
26112611
ItemKind::Impl { .. } => "implementation",
26122612
}
@@ -2648,14 +2648,14 @@ pub enum AssocItemKind {
26482648
/// An associated type.
26492649
TyAlias(Defaultness, Generics, GenericBounds, Option<P<Ty>>),
26502650
/// A macro expanding to associated items.
2651-
Macro(Mac),
2651+
MacCall(MacCall),
26522652
}
26532653

26542654
impl AssocItemKind {
26552655
pub fn defaultness(&self) -> Defaultness {
26562656
match *self {
26572657
Self::Const(def, ..) | Self::Fn(def, ..) | Self::TyAlias(def, ..) => def,
2658-
Self::Macro(..) => Defaultness::Final,
2658+
Self::MacCall(..) => Defaultness::Final,
26592659
}
26602660
}
26612661
}
@@ -2666,7 +2666,7 @@ impl From<AssocItemKind> for ItemKind {
26662666
AssocItemKind::Const(a, b, c) => ItemKind::Const(a, b, c),
26672667
AssocItemKind::Fn(a, b, c, d) => ItemKind::Fn(a, b, c, d),
26682668
AssocItemKind::TyAlias(a, b, c, d) => ItemKind::TyAlias(a, b, c, d),
2669-
AssocItemKind::Macro(a) => ItemKind::Mac(a),
2669+
AssocItemKind::MacCall(a) => ItemKind::MacCall(a),
26702670
}
26712671
}
26722672
}
@@ -2679,7 +2679,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
26792679
ItemKind::Const(a, b, c) => AssocItemKind::Const(a, b, c),
26802680
ItemKind::Fn(a, b, c, d) => AssocItemKind::Fn(a, b, c, d),
26812681
ItemKind::TyAlias(a, b, c, d) => AssocItemKind::TyAlias(a, b, c, d),
2682-
ItemKind::Mac(a) => AssocItemKind::Macro(a),
2682+
ItemKind::MacCall(a) => AssocItemKind::MacCall(a),
26832683
_ => return Err(item_kind),
26842684
})
26852685
}
@@ -2695,7 +2695,7 @@ pub enum ForeignItemKind {
26952695
/// A foreign type.
26962696
TyAlias(Defaultness, Generics, GenericBounds, Option<P<Ty>>),
26972697
/// A macro expanding to foreign items.
2698-
Macro(Mac),
2698+
MacCall(MacCall),
26992699
}
27002700

27012701
impl From<ForeignItemKind> for ItemKind {
@@ -2704,7 +2704,7 @@ impl From<ForeignItemKind> for ItemKind {
27042704
ForeignItemKind::Static(a, b, c) => ItemKind::Static(a, b, c),
27052705
ForeignItemKind::Fn(a, b, c, d) => ItemKind::Fn(a, b, c, d),
27062706
ForeignItemKind::TyAlias(a, b, c, d) => ItemKind::TyAlias(a, b, c, d),
2707-
ForeignItemKind::Macro(a) => ItemKind::Mac(a),
2707+
ForeignItemKind::MacCall(a) => ItemKind::MacCall(a),
27082708
}
27092709
}
27102710
}
@@ -2717,7 +2717,7 @@ impl TryFrom<ItemKind> for ForeignItemKind {
27172717
ItemKind::Static(a, b, c) => ForeignItemKind::Static(a, b, c),
27182718
ItemKind::Fn(a, b, c, d) => ForeignItemKind::Fn(a, b, c, d),
27192719
ItemKind::TyAlias(a, b, c, d) => ForeignItemKind::TyAlias(a, b, c, d),
2720-
ItemKind::Mac(a) => ForeignItemKind::Macro(a),
2720+
ItemKind::MacCall(a) => ForeignItemKind::MacCall(a),
27212721
_ => return Err(item_kind),
27222722
})
27232723
}

‎src/librustc_ast/attr/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ impl HasAttrs for StmtKind {
679679
StmtKind::Local(ref local) => local.attrs(),
680680
StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => expr.attrs(),
681681
StmtKind::Empty | StmtKind::Item(..) => &[],
682-
StmtKind::Mac(ref mac) => {
682+
StmtKind::MacCall(ref mac) => {
683683
let (_, _, ref attrs) = **mac;
684684
attrs.attrs()
685685
}
@@ -691,7 +691,7 @@ impl HasAttrs for StmtKind {
691691
StmtKind::Local(local) => local.visit_attrs(f),
692692
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.visit_attrs(f),
693693
StmtKind::Empty | StmtKind::Item(..) => {}
694-
StmtKind::Mac(mac) => {
694+
StmtKind::MacCall(mac) => {
695695
let (_mac, _style, attrs) = mac.deref_mut();
696696
attrs.visit_attrs(f);
697697
}

0 commit comments

Comments
 (0)
Please sign in to comment.