diff --git a/src/librustc_ast/ast.rs b/src/librustc_ast/ast.rs
index 88a96dc6c696..6b2daa671cdc 100644
--- a/src/librustc_ast/ast.rs
+++ b/src/librustc_ast/ast.rs
@@ -14,7 +14,7 @@
//! - [`Generics`], [`GenericParam`], [`WhereClause`]: Metadata associated with generic parameters.
//! - [`EnumDef`] and [`Variant`]: Enum declaration.
//! - [`Lit`] and [`LitKind`]: Literal expressions.
-//! - [`MacroDef`], [`MacStmtStyle`], [`Mac`], [`MacDelimeter`]: Macro definition and invocation.
+//! - [`MacroDef`], [`MacStmtStyle`], [`MacCall`], [`MacDelimeter`]: Macro definition and invocation.
//! - [`Attribute`]: Metadata associated with item.
//! - [`UnOp`], [`UnOpKind`], [`BinOp`], [`BinOpKind`]: Unary and binary operators.
@@ -513,7 +513,7 @@ pub fn to_ty(&self) -> Option
> {
TyKind::Path(None, Path::from_ident(*ident))
}
PatKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()),
- PatKind::Mac(mac) => TyKind::Mac(mac.clone()),
+ PatKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
// `&mut? P` can be reinterpreted as `&mut? T` where `T` is `P` reparsed as a type.
PatKind::Ref(pat, mutbl) => {
pat.to_ty().map(|ty| TyKind::Rptr(None, MutTy { ty, mutbl: *mutbl }))?
@@ -567,7 +567,7 @@ pub fn walk(&self, it: &mut impl FnMut(&Pat) -> bool) {
| PatKind::Range(..)
| PatKind::Ident(..)
| PatKind::Path(..)
- | PatKind::Mac(_) => {}
+ | PatKind::MacCall(_) => {}
}
}
@@ -682,7 +682,7 @@ pub enum PatKind {
Paren(P),
/// A macro pattern; pre-expansion.
- Mac(Mac),
+ MacCall(MacCall),
}
#[derive(
@@ -881,9 +881,9 @@ impl Stmt {
pub fn add_trailing_semicolon(mut self) -> Self {
self.kind = match self.kind {
StmtKind::Expr(expr) => StmtKind::Semi(expr),
- StmtKind::Mac(mac) => {
- StmtKind::Mac(mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)))
- }
+ StmtKind::MacCall(mac) => StmtKind::MacCall(
+ mac.map(|(mac, _style, attrs)| (mac, MacStmtStyle::Semicolon, attrs)),
+ ),
kind => kind,
};
self
@@ -917,7 +917,7 @@ pub enum StmtKind {
/// Just a trailing semi-colon.
Empty,
/// Macro.
- Mac(P<(Mac, MacStmtStyle, AttrVec)>),
+ MacCall(P<(MacCall, MacStmtStyle, AttrVec)>),
}
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
@@ -1057,7 +1057,7 @@ pub fn to_ty(&self) -> Option> {
let kind = match &self.kind {
// Trivial conversions.
ExprKind::Path(qself, path) => TyKind::Path(qself.clone(), path.clone()),
- ExprKind::Mac(mac) => TyKind::Mac(mac.clone()),
+ ExprKind::MacCall(mac) => TyKind::MacCall(mac.clone()),
ExprKind::Paren(expr) => expr.to_ty().map(TyKind::Paren)?,
@@ -1127,7 +1127,7 @@ pub fn precedence(&self) -> ExprPrecedence {
ExprKind::Continue(..) => ExprPrecedence::Continue,
ExprKind::Ret(..) => ExprPrecedence::Ret,
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
- ExprKind::Mac(..) => ExprPrecedence::Mac,
+ ExprKind::MacCall(..) => ExprPrecedence::Mac,
ExprKind::Struct(..) => ExprPrecedence::Struct,
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
ExprKind::Paren(..) => ExprPrecedence::Paren,
@@ -1259,7 +1259,7 @@ pub enum ExprKind {
InlineAsm(P),
/// A macro invocation; pre-expansion.
- Mac(Mac),
+ MacCall(MacCall),
/// A struct literal expression.
///
@@ -1345,13 +1345,13 @@ pub enum Movability {
/// Represents a macro invocation. The `path` indicates which macro
/// is being invoked, and the `args` are arguments passed to it.
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
-pub struct Mac {
+pub struct MacCall {
pub path: Path,
pub args: P,
pub prior_type_ascription: Option<(Span, bool)>,
}
-impl Mac {
+impl MacCall {
pub fn span(&self) -> Span {
self.path.span.to(self.args.span().unwrap_or(self.path.span))
}
@@ -1881,7 +1881,7 @@ pub enum TyKind {
/// Inferred type of a `self` or `&self` argument in a method.
ImplicitSelf,
/// A macro in the type position.
- Mac(Mac),
+ MacCall(MacCall),
/// Placeholder for a kind that has failed to be defined.
Err,
/// Placeholder for a `va_list`.
@@ -2574,7 +2574,7 @@ pub enum ItemKind {
/// A macro invocation.
///
/// E.g., `foo!(..)`.
- Mac(Mac),
+ MacCall(MacCall),
/// A macro definition.
MacroDef(MacroDef),
@@ -2586,7 +2586,7 @@ pub fn article(&self) -> &str {
match self {
Use(..) | Static(..) | Const(..) | Fn(..) | Mod(..) | GlobalAsm(..) | TyAlias(..)
| Struct(..) | Union(..) | Trait(..) | TraitAlias(..) | MacroDef(..) => "a",
- ExternCrate(..) | ForeignMod(..) | Mac(..) | Enum(..) | Impl { .. } => "an",
+ ExternCrate(..) | ForeignMod(..) | MacCall(..) | Enum(..) | Impl { .. } => "an",
}
}
@@ -2606,7 +2606,7 @@ pub fn descr(&self) -> &str {
ItemKind::Union(..) => "union",
ItemKind::Trait(..) => "trait",
ItemKind::TraitAlias(..) => "trait alias",
- ItemKind::Mac(..) => "item macro invocation",
+ ItemKind::MacCall(..) => "item macro invocation",
ItemKind::MacroDef(..) => "macro definition",
ItemKind::Impl { .. } => "implementation",
}
@@ -2648,14 +2648,14 @@ pub enum AssocItemKind {
/// An associated type.
TyAlias(Defaultness, Generics, GenericBounds, Option>),
/// A macro expanding to associated items.
- Macro(Mac),
+ MacCall(MacCall),
}
impl AssocItemKind {
pub fn defaultness(&self) -> Defaultness {
match *self {
Self::Const(def, ..) | Self::Fn(def, ..) | Self::TyAlias(def, ..) => def,
- Self::Macro(..) => Defaultness::Final,
+ Self::MacCall(..) => Defaultness::Final,
}
}
}
@@ -2666,7 +2666,7 @@ fn from(assoc_item_kind: AssocItemKind) -> ItemKind {
AssocItemKind::Const(a, b, c) => ItemKind::Const(a, b, c),
AssocItemKind::Fn(a, b, c, d) => ItemKind::Fn(a, b, c, d),
AssocItemKind::TyAlias(a, b, c, d) => ItemKind::TyAlias(a, b, c, d),
- AssocItemKind::Macro(a) => ItemKind::Mac(a),
+ AssocItemKind::MacCall(a) => ItemKind::MacCall(a),
}
}
}
@@ -2679,7 +2679,7 @@ fn try_from(item_kind: ItemKind) -> Result {
ItemKind::Const(a, b, c) => AssocItemKind::Const(a, b, c),
ItemKind::Fn(a, b, c, d) => AssocItemKind::Fn(a, b, c, d),
ItemKind::TyAlias(a, b, c, d) => AssocItemKind::TyAlias(a, b, c, d),
- ItemKind::Mac(a) => AssocItemKind::Macro(a),
+ ItemKind::MacCall(a) => AssocItemKind::MacCall(a),
_ => return Err(item_kind),
})
}
@@ -2695,7 +2695,7 @@ pub enum ForeignItemKind {
/// A foreign type.
TyAlias(Defaultness, Generics, GenericBounds, Option>),
/// A macro expanding to foreign items.
- Macro(Mac),
+ MacCall(MacCall),
}
impl From for ItemKind {
@@ -2704,7 +2704,7 @@ fn from(foreign_item_kind: ForeignItemKind) -> ItemKind {
ForeignItemKind::Static(a, b, c) => ItemKind::Static(a, b, c),
ForeignItemKind::Fn(a, b, c, d) => ItemKind::Fn(a, b, c, d),
ForeignItemKind::TyAlias(a, b, c, d) => ItemKind::TyAlias(a, b, c, d),
- ForeignItemKind::Macro(a) => ItemKind::Mac(a),
+ ForeignItemKind::MacCall(a) => ItemKind::MacCall(a),
}
}
}
@@ -2717,7 +2717,7 @@ fn try_from(item_kind: ItemKind) -> Result {
ItemKind::Static(a, b, c) => ForeignItemKind::Static(a, b, c),
ItemKind::Fn(a, b, c, d) => ForeignItemKind::Fn(a, b, c, d),
ItemKind::TyAlias(a, b, c, d) => ForeignItemKind::TyAlias(a, b, c, d),
- ItemKind::Mac(a) => ForeignItemKind::Macro(a),
+ ItemKind::MacCall(a) => ForeignItemKind::MacCall(a),
_ => return Err(item_kind),
})
}
diff --git a/src/librustc_ast/attr/mod.rs b/src/librustc_ast/attr/mod.rs
index 52a59e82ae23..249311851fb1 100644
--- a/src/librustc_ast/attr/mod.rs
+++ b/src/librustc_ast/attr/mod.rs
@@ -679,7 +679,7 @@ fn attrs(&self) -> &[Attribute] {
StmtKind::Local(ref local) => local.attrs(),
StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => expr.attrs(),
StmtKind::Empty | StmtKind::Item(..) => &[],
- StmtKind::Mac(ref mac) => {
+ StmtKind::MacCall(ref mac) => {
let (_, _, ref attrs) = **mac;
attrs.attrs()
}
@@ -691,7 +691,7 @@ fn visit_attrs(&mut self, f: impl FnOnce(&mut Vec)) {
StmtKind::Local(local) => local.visit_attrs(f),
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.visit_attrs(f),
StmtKind::Empty | StmtKind::Item(..) => {}
- StmtKind::Mac(mac) => {
+ StmtKind::MacCall(mac) => {
let (_mac, _style, attrs) = mac.deref_mut();
attrs.visit_attrs(f);
}
diff --git a/src/librustc_ast/mut_visit.rs b/src/librustc_ast/mut_visit.rs
index dedc74eea927..a1a5b9debc50 100644
--- a/src/librustc_ast/mut_visit.rs
+++ b/src/librustc_ast/mut_visit.rs
@@ -202,7 +202,7 @@ fn visit_local(&mut self, l: &mut P) {
noop_visit_local(l, self);
}
- fn visit_mac(&mut self, _mac: &mut Mac) {
+ fn visit_mac(&mut self, _mac: &mut MacCall) {
panic!("visit_mac disabled by default");
// N.B., see note about macros above. If you really want a visitor that
// works on macros, use this definition in your trait impl:
@@ -482,7 +482,7 @@ pub fn noop_visit_ty(ty: &mut P, vis: &mut T) {
vis.visit_id(id);
visit_vec(bounds, |bound| vis.visit_param_bound(bound));
}
- TyKind::Mac(mac) => vis.visit_mac(mac),
+ TyKind::MacCall(mac) => vis.visit_mac(mac),
}
vis.visit_span(span);
}
@@ -584,8 +584,8 @@ pub fn noop_visit_attribute(attr: &mut Attribute, vis: &mut T) {
vis.visit_span(span);
}
-pub fn noop_visit_mac(mac: &mut Mac, vis: &mut T) {
- let Mac { path, args, prior_type_ascription: _ } = mac;
+pub fn noop_visit_mac(mac: &mut MacCall, vis: &mut T) {
+ let MacCall { path, args, prior_type_ascription: _ } = mac;
vis.visit_path(path);
visit_mac_args(args, vis);
}
@@ -926,7 +926,7 @@ pub fn noop_visit_item_kind(kind: &mut ItemKind, vis: &mut T) {
vis.visit_generics(generics);
visit_bounds(bounds, vis);
}
- ItemKind::Mac(m) => vis.visit_mac(m),
+ ItemKind::MacCall(m) => vis.visit_mac(m),
ItemKind::MacroDef(def) => vis.visit_macro_def(def),
}
}
@@ -955,7 +955,7 @@ pub fn noop_flat_map_assoc_item(
visit_bounds(bounds, visitor);
visit_opt(ty, |ty| visitor.visit_ty(ty));
}
- AssocItemKind::Macro(mac) => visitor.visit_mac(mac),
+ AssocItemKind::MacCall(mac) => visitor.visit_mac(mac),
}
visitor.visit_span(span);
smallvec![item]
@@ -1043,7 +1043,7 @@ pub fn noop_flat_map_foreign_item(
visit_bounds(bounds, visitor);
visit_opt(ty, |ty| visitor.visit_ty(ty));
}
- ForeignItemKind::Macro(mac) => visitor.visit_mac(mac),
+ ForeignItemKind::MacCall(mac) => visitor.visit_mac(mac),
}
visitor.visit_span(span);
smallvec![item]
@@ -1082,7 +1082,7 @@ pub fn noop_visit_pat(pat: &mut P, vis: &mut T) {
visit_vec(elems, |elem| vis.visit_pat(elem))
}
PatKind::Paren(inner) => vis.visit_pat(inner),
- PatKind::Mac(mac) => vis.visit_mac(mac),
+ PatKind::MacCall(mac) => vis.visit_mac(mac),
}
vis.visit_span(span);
}
@@ -1219,7 +1219,7 @@ pub fn noop_visit_expr(Expr { kind, id, span, attrs }: &mut Expr,
}
visit_vec(inputs, |(_c, expr)| vis.visit_expr(expr));
}
- ExprKind::Mac(mac) => vis.visit_mac(mac),
+ ExprKind::MacCall(mac) => vis.visit_mac(mac),
ExprKind::Struct(path, fields, expr) => {
vis.visit_path(path);
fields.flat_map_in_place(|field| vis.flat_map_field(field));
@@ -1275,11 +1275,11 @@ pub fn noop_flat_map_stmt_kind(
StmtKind::Expr(expr) => vis.filter_map_expr(expr).into_iter().map(StmtKind::Expr).collect(),
StmtKind::Semi(expr) => vis.filter_map_expr(expr).into_iter().map(StmtKind::Semi).collect(),
StmtKind::Empty => smallvec![StmtKind::Empty],
- StmtKind::Mac(mut mac) => {
+ StmtKind::MacCall(mut mac) => {
let (mac_, _semi, attrs) = mac.deref_mut();
vis.visit_mac(mac_);
visit_thin_attrs(attrs, vis);
- smallvec![StmtKind::Mac(mac)]
+ smallvec![StmtKind::MacCall(mac)]
}
}
}
diff --git a/src/librustc_ast/visit.rs b/src/librustc_ast/visit.rs
index 1436c84b9c1f..39028b7583c6 100644
--- a/src/librustc_ast/visit.rs
+++ b/src/librustc_ast/visit.rs
@@ -168,7 +168,7 @@ fn visit_label(&mut self, label: &'ast Label) {
fn visit_lifetime(&mut self, lifetime: &'ast Lifetime) {
walk_lifetime(self, lifetime)
}
- fn visit_mac(&mut self, _mac: &'ast Mac) {
+ fn visit_mac(&mut self, _mac: &'ast MacCall) {
panic!("visit_mac disabled by default");
// N.B., see note about macros above.
// if you really want a visitor that
@@ -350,7 +350,7 @@ pub fn walk_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a Item) {
visitor.visit_generics(generics);
walk_list!(visitor, visit_param_bound, bounds);
}
- ItemKind::Mac(ref mac) => visitor.visit_mac(mac),
+ ItemKind::MacCall(ref mac) => visitor.visit_mac(mac),
ItemKind::MacroDef(ref ts) => visitor.visit_mac_def(ts, item.id),
}
walk_list!(visitor, visit_attribute, &item.attrs);
@@ -418,7 +418,7 @@ pub fn walk_ty<'a, V: Visitor<'a>>(visitor: &mut V, typ: &'a Ty) {
}
TyKind::Typeof(ref expression) => visitor.visit_anon_const(expression),
TyKind::Infer | TyKind::ImplicitSelf | TyKind::Err => {}
- TyKind::Mac(ref mac) => visitor.visit_mac(mac),
+ TyKind::MacCall(ref mac) => visitor.visit_mac(mac),
TyKind::Never | TyKind::CVarArgs => {}
}
}
@@ -521,7 +521,7 @@ pub fn walk_pat<'a, V: Visitor<'a>>(visitor: &mut V, pattern: &'a Pat) {
PatKind::Tuple(ref elems) | PatKind::Slice(ref elems) | PatKind::Or(ref elems) => {
walk_list!(visitor, visit_pat, elems);
}
- PatKind::Mac(ref mac) => visitor.visit_mac(mac),
+ PatKind::MacCall(ref mac) => visitor.visit_mac(mac),
}
}
@@ -545,7 +545,7 @@ pub fn walk_foreign_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a ForeignI
walk_list!(visitor, visit_param_bound, bounds);
walk_list!(visitor, visit_ty, ty);
}
- ForeignItemKind::Macro(mac) => {
+ ForeignItemKind::MacCall(mac) => {
visitor.visit_mac(mac);
}
}
@@ -650,7 +650,7 @@ pub fn walk_assoc_item<'a, V: Visitor<'a>>(visitor: &mut V, item: &'a AssocItem,
walk_list!(visitor, visit_param_bound, bounds);
walk_list!(visitor, visit_ty, ty);
}
- AssocItemKind::Macro(mac) => {
+ AssocItemKind::MacCall(mac) => {
visitor.visit_mac(mac);
}
}
@@ -679,7 +679,7 @@ pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) {
StmtKind::Item(ref item) => visitor.visit_item(item),
StmtKind::Expr(ref expr) | StmtKind::Semi(ref expr) => visitor.visit_expr(expr),
StmtKind::Empty => {}
- StmtKind::Mac(ref mac) => {
+ StmtKind::MacCall(ref mac) => {
let (ref mac, _, ref attrs) = **mac;
visitor.visit_mac(mac);
for attr in attrs.iter() {
@@ -689,7 +689,7 @@ pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) {
}
}
-pub fn walk_mac<'a, V: Visitor<'a>>(visitor: &mut V, mac: &'a Mac) {
+pub fn walk_mac<'a, V: Visitor<'a>>(visitor: &mut V, mac: &'a MacCall) {
visitor.visit_path(&mac.path, DUMMY_NODE_ID);
}
@@ -811,7 +811,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
ExprKind::Ret(ref optional_expression) => {
walk_list!(visitor, visit_expr, optional_expression);
}
- ExprKind::Mac(ref mac) => visitor.visit_mac(mac),
+ ExprKind::MacCall(ref mac) => visitor.visit_mac(mac),
ExprKind::Paren(ref subexpression) => visitor.visit_expr(subexpression),
ExprKind::InlineAsm(ref ia) => {
for &(_, ref input) in &ia.inputs {
diff --git a/src/librustc_ast_lowering/expr.rs b/src/librustc_ast_lowering/expr.rs
index 7038387caa9b..a4cbae519663 100644
--- a/src/librustc_ast_lowering/expr.rs
+++ b/src/librustc_ast_lowering/expr.rs
@@ -198,7 +198,7 @@ pub(super) fn lower_expr_mut(&mut self, e: &Expr) -> hir::Expr<'hir> {
return self.lower_expr_for(e, pat, head, body, opt_label);
}
ExprKind::Try(ref sub_expr) => self.lower_expr_try(e.span, sub_expr),
- ExprKind::Mac(_) => panic!("Shouldn't exist here"),
+ ExprKind::MacCall(_) => panic!("Shouldn't exist here"),
};
hir::Expr {
diff --git a/src/librustc_ast_lowering/item.rs b/src/librustc_ast_lowering/item.rs
index 46aad99f1313..d17267a153c3 100644
--- a/src/librustc_ast_lowering/item.rs
+++ b/src/librustc_ast_lowering/item.rs
@@ -426,7 +426,7 @@ fn lower_item_kind(
self.lower_generics(generics, ImplTraitContext::disallowed()),
self.lower_param_bounds(bounds, ImplTraitContext::disallowed()),
),
- ItemKind::MacroDef(..) | ItemKind::Mac(..) => {
+ ItemKind::MacroDef(..) | ItemKind::MacCall(..) => {
bug!("`TyMac` should have been expanded by now")
}
}
@@ -676,7 +676,7 @@ fn lower_foreign_item(&mut self, i: &ForeignItem) -> hir::ForeignItem<'hir> {
hir::ForeignItemKind::Static(ty, m)
}
ForeignItemKind::TyAlias(..) => hir::ForeignItemKind::Type,
- ForeignItemKind::Macro(_) => panic!("macro shouldn't exist here"),
+ ForeignItemKind::MacCall(_) => panic!("macro shouldn't exist here"),
},
vis: self.lower_visibility(&i.vis, None),
span: i.span,
@@ -779,7 +779,7 @@ fn lower_trait_item(&mut self, i: &AssocItem) -> hir::TraitItem<'hir> {
(generics, kind)
}
- AssocItemKind::Macro(..) => bug!("macro item shouldn't exist at this point"),
+ AssocItemKind::MacCall(..) => bug!("macro item shouldn't exist at this point"),
};
hir::TraitItem {
@@ -801,7 +801,7 @@ fn lower_trait_item_ref(&mut self, i: &AssocItem) -> hir::TraitItemRef {
AssocItemKind::Fn(_, sig, _, default) => {
(hir::AssocItemKind::Method { has_self: sig.decl.has_self() }, default.is_some())
}
- AssocItemKind::Macro(..) => unimplemented!(),
+ AssocItemKind::MacCall(..) => unimplemented!(),
};
let id = hir::TraitItemId { hir_id: self.lower_node_id(i.id) };
let defaultness = hir::Defaultness::Default { has_value: has_default };
@@ -860,7 +860,7 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> hir::ImplItem<'hir> {
};
(generics, kind)
}
- AssocItemKind::Macro(..) => bug!("`TyMac` should have been expanded by now"),
+ AssocItemKind::MacCall(..) => bug!("`TyMac` should have been expanded by now"),
};
hir::ImplItem {
@@ -895,7 +895,7 @@ fn lower_impl_item_ref(&mut self, i: &AssocItem) -> hir::ImplItemRef<'hir> {
AssocItemKind::Fn(_, sig, ..) => {
hir::AssocItemKind::Method { has_self: sig.decl.has_self() }
}
- AssocItemKind::Macro(..) => unimplemented!(),
+ AssocItemKind::MacCall(..) => unimplemented!(),
},
}
diff --git a/src/librustc_ast_lowering/lib.rs b/src/librustc_ast_lowering/lib.rs
index dd9526ccee41..24e547af237d 100644
--- a/src/librustc_ast_lowering/lib.rs
+++ b/src/librustc_ast_lowering/lib.rs
@@ -1334,7 +1334,7 @@ fn lower_ty_direct(&mut self, t: &Ty, mut itctx: ImplTraitContext<'_, 'hir>) ->
}
}
}
- TyKind::Mac(_) => bug!("`TyKind::Mac` should have been expanded by now"),
+ TyKind::MacCall(_) => bug!("`TyKind::MacCall` should have been expanded by now"),
TyKind::CVarArgs => {
self.sess.delay_span_bug(
t.span,
@@ -2282,7 +2282,7 @@ fn lower_anon_const(&mut self, c: &AnonConst) -> hir::AnonConst {
StmtKind::Expr(ref e) => hir::StmtKind::Expr(self.lower_expr(e)),
StmtKind::Semi(ref e) => hir::StmtKind::Semi(self.lower_expr(e)),
StmtKind::Empty => return smallvec![],
- StmtKind::Mac(..) => panic!("shouldn't exist here"),
+ StmtKind::MacCall(..) => panic!("shouldn't exist here"),
};
smallvec![hir::Stmt { hir_id: self.lower_node_id(s.id), kind, span: s.span }]
}
diff --git a/src/librustc_ast_lowering/pat.rs b/src/librustc_ast_lowering/pat.rs
index d6f4ba1529be..8ba6576f6926 100644
--- a/src/librustc_ast_lowering/pat.rs
+++ b/src/librustc_ast_lowering/pat.rs
@@ -75,7 +75,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
self.ban_illegal_rest_pat(p.span)
}
PatKind::Paren(ref inner) => return self.lower_pat(inner),
- PatKind::Mac(_) => panic!("Shouldn't exist here"),
+ PatKind::MacCall(_) => panic!("Shouldn't exist here"),
};
self.pat_with_node_id_of(p, node)
diff --git a/src/librustc_ast_passes/ast_validation.rs b/src/librustc_ast_passes/ast_validation.rs
index 69d5610e0160..d7491800f042 100644
--- a/src/librustc_ast_passes/ast_validation.rs
+++ b/src/librustc_ast_passes/ast_validation.rs
@@ -976,7 +976,7 @@ fn visit_foreign_item(&mut self, fi: &'a ForeignItem) {
ForeignItemKind::Static(_, _, body) => {
self.check_foreign_kind_bodyless(fi.ident, "static", body.as_ref().map(|b| b.span));
}
- ForeignItemKind::Macro(..) => {}
+ ForeignItemKind::MacCall(..) => {}
}
visit::walk_foreign_item(self, fi)
diff --git a/src/librustc_ast_passes/feature_gate.rs b/src/librustc_ast_passes/feature_gate.rs
index a4ab54f8b4a8..4a7ebedbab08 100644
--- a/src/librustc_ast_passes/feature_gate.rs
+++ b/src/librustc_ast_passes/feature_gate.rs
@@ -399,7 +399,7 @@ fn visit_foreign_item(&mut self, i: &'a ast::ForeignItem) {
ast::ForeignItemKind::TyAlias(..) => {
gate_feature_post!(&self, extern_types, i.span, "extern types are experimental");
}
- ast::ForeignItemKind::Macro(..) => {}
+ ast::ForeignItemKind::MacCall(..) => {}
}
visit::walk_foreign_item(self, i)
diff --git a/src/librustc_ast_passes/node_count.rs b/src/librustc_ast_passes/node_count.rs
index 16bcec8360e3..534d6c7b1ea7 100644
--- a/src/librustc_ast_passes/node_count.rs
+++ b/src/librustc_ast_passes/node_count.rs
@@ -113,7 +113,7 @@ fn visit_lifetime(&mut self, lifetime: &Lifetime) {
self.count += 1;
walk_lifetime(self, lifetime)
}
- fn visit_mac(&mut self, _mac: &Mac) {
+ fn visit_mac(&mut self, _mac: &MacCall) {
self.count += 1;
walk_mac(self, _mac)
}
diff --git a/src/librustc_ast_passes/show_span.rs b/src/librustc_ast_passes/show_span.rs
index 73a66ba566bc..2366426d4dcb 100644
--- a/src/librustc_ast_passes/show_span.rs
+++ b/src/librustc_ast_passes/show_span.rs
@@ -55,7 +55,7 @@ fn visit_ty(&mut self, t: &'a ast::Ty) {
visit::walk_ty(self, t);
}
- fn visit_mac(&mut self, mac: &'a ast::Mac) {
+ fn visit_mac(&mut self, mac: &'a ast::MacCall) {
visit::walk_mac(self, mac);
}
}
diff --git a/src/librustc_ast_pretty/pprust.rs b/src/librustc_ast_pretty/pprust.rs
index b11dda8af731..e3f75769eef8 100644
--- a/src/librustc_ast_pretty/pprust.rs
+++ b/src/librustc_ast_pretty/pprust.rs
@@ -960,7 +960,7 @@ pub fn print_type(&mut self, ty: &ast::Ty) {
ast::TyKind::ImplicitSelf => {
self.s.word("Self");
}
- ast::TyKind::Mac(ref m) => {
+ ast::TyKind::MacCall(ref m) => {
self.print_mac(m);
}
ast::TyKind::CVarArgs => {
@@ -987,7 +987,7 @@ pub fn print_type(&mut self, ty: &ast::Ty) {
ast::ForeignItemKind::TyAlias(def, generics, bounds, ty) => {
self.print_associated_type(ident, generics, bounds, ty.as_deref(), vis, *def);
}
- ast::ForeignItemKind::Macro(m) => {
+ ast::ForeignItemKind::MacCall(m) => {
self.print_mac(m);
if m.args.need_semicolon() {
self.s.word(";");
@@ -1231,7 +1231,7 @@ fn print_associated_type(
self.print_where_clause(&generics.where_clause);
self.s.word(";");
}
- ast::ItemKind::Mac(ref mac) => {
+ ast::ItemKind::MacCall(ref mac) => {
self.print_mac(mac);
if mac.args.need_semicolon() {
self.s.word(";");
@@ -1413,7 +1413,7 @@ fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) {
ast::AssocItemKind::TyAlias(def, generics, bounds, ty) => {
self.print_associated_type(ident, generics, bounds, ty.as_deref(), vis, *def);
}
- ast::AssocItemKind::Macro(m) => {
+ ast::AssocItemKind::MacCall(m) => {
self.print_mac(m);
if m.args.need_semicolon() {
self.s.word(";");
@@ -1460,7 +1460,7 @@ fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) {
self.space_if_not_bol();
self.s.word(";");
}
- ast::StmtKind::Mac(ref mac) => {
+ ast::StmtKind::MacCall(ref mac) => {
let (ref mac, style, ref attrs) = **mac;
self.space_if_not_bol();
self.print_outer_attributes(attrs);
@@ -1570,7 +1570,7 @@ fn print_else(&mut self, els: Option<&ast::Expr>) {
self.print_else(elseopt)
}
- crate fn print_mac(&mut self, m: &ast::Mac) {
+ crate fn print_mac(&mut self, m: &ast::MacCall) {
self.print_mac_common(
Some(MacHeader::Path(&m.path)),
true,
@@ -2070,7 +2070,7 @@ fn print_expr_outer_attr_style(&mut self, expr: &ast::Expr, is_inline: bool) {
self.pclose();
}
- ast::ExprKind::Mac(ref m) => self.print_mac(m),
+ ast::ExprKind::MacCall(ref m) => self.print_mac(m),
ast::ExprKind::Paren(ref e) => {
self.popen();
self.print_inner_attributes_inline(attrs);
@@ -2254,7 +2254,7 @@ fn print_qpath(&mut self, path: &ast::Path, qself: &ast::QSelf, colons_before_pa
self.print_pat(inner);
self.pclose();
}
- PatKind::Mac(ref m) => self.print_mac(m),
+ PatKind::MacCall(ref m) => self.print_mac(m),
}
self.ann.post(self, AnnNode::Pat(pat))
}
diff --git a/src/librustc_builtin_macros/assert.rs b/src/librustc_builtin_macros/assert.rs
index 09ff770e87b5..3a3595b04d28 100644
--- a/src/librustc_builtin_macros/assert.rs
+++ b/src/librustc_builtin_macros/assert.rs
@@ -40,7 +40,7 @@ pub fn expand_assert<'cx>(
))
});
let args = P(MacArgs::Delimited(DelimSpan::from_single(sp), MacDelimiter::Parenthesis, tokens));
- let panic_call = Mac {
+ let panic_call = MacCall {
path: Path::from_ident(Ident::new(sym::panic, sp)),
args,
prior_type_ascription: None,
@@ -48,7 +48,7 @@ pub fn expand_assert<'cx>(
let if_expr = cx.expr_if(
sp,
cx.expr(sp, ExprKind::Unary(UnOp::Not, cond_expr)),
- cx.expr(sp, ExprKind::Mac(panic_call)),
+ cx.expr(sp, ExprKind::MacCall(panic_call)),
None,
);
MacEager::expr(if_expr)
diff --git a/src/librustc_builtin_macros/deriving/generic/mod.rs b/src/librustc_builtin_macros/deriving/generic/mod.rs
index e0c619fcbd37..84ed6e96aafc 100644
--- a/src/librustc_builtin_macros/deriving/generic/mod.rs
+++ b/src/librustc_builtin_macros/deriving/generic/mod.rs
@@ -360,7 +360,7 @@ fn visit_ty(&mut self, ty: &'a ast::Ty) {
visit::walk_ty(self, ty)
}
- fn visit_mac(&mut self, mac: &ast::Mac) {
+ fn visit_mac(&mut self, mac: &ast::MacCall) {
self.cx.span_err(mac.span(), "`derive` cannot be used on items with type macros");
}
}
diff --git a/src/librustc_builtin_macros/proc_macro_harness.rs b/src/librustc_builtin_macros/proc_macro_harness.rs
index 797246623633..179b01334263 100644
--- a/src/librustc_builtin_macros/proc_macro_harness.rs
+++ b/src/librustc_builtin_macros/proc_macro_harness.rs
@@ -341,7 +341,7 @@ fn visit_item(&mut self, item: &'a ast::Item) {
self.in_root = prev_in_root;
}
- fn visit_mac(&mut self, mac: &'a ast::Mac) {
+ fn visit_mac(&mut self, mac: &'a ast::MacCall) {
visit::walk_mac(self, mac)
}
}
diff --git a/src/librustc_builtin_macros/test.rs b/src/librustc_builtin_macros/test.rs
index bc194a3eec4c..39009ca27f10 100644
--- a/src/librustc_builtin_macros/test.rs
+++ b/src/librustc_builtin_macros/test.rs
@@ -86,7 +86,7 @@ pub fn expand_test_or_bench(
.raise();
};
- if let ast::ItemKind::Mac(_) = item.kind {
+ if let ast::ItemKind::MacCall(_) = item.kind {
cx.parse_sess.span_diagnostic.span_warn(
item.span,
"`#[test]` attribute should not be used on macros. Use `#[cfg(test)]` instead.",
diff --git a/src/librustc_builtin_macros/test_harness.rs b/src/librustc_builtin_macros/test_harness.rs
index e7e1ad8eda78..15997a27fadf 100644
--- a/src/librustc_builtin_macros/test_harness.rs
+++ b/src/librustc_builtin_macros/test_harness.rs
@@ -138,7 +138,7 @@ fn visit_crate(&mut self, c: &mut ast::Crate) {
smallvec![P(item)]
}
- fn visit_mac(&mut self, _mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
// Do nothing.
}
}
@@ -184,7 +184,7 @@ impl MutVisitor for EntryPointCleaner {
smallvec![item]
}
- fn visit_mac(&mut self, _mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
// Do nothing.
}
}
diff --git a/src/librustc_expand/base.rs b/src/librustc_expand/base.rs
index f15e626c2783..2d27fe09f98c 100644
--- a/src/librustc_expand/base.rs
+++ b/src/librustc_expand/base.rs
@@ -372,7 +372,7 @@ fn visit_tt(&mut self, tt: &mut tokenstream::TokenTree) {
mut_visit::noop_visit_tt(tt, self)
}
- fn visit_mac(&mut self, mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, mac: &mut ast::MacCall) {
mut_visit::noop_visit_mac(mac, self)
}
}
diff --git a/src/librustc_expand/expand.rs b/src/librustc_expand/expand.rs
index effa89e8bfb2..73197160a026 100644
--- a/src/librustc_expand/expand.rs
+++ b/src/librustc_expand/expand.rs
@@ -271,7 +271,7 @@ pub struct Invocation {
pub enum InvocationKind {
Bang {
- mac: ast::Mac,
+ mac: ast::MacCall,
span: Span,
},
Attr {
@@ -625,7 +625,7 @@ fn error_recursion_limit_reached(&mut self) {
/// A macro's expansion does not fit in this fragment kind.
/// For example, a non-type macro in a type position.
- fn error_wrong_fragment_kind(&mut self, kind: AstFragmentKind, mac: &ast::Mac, span: Span) {
+ fn error_wrong_fragment_kind(&mut self, kind: AstFragmentKind, mac: &ast::MacCall, span: Span) {
let msg = format!(
"non-{kind} macro in {kind} position: {path}",
kind = kind.name(),
@@ -768,7 +768,7 @@ fn visit_item(&mut self, item: &'ast ast::Item) {
visit::walk_item(self, item);
}
- fn visit_mac(&mut self, _: &'ast ast::Mac) {}
+ fn visit_mac(&mut self, _: &'ast ast::MacCall) {}
}
if !self.cx.ecfg.proc_macro_hygiene() {
@@ -967,7 +967,12 @@ fn collect(&mut self, fragment_kind: AstFragmentKind, kind: InvocationKind) -> A
placeholder(fragment_kind, NodeId::placeholder_from_expn_id(expn_id), vis)
}
- fn collect_bang(&mut self, mac: ast::Mac, span: Span, kind: AstFragmentKind) -> AstFragment {
+ fn collect_bang(
+ &mut self,
+ mac: ast::MacCall,
+ span: Span,
+ kind: AstFragmentKind,
+ ) -> AstFragment {
self.collect(kind, InvocationKind::Bang { mac, span })
}
@@ -1110,7 +1115,7 @@ fn visit_expr(&mut self, expr: &mut P) {
.into_inner();
}
- if let ast::ExprKind::Mac(mac) = expr.kind {
+ if let ast::ExprKind::MacCall(mac) = expr.kind {
self.check_attributes(&expr.attrs);
self.collect_bang(mac, expr.span, AstFragmentKind::Expr).make_expr().into_inner()
} else {
@@ -1257,7 +1262,7 @@ fn filter_map_expr(&mut self, expr: P) -> Option> {
.map(|expr| expr.into_inner());
}
- if let ast::ExprKind::Mac(mac) = expr.kind {
+ if let ast::ExprKind::MacCall(mac) = expr.kind {
self.check_attributes(&expr.attrs);
self.collect_bang(mac, expr.span, AstFragmentKind::OptExpr)
.make_opt_expr()
@@ -1274,12 +1279,14 @@ fn filter_map_expr(&mut self, expr: P) -> Option> {
fn visit_pat(&mut self, pat: &mut P) {
self.cfg.configure_pat(pat);
match pat.kind {
- PatKind::Mac(_) => {}
+ PatKind::MacCall(_) => {}
_ => return noop_visit_pat(pat, self),
}
visit_clobber(pat, |mut pat| match mem::replace(&mut pat.kind, PatKind::Wild) {
- PatKind::Mac(mac) => self.collect_bang(mac, pat.span, AstFragmentKind::Pat).make_pat(),
+ PatKind::MacCall(mac) => {
+ self.collect_bang(mac, pat.span, AstFragmentKind::Pat).make_pat()
+ }
_ => unreachable!(),
});
}
@@ -1311,7 +1318,7 @@ fn visit_pat(&mut self, pat: &mut P) {
}
}
- if let StmtKind::Mac(mac) = stmt.kind {
+ if let StmtKind::MacCall(mac) = stmt.kind {
let (mac, style, attrs) = mac.into_inner();
self.check_attributes(&attrs);
let mut placeholder =
@@ -1360,10 +1367,10 @@ fn visit_block(&mut self, block: &mut P) {
}
match item.kind {
- ast::ItemKind::Mac(..) => {
+ ast::ItemKind::MacCall(..) => {
self.check_attributes(&item.attrs);
item.and_then(|item| match item.kind {
- ItemKind::Mac(mac) => self
+ ItemKind::MacCall(mac) => self
.collect(
AstFragmentKind::Items,
InvocationKind::Bang { mac, span: item.span },
@@ -1432,10 +1439,10 @@ fn visit_block(&mut self, block: &mut P) {
}
match item.kind {
- ast::AssocItemKind::Macro(..) => {
+ ast::AssocItemKind::MacCall(..) => {
self.check_attributes(&item.attrs);
item.and_then(|item| match item.kind {
- ast::AssocItemKind::Macro(mac) => self
+ ast::AssocItemKind::MacCall(mac) => self
.collect_bang(mac, item.span, AstFragmentKind::TraitItems)
.make_trait_items(),
_ => unreachable!(),
@@ -1462,10 +1469,10 @@ fn visit_block(&mut self, block: &mut P) {
}
match item.kind {
- ast::AssocItemKind::Macro(..) => {
+ ast::AssocItemKind::MacCall(..) => {
self.check_attributes(&item.attrs);
item.and_then(|item| match item.kind {
- ast::AssocItemKind::Macro(mac) => self
+ ast::AssocItemKind::MacCall(mac) => self
.collect_bang(mac, item.span, AstFragmentKind::ImplItems)
.make_impl_items(),
_ => unreachable!(),
@@ -1477,12 +1484,14 @@ fn visit_block(&mut self, block: &mut P) {
fn visit_ty(&mut self, ty: &mut P) {
match ty.kind {
- ast::TyKind::Mac(_) => {}
+ ast::TyKind::MacCall(_) => {}
_ => return noop_visit_ty(ty, self),
};
visit_clobber(ty, |mut ty| match mem::replace(&mut ty.kind, ast::TyKind::Err) {
- ast::TyKind::Mac(mac) => self.collect_bang(mac, ty.span, AstFragmentKind::Ty).make_ty(),
+ ast::TyKind::MacCall(mac) => {
+ self.collect_bang(mac, ty.span, AstFragmentKind::Ty).make_ty()
+ }
_ => unreachable!(),
});
}
@@ -1511,10 +1520,10 @@ fn flat_map_foreign_item(
}
match foreign_item.kind {
- ast::ForeignItemKind::Macro(..) => {
+ ast::ForeignItemKind::MacCall(..) => {
self.check_attributes(&foreign_item.attrs);
foreign_item.and_then(|item| match item.kind {
- ast::ForeignItemKind::Macro(mac) => self
+ ast::ForeignItemKind::MacCall(mac) => self
.collect_bang(mac, item.span, AstFragmentKind::ForeignItems)
.make_foreign_items(),
_ => unreachable!(),
diff --git a/src/librustc_expand/mbe/transcribe.rs b/src/librustc_expand/mbe/transcribe.rs
index d12dedf9e0c7..7a64d40785e0 100644
--- a/src/librustc_expand/mbe/transcribe.rs
+++ b/src/librustc_expand/mbe/transcribe.rs
@@ -2,7 +2,7 @@
use crate::mbe;
use crate::mbe::macro_parser::{MatchedNonterminal, MatchedSeq, NamedMatch};
-use rustc_ast::ast::{Ident, Mac};
+use rustc_ast::ast::{Ident, MacCall};
use rustc_ast::mut_visit::{self, MutVisitor};
use rustc_ast::token::{self, NtTT, Token};
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree, TreeAndJoint};
@@ -23,7 +23,7 @@ fn visit_span(&mut self, span: &mut Span) {
*span = span.apply_mark(self.0, self.1)
}
- fn visit_mac(&mut self, mac: &mut Mac) {
+ fn visit_mac(&mut self, mac: &mut MacCall) {
mut_visit::noop_visit_mac(mac, self)
}
}
diff --git a/src/librustc_expand/mut_visit/tests.rs b/src/librustc_expand/mut_visit/tests.rs
index 4c947d8fa2b4..70fb8975d4d0 100644
--- a/src/librustc_expand/mut_visit/tests.rs
+++ b/src/librustc_expand/mut_visit/tests.rs
@@ -17,7 +17,7 @@ impl MutVisitor for ToZzIdentMutVisitor {
fn visit_ident(&mut self, ident: &mut ast::Ident) {
*ident = Ident::from_str("zz");
}
- fn visit_mac(&mut self, mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, mac: &mut ast::MacCall) {
mut_visit::noop_visit_mac(mac, self)
}
}
diff --git a/src/librustc_expand/parse/tests.rs b/src/librustc_expand/parse/tests.rs
index 55e815bd4a4e..4add896258fa 100644
--- a/src/librustc_expand/parse/tests.rs
+++ b/src/librustc_expand/parse/tests.rs
@@ -281,7 +281,7 @@ fn parse_expr_from_source_str(
.unwrap();
let tts: Vec<_> = match expr.kind {
- ast::ExprKind::Mac(ref mac) => mac.args.inner_tokens().trees().collect(),
+ ast::ExprKind::MacCall(ref mac) => mac.args.inner_tokens().trees().collect(),
_ => panic!("not a macro"),
};
diff --git a/src/librustc_expand/placeholders.rs b/src/librustc_expand/placeholders.rs
index cd4f0a61d424..e1781f8636e5 100644
--- a/src/librustc_expand/placeholders.rs
+++ b/src/librustc_expand/placeholders.rs
@@ -15,8 +15,8 @@ pub fn placeholder(
id: ast::NodeId,
vis: Option,
) -> AstFragment {
- fn mac_placeholder() -> ast::Mac {
- ast::Mac {
+ fn mac_placeholder() -> ast::MacCall {
+ ast::MacCall {
path: ast::Path { span: DUMMY_SP, segments: Vec::new() },
args: P(ast::MacArgs::Empty),
prior_type_ascription: None,
@@ -32,11 +32,11 @@ fn mac_placeholder() -> ast::Mac {
id,
span,
attrs: ast::AttrVec::new(),
- kind: ast::ExprKind::Mac(mac_placeholder()),
+ kind: ast::ExprKind::MacCall(mac_placeholder()),
})
};
- let ty = || P(ast::Ty { id, kind: ast::TyKind::Mac(mac_placeholder()), span });
- let pat = || P(ast::Pat { id, kind: ast::PatKind::Mac(mac_placeholder()), span });
+ 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::Expr => AstFragment::Expr(expr_placeholder()),
@@ -47,7 +47,7 @@ fn mac_placeholder() -> ast::Mac {
ident,
vis,
attrs,
- kind: ast::ItemKind::Mac(mac_placeholder()),
+ kind: ast::ItemKind::MacCall(mac_placeholder()),
tokens: None,
})]),
AstFragmentKind::TraitItems => AstFragment::TraitItems(smallvec![P(ast::AssocItem {
@@ -56,7 +56,7 @@ fn mac_placeholder() -> ast::Mac {
ident,
vis,
attrs,
- kind: ast::AssocItemKind::Macro(mac_placeholder()),
+ kind: ast::AssocItemKind::MacCall(mac_placeholder()),
tokens: None,
})]),
AstFragmentKind::ImplItems => AstFragment::ImplItems(smallvec![P(ast::AssocItem {
@@ -65,7 +65,7 @@ fn mac_placeholder() -> ast::Mac {
ident,
vis,
attrs,
- kind: ast::AssocItemKind::Macro(mac_placeholder()),
+ kind: ast::AssocItemKind::MacCall(mac_placeholder()),
tokens: None,
})]),
AstFragmentKind::ForeignItems => {
@@ -75,19 +75,21 @@ fn mac_placeholder() -> ast::Mac {
ident,
vis,
attrs,
- kind: ast::ForeignItemKind::Macro(mac_placeholder()),
+ kind: ast::ForeignItemKind::MacCall(mac_placeholder()),
tokens: None,
})])
}
- AstFragmentKind::Pat => {
- AstFragment::Pat(P(ast::Pat { id, span, kind: ast::PatKind::Mac(mac_placeholder()) }))
- }
+ AstFragmentKind::Pat => AstFragment::Pat(P(ast::Pat {
+ id,
+ span,
+ kind: ast::PatKind::MacCall(mac_placeholder()),
+ })),
AstFragmentKind::Ty => {
- AstFragment::Ty(P(ast::Ty { id, span, kind: ast::TyKind::Mac(mac_placeholder()) }))
+ AstFragment::Ty(P(ast::Ty { id, span, kind: ast::TyKind::MacCall(mac_placeholder()) }))
}
AstFragmentKind::Stmts => AstFragment::Stmts(smallvec![{
let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ast::AttrVec::new()));
- ast::Stmt { id, span, kind: ast::StmtKind::Mac(mac) }
+ ast::Stmt { id, span, kind: ast::StmtKind::MacCall(mac) }
}]),
AstFragmentKind::Arms => AstFragment::Arms(smallvec![ast::Arm {
attrs: Default::default(),
@@ -239,7 +241,7 @@ fn flat_map_generic_param(
fn flat_map_item(&mut self, item: P) -> SmallVec<[P; 1]> {
match item.kind {
- ast::ItemKind::Mac(_) => return self.remove(item.id).make_items(),
+ ast::ItemKind::MacCall(_) => return self.remove(item.id).make_items(),
ast::ItemKind::MacroDef(_) => return smallvec![item],
_ => {}
}
@@ -249,14 +251,14 @@ fn flat_map_generic_param(
fn flat_map_trait_item(&mut self, item: P) -> SmallVec<[P; 1]> {
match item.kind {
- ast::AssocItemKind::Macro(_) => self.remove(item.id).make_trait_items(),
+ ast::AssocItemKind::MacCall(_) => self.remove(item.id).make_trait_items(),
_ => noop_flat_map_assoc_item(item, self),
}
}
fn flat_map_impl_item(&mut self, item: P) -> SmallVec<[P; 1]> {
match item.kind {
- ast::AssocItemKind::Macro(_) => self.remove(item.id).make_impl_items(),
+ ast::AssocItemKind::MacCall(_) => self.remove(item.id).make_impl_items(),
_ => noop_flat_map_assoc_item(item, self),
}
}
@@ -266,28 +268,28 @@ fn flat_map_foreign_item(
item: P,
) -> SmallVec<[P; 1]> {
match item.kind {
- ast::ForeignItemKind::Macro(_) => self.remove(item.id).make_foreign_items(),
+ ast::ForeignItemKind::MacCall(_) => self.remove(item.id).make_foreign_items(),
_ => noop_flat_map_foreign_item(item, self),
}
}
fn visit_expr(&mut self, expr: &mut P) {
match expr.kind {
- ast::ExprKind::Mac(_) => *expr = self.remove(expr.id).make_expr(),
+ ast::ExprKind::MacCall(_) => *expr = self.remove(expr.id).make_expr(),
_ => noop_visit_expr(expr, self),
}
}
fn filter_map_expr(&mut self, expr: P) -> Option> {
match expr.kind {
- ast::ExprKind::Mac(_) => self.remove(expr.id).make_opt_expr(),
+ ast::ExprKind::MacCall(_) => self.remove(expr.id).make_opt_expr(),
_ => noop_filter_map_expr(expr, self),
}
}
fn flat_map_stmt(&mut self, stmt: ast::Stmt) -> SmallVec<[ast::Stmt; 1]> {
let (style, mut stmts) = match stmt.kind {
- ast::StmtKind::Mac(mac) => (mac.1, self.remove(stmt.id).make_stmts()),
+ ast::StmtKind::MacCall(mac) => (mac.1, self.remove(stmt.id).make_stmts()),
_ => return noop_flat_map_stmt(stmt, self),
};
@@ -302,14 +304,14 @@ fn filter_map_expr(&mut self, expr: P) -> Option> {
fn visit_pat(&mut self, pat: &mut P) {
match pat.kind {
- ast::PatKind::Mac(_) => *pat = self.remove(pat.id).make_pat(),
+ ast::PatKind::MacCall(_) => *pat = self.remove(pat.id).make_pat(),
_ => noop_visit_pat(pat, self),
}
}
fn visit_ty(&mut self, ty: &mut P) {
match ty.kind {
- ast::TyKind::Mac(_) => *ty = self.remove(ty.id).make_ty(),
+ ast::TyKind::MacCall(_) => *ty = self.remove(ty.id).make_ty(),
_ => noop_visit_ty(ty, self),
}
}
@@ -328,12 +330,12 @@ fn visit_block(&mut self, block: &mut P) {
fn visit_mod(&mut self, module: &mut ast::Mod) {
noop_visit_mod(module, self);
module.items.retain(|item| match item.kind {
- ast::ItemKind::Mac(_) if !self.cx.ecfg.keep_macs => false, // remove macro definitions
+ ast::ItemKind::MacCall(_) if !self.cx.ecfg.keep_macs => false, // remove macro definitions
_ => true,
});
}
- fn visit_mac(&mut self, _mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
// Do nothing.
}
}
diff --git a/src/librustc_interface/util.rs b/src/librustc_interface/util.rs
index 7866ddbd4ccd..df05bd7c5117 100644
--- a/src/librustc_interface/util.rs
+++ b/src/librustc_interface/util.rs
@@ -780,7 +780,7 @@ fn block_to_stmt(b: ast::Block, resolver: &mut Resolver<'_>) -> ast::Stmt {
// in general the pretty printer processes unexpanded code, so
// we override the default `visit_mac` method which panics.
- fn visit_mac(&mut self, mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, mac: &mut ast::MacCall) {
noop_visit_mac(mac, self)
}
}
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index e1680015bead..c97dbb955ba8 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -778,7 +778,7 @@ fn check_stmt(&mut self, cx: &EarlyContext<'_>, stmt: &ast::Stmt) {
ast::StmtKind::Empty
| ast::StmtKind::Semi(_)
| ast::StmtKind::Expr(_)
- | ast::StmtKind::Mac(_) => return,
+ | ast::StmtKind::MacCall(_) => return,
};
warn_if_doc(cx, stmt.span, kind, stmt.kind.attrs());
@@ -1478,7 +1478,7 @@ impl EarlyLintPass for KeywordIdents {
fn check_mac_def(&mut self, cx: &EarlyContext<'_>, mac_def: &ast::MacroDef, _id: ast::NodeId) {
self.check_tokens(cx, mac_def.body.inner_tokens());
}
- fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::Mac) {
+ fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &ast::MacCall) {
self.check_tokens(cx, mac.args.inner_tokens());
}
fn check_ident(&mut self, cx: &EarlyContext<'_>, ident: ast::Ident) {
diff --git a/src/librustc_lint/early.rs b/src/librustc_lint/early.rs
index ff6e9e000b09..a5da960d8881 100644
--- a/src/librustc_lint/early.rs
+++ b/src/librustc_lint/early.rs
@@ -249,7 +249,7 @@ fn visit_mac_def(&mut self, mac: &'a ast::MacroDef, id: ast::NodeId) {
self.check_id(id);
}
- fn visit_mac(&mut self, mac: &'a ast::Mac) {
+ fn visit_mac(&mut self, mac: &'a ast::MacCall) {
// FIXME(#54110): So, this setup isn't really right. I think
// that (a) the librustc_ast visitor ought to be doing this as
// part of `walk_mac`, and (b) we should be calling
diff --git a/src/librustc_lint/passes.rs b/src/librustc_lint/passes.rs
index 813be2a032f8..ace154714458 100644
--- a/src/librustc_lint/passes.rs
+++ b/src/librustc_lint/passes.rs
@@ -198,7 +198,7 @@ fn check_fn_post(
fn check_path(a: &ast::Path, b: ast::NodeId);
fn check_attribute(a: &ast::Attribute);
fn check_mac_def(a: &ast::MacroDef, b: ast::NodeId);
- fn check_mac(a: &ast::Mac);
+ fn check_mac(a: &ast::MacCall);
/// Called when entering a syntax node that can have lint attributes such
/// as `#[allow(...)]`. Called with *all* the attributes of that node.
diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs
index 02f04b234593..e88600239e76 100644
--- a/src/librustc_lint/unused.rs
+++ b/src/librustc_lint/unused.rs
@@ -538,7 +538,7 @@ fn check_pat(&mut self, cx: &EarlyContext<'_>, p: &ast::Pat) {
// Do not lint on `(..)` as that will result in the other arms being useless.
Paren(_)
// The other cases do not contain sub-patterns.
- | Wild | Rest | Lit(..) | Mac(..) | Range(..) | Ident(.., None) | Path(..) => return,
+ | Wild | Rest | Lit(..) | MacCall(..) | Range(..) | Ident(.., None) | Path(..) => return,
// These are list-like patterns; parens can always be removed.
TupleStruct(_, ps) | Tuple(ps) | Slice(ps) | Or(ps) => for p in ps {
self.check_unused_parens_pat(cx, p, false, false);
diff --git a/src/librustc_parse/config.rs b/src/librustc_parse/config.rs
index f42091e7c296..d209da866e17 100644
--- a/src/librustc_parse/config.rs
+++ b/src/librustc_parse/config.rs
@@ -519,7 +519,7 @@ fn filter_map_expr(&mut self, expr: P) -> Option> {
noop_flat_map_assoc_item(configure!(self, item), self)
}
- fn visit_mac(&mut self, _mac: &mut ast::Mac) {
+ fn visit_mac(&mut self, _mac: &mut ast::MacCall) {
// Don't configure interpolated AST (cf. issue #34171).
// Interpolated AST will get configured once the surrounding tokens are parsed.
}
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 7f6f90431fc9..c65e99842c5d 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -4,8 +4,8 @@
use super::{SemiColonMode, SeqSep, TokenExpectType};
use crate::maybe_recover_from_interpolated_ty_qpath;
-use rustc_ast::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Ident, Lit, DUMMY_NODE_ID};
-use rustc_ast::ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, Mac, Param, Ty, TyKind, UnOp};
+use rustc_ast::ast::{self, AttrStyle, AttrVec, CaptureBy, Field, Ident, Lit, UnOp, DUMMY_NODE_ID};
+use rustc_ast::ast::{AnonConst, BinOp, BinOpKind, FnDecl, FnRetTy, MacCall, Param, Ty, TyKind};
use rustc_ast::ast::{Arm, Async, BlockCheckMode, Expr, ExprKind, Label, Movability, RangeLimits};
use rustc_ast::ptr::P;
use rustc_ast::token::{self, Token, TokenKind};
@@ -1065,12 +1065,12 @@ fn parse_path_start_expr(&mut self, attrs: AttrVec) -> PResult<'a, P> {
// `!`, as an operator, is prefix, so we know this isn't that.
let (hi, kind) = if self.eat(&token::Not) {
// MACRO INVOCATION expression
- let mac = Mac {
+ let mac = MacCall {
path,
args: self.parse_mac_args()?,
prior_type_ascription: self.last_type_ascription,
};
- (self.prev_token.span, ExprKind::Mac(mac))
+ (self.prev_token.span, ExprKind::MacCall(mac))
} else if self.check(&token::OpenDelim(token::Brace)) {
if let Some(expr) = self.maybe_parse_struct_expr(lo, &path, &attrs) {
return expr;
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs
index 3932bbd7564c..ba9fdb7da2ac 100644
--- a/src/librustc_parse/parser/item.rs
+++ b/src/librustc_parse/parser/item.rs
@@ -4,16 +4,12 @@
use crate::maybe_whole;
-use rustc_ast::ast::{self, AttrStyle, AttrVec, Attribute, Ident, DUMMY_NODE_ID};
+use rustc_ast::ast::{self, Async, AttrStyle, AttrVec, Attribute, Ident, DUMMY_NODE_ID};
use rustc_ast::ast::{AssocItem, AssocItemKind, ForeignItemKind, Item, ItemKind};
-use rustc_ast::ast::{
- Async, Const, Defaultness, IsAuto, PathSegment, Unsafe, UseTree, UseTreeKind,
-};
-use rustc_ast::ast::{
- BindingMode, Block, FnDecl, FnSig, Mac, MacArgs, MacDelimiter, Param, SelfKind,
-};
+use rustc_ast::ast::{BindingMode, Block, FnDecl, FnSig, MacArgs, MacCall, MacDelimiter, Param};
+use rustc_ast::ast::{Const, Defaultness, IsAuto, PathSegment, Unsafe, UseTree, UseTreeKind};
use rustc_ast::ast::{EnumDef, Generics, StructField, TraitRef, Ty, TyKind, Variant, VariantData};
-use rustc_ast::ast::{FnHeader, ForeignItem, Mutability, Visibility, VisibilityKind};
+use rustc_ast::ast::{FnHeader, ForeignItem, Mutability, SelfKind, Visibility, VisibilityKind};
use rustc_ast::ptr::P;
use rustc_ast::token;
use rustc_ast::tokenstream::{DelimSpan, TokenStream, TokenTree};
@@ -220,7 +216,7 @@ fn parse_item_kind(
return Ok(None);
} else if macros_allowed && self.check_path() {
// MACRO INVOCATION ITEM
- (Ident::invalid(), ItemKind::Mac(self.parse_item_macro(vis)?))
+ (Ident::invalid(), ItemKind::MacCall(self.parse_item_macro(vis)?))
} else {
return Ok(None);
};
@@ -339,13 +335,13 @@ fn recover_missing_kw_before_item(&mut self) -> PResult<'a, ()> {
}
/// Parses an item macro, e.g., `item!();`.
- fn parse_item_macro(&mut self, vis: &Visibility) -> PResult<'a, Mac> {
+ fn parse_item_macro(&mut self, vis: &Visibility) -> PResult<'a, MacCall> {
let path = self.parse_path(PathStyle::Mod)?; // `foo::bar`
self.expect(&token::Not)?; // `!`
let args = self.parse_mac_args()?; // `( .. )` or `[ .. ]` (followed by `;`), or `{ .. }`.
self.eat_semi_for_macro_if_needed(&args);
self.complain_if_pub_macro(vis, false);
- Ok(Mac { path, args, prior_type_ascription: self.last_type_ascription })
+ Ok(MacCall { path, args, prior_type_ascription: self.last_type_ascription })
}
/// Recover if we parsed attributes and expected an item but there was none.
diff --git a/src/librustc_parse/parser/pat.rs b/src/librustc_parse/parser/pat.rs
index 5f2b3b03488b..4585941943b7 100644
--- a/src/librustc_parse/parser/pat.rs
+++ b/src/librustc_parse/parser/pat.rs
@@ -1,9 +1,7 @@
use super::{Parser, PathStyle};
use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};
-use rustc_ast::ast::{
- self, AttrVec, Attribute, FieldPat, Mac, Pat, PatKind, RangeEnd, RangeSyntax,
-};
-use rustc_ast::ast::{BindingMode, Expr, ExprKind, Ident, Mutability, Path, QSelf};
+use rustc_ast::ast::{self, AttrVec, Attribute, FieldPat, MacCall, Pat, PatKind, RangeEnd};
+use rustc_ast::ast::{BindingMode, Expr, ExprKind, Ident, Mutability, Path, QSelf, RangeSyntax};
use rustc_ast::mut_visit::{noop_visit_mac, noop_visit_pat, MutVisitor};
use rustc_ast::ptr::P;
use rustc_ast::token;
@@ -540,7 +538,7 @@ fn recover_mut_ref_ident(&mut self, lo: Span) -> PResult<'a, PatKind> {
fn make_all_value_bindings_mutable(pat: &mut P) -> bool {
struct AddMut(bool);
impl MutVisitor for AddMut {
- fn visit_mac(&mut self, mac: &mut Mac) {
+ fn visit_mac(&mut self, mac: &mut MacCall) {
noop_visit_mac(mac, self);
}
@@ -597,8 +595,8 @@ fn recover_additional_muts(&mut self) {
fn parse_pat_mac_invoc(&mut self, path: Path) -> PResult<'a, PatKind> {
self.bump();
let args = self.parse_mac_args()?;
- let mac = Mac { path, args, prior_type_ascription: self.last_type_ascription };
- Ok(PatKind::Mac(mac))
+ let mac = MacCall { path, args, prior_type_ascription: self.last_type_ascription };
+ Ok(PatKind::MacCall(mac))
}
fn fatal_unexpected_non_pat(
diff --git a/src/librustc_parse/parser/stmt.rs b/src/librustc_parse/parser/stmt.rs
index 489549a57505..4359823be089 100644
--- a/src/librustc_parse/parser/stmt.rs
+++ b/src/librustc_parse/parser/stmt.rs
@@ -8,7 +8,7 @@
use crate::DirectoryOwnership;
use rustc_ast::ast;
-use rustc_ast::ast::{AttrStyle, AttrVec, Attribute, Mac, MacStmtStyle};
+use rustc_ast::ast::{AttrStyle, AttrVec, Attribute, MacCall, MacStmtStyle};
use rustc_ast::ast::{Block, BlockCheckMode, Expr, ExprKind, Local, Stmt, StmtKind, DUMMY_NODE_ID};
use rustc_ast::ptr::P;
use rustc_ast::token::{self, TokenKind};
@@ -110,14 +110,14 @@ fn parse_stmt_mac(&mut self, lo: Span, attrs: AttrVec, path: ast::Path) -> PResu
let style =
if delim == token::Brace { MacStmtStyle::Braces } else { MacStmtStyle::NoBraces };
- let mac = Mac { path, args, prior_type_ascription: self.last_type_ascription };
+ let mac = MacCall { path, args, prior_type_ascription: self.last_type_ascription };
let kind = if delim == token::Brace || self.token == token::Semi || self.token == token::Eof
{
- StmtKind::Mac(P((mac, style, attrs)))
+ StmtKind::MacCall(P((mac, style, attrs)))
} else {
// Since none of the above applied, this is an expression statement macro.
- let e = self.mk_expr(lo.to(hi), ExprKind::Mac(mac), AttrVec::new());
+ let e = self.mk_expr(lo.to(hi), ExprKind::MacCall(mac), AttrVec::new());
let e = self.maybe_recover_from_bad_qpath(e, true)?;
let e = self.parse_dot_or_call_expr_with(e, lo, attrs)?;
let e = self.parse_assoc_expr_with(0, LhsExpr::AlreadyParsed(e))?;
diff --git a/src/librustc_parse/parser/ty.rs b/src/librustc_parse/parser/ty.rs
index 3dd415bf3728..c21ac8d04f19 100644
--- a/src/librustc_parse/parser/ty.rs
+++ b/src/librustc_parse/parser/ty.rs
@@ -3,10 +3,8 @@
use crate::{maybe_recover_from_interpolated_ty_qpath, maybe_whole};
use rustc_ast::ast::{self, BareFnTy, FnRetTy, GenericParam, Lifetime, MutTy, Ty, TyKind};
-use rustc_ast::ast::{
- GenericBound, GenericBounds, PolyTraitRef, TraitBoundModifier, TraitObjectSyntax,
-};
-use rustc_ast::ast::{Mac, Mutability};
+use rustc_ast::ast::{GenericBound, GenericBounds, MacCall, Mutability};
+use rustc_ast::ast::{PolyTraitRef, TraitBoundModifier, TraitObjectSyntax};
use rustc_ast::ptr::P;
use rustc_ast::token::{self, Token, TokenKind};
use rustc_errors::{pluralize, struct_span_err, Applicability, PResult};
@@ -355,7 +353,7 @@ fn parse_path_start_ty(&mut self, lo: Span, allow_plus: AllowPlus) -> PResult<'a
let path = self.parse_path(PathStyle::Type)?;
if self.eat(&token::Not) {
// Macro invocation in type position
- Ok(TyKind::Mac(Mac {
+ Ok(TyKind::MacCall(MacCall {
path,
args: self.parse_mac_args()?,
prior_type_ascription: self.last_type_ascription,
diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs
index c819809041f2..65b3b7efdc0f 100644
--- a/src/librustc_passes/hir_stats.rs
+++ b/src/librustc_passes/hir_stats.rs
@@ -336,8 +336,8 @@ fn visit_lifetime(&mut self, lifetime: &'v ast::Lifetime) {
ast_visit::walk_lifetime(self, lifetime)
}
- fn visit_mac(&mut self, mac: &'v ast::Mac) {
- self.record("Mac", Id::None, mac);
+ fn visit_mac(&mut self, mac: &'v ast::MacCall) {
+ self.record("MacCall", Id::None, mac);
}
fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v ast::PathSegment) {
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index ec5a8c4a0b89..bac2cb54f60b 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -302,7 +302,7 @@ fn insert_field_names(&mut self, def_id: DefId, field_names: Vec>)
fn block_needs_anonymous_module(&mut self, block: &Block) -> bool {
// If any statements are items, we need to create an anonymous module
block.stmts.iter().any(|statement| match statement.kind {
- StmtKind::Item(_) | StmtKind::Mac(_) => true,
+ StmtKind::Item(_) | StmtKind::MacCall(_) => true,
_ => false,
})
}
@@ -803,7 +803,7 @@ fn build_reduced_graph_for_item(&mut self, item: &'b Item) {
// These items do not add names to modules.
ItemKind::Impl { .. } | ItemKind::ForeignMod(..) | ItemKind::GlobalAsm(..) => {}
- ItemKind::MacroDef(..) | ItemKind::Mac(_) => unreachable!(),
+ ItemKind::MacroDef(..) | ItemKind::MacCall(_) => unreachable!(),
}
}
@@ -819,7 +819,7 @@ fn build_reduced_graph_for_foreign_item(&mut self, item: &ForeignItem) {
ForeignItemKind::TyAlias(..) => {
(Res::Def(DefKind::ForeignTy, self.r.definitions.local_def_id(item.id)), TypeNS)
}
- ForeignItemKind::Macro(_) => unreachable!(),
+ ForeignItemKind::MacCall(_) => unreachable!(),
};
let parent = self.parent_scope.module;
let expansion = self.parent_scope.expansion;
@@ -1167,9 +1167,9 @@ fn $visit(&mut self, node: &'b $ty) {
}
impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
- method!(visit_expr: ast::Expr, ast::ExprKind::Mac, walk_expr);
- method!(visit_pat: ast::Pat, ast::PatKind::Mac, walk_pat);
- method!(visit_ty: ast::Ty, ast::TyKind::Mac, walk_ty);
+ method!(visit_expr: ast::Expr, ast::ExprKind::MacCall, walk_expr);
+ method!(visit_pat: ast::Pat, ast::PatKind::MacCall, walk_pat);
+ method!(visit_ty: ast::Ty, ast::TyKind::MacCall, walk_ty);
fn visit_item(&mut self, item: &'b Item) {
let macro_use = match item.kind {
@@ -1177,7 +1177,7 @@ fn visit_item(&mut self, item: &'b Item) {
self.parent_scope.legacy = self.define_macro(item);
return;
}
- ItemKind::Mac(..) => {
+ ItemKind::MacCall(..) => {
self.parent_scope.legacy = self.visit_invoc(item.id);
return;
}
@@ -1195,7 +1195,7 @@ fn visit_item(&mut self, item: &'b Item) {
}
fn visit_stmt(&mut self, stmt: &'b ast::Stmt) {
- if let ast::StmtKind::Mac(..) = stmt.kind {
+ if let ast::StmtKind::MacCall(..) = stmt.kind {
self.parent_scope.legacy = self.visit_invoc(stmt.id);
} else {
visit::walk_stmt(self, stmt);
@@ -1203,7 +1203,7 @@ fn visit_stmt(&mut self, stmt: &'b ast::Stmt) {
}
fn visit_foreign_item(&mut self, foreign_item: &'b ForeignItem) {
- if let ForeignItemKind::Macro(_) = foreign_item.kind {
+ if let ForeignItemKind::MacCall(_) = foreign_item.kind {
self.visit_invoc(foreign_item.id);
return;
}
@@ -1224,7 +1224,7 @@ fn visit_block(&mut self, block: &'b Block) {
fn visit_assoc_item(&mut self, item: &'b AssocItem, ctxt: AssocCtxt) {
let parent = self.parent_scope.module;
- if let AssocItemKind::Macro(_) = item.kind {
+ if let AssocItemKind::MacCall(_) = item.kind {
self.visit_invoc(item.id);
return;
}
@@ -1246,7 +1246,7 @@ fn visit_assoc_item(&mut self, item: &'b AssocItem, ctxt: AssocCtxt) {
(Res::Def(DefKind::Method, item_def_id), ValueNS)
}
AssocItemKind::TyAlias(..) => (Res::Def(DefKind::AssocTy, item_def_id), TypeNS),
- AssocItemKind::Macro(_) => bug!(), // handled above
+ AssocItemKind::MacCall(_) => bug!(), // handled above
};
let vis = ty::Visibility::Public;
@@ -1259,7 +1259,7 @@ fn visit_assoc_item(&mut self, item: &'b AssocItem, ctxt: AssocCtxt) {
fn visit_token(&mut self, t: Token) {
if let token::Interpolated(nt) = t.kind {
if let token::NtExpr(ref expr) = *nt {
- if let ast::ExprKind::Mac(..) = expr.kind {
+ if let ast::ExprKind::MacCall(..) = expr.kind {
self.visit_invoc(expr.id);
}
}
diff --git a/src/librustc_resolve/def_collector.rs b/src/librustc_resolve/def_collector.rs
index 0d276e686145..c55090d7e931 100644
--- a/src/librustc_resolve/def_collector.rs
+++ b/src/librustc_resolve/def_collector.rs
@@ -132,7 +132,7 @@ fn visit_item(&mut self, i: &'a Item) {
DefPathData::ValueNs(i.ident.name)
}
ItemKind::MacroDef(..) => DefPathData::MacroNs(i.ident.name),
- ItemKind::Mac(..) => return self.visit_macro_invoc(i.id),
+ ItemKind::MacCall(..) => return self.visit_macro_invoc(i.id),
ItemKind::GlobalAsm(..) => DefPathData::Misc,
ItemKind::Use(..) => {
return visit::walk_item(self, i);
@@ -160,7 +160,7 @@ fn visit_use_tree(&mut self, use_tree: &'a UseTree, id: NodeId, _nested: bool) {
}
fn visit_foreign_item(&mut self, foreign_item: &'a ForeignItem) {
- if let ForeignItemKind::Macro(_) = foreign_item.kind {
+ if let ForeignItemKind::MacCall(_) = foreign_item.kind {
return self.visit_macro_invoc(foreign_item.id);
}
@@ -230,7 +230,7 @@ fn visit_assoc_item(&mut self, i: &'a AssocItem, ctxt: visit::AssocCtxt) {
}
AssocItemKind::Fn(..) | AssocItemKind::Const(..) => DefPathData::ValueNs(i.ident.name),
AssocItemKind::TyAlias(..) => DefPathData::TypeNs(i.ident.name),
- AssocItemKind::Macro(..) => return self.visit_macro_invoc(i.id),
+ AssocItemKind::MacCall(..) => return self.visit_macro_invoc(i.id),
};
let def = self.create_def(i.id, def_data, i.span);
@@ -239,7 +239,7 @@ fn visit_assoc_item(&mut self, i: &'a AssocItem, ctxt: visit::AssocCtxt) {
fn visit_pat(&mut self, pat: &'a Pat) {
match pat.kind {
- PatKind::Mac(..) => return self.visit_macro_invoc(pat.id),
+ PatKind::MacCall(..) => return self.visit_macro_invoc(pat.id),
_ => visit::walk_pat(self, pat),
}
}
@@ -251,7 +251,7 @@ fn visit_anon_const(&mut self, constant: &'a AnonConst) {
fn visit_expr(&mut self, expr: &'a Expr) {
let parent_def = match expr.kind {
- ExprKind::Mac(..) => return self.visit_macro_invoc(expr.id),
+ ExprKind::MacCall(..) => return self.visit_macro_invoc(expr.id),
ExprKind::Closure(_, asyncness, ..) => {
// Async closures desugar to closures inside of closures, so
// we must create two defs.
@@ -274,7 +274,7 @@ fn visit_expr(&mut self, expr: &'a Expr) {
fn visit_ty(&mut self, ty: &'a Ty) {
match ty.kind {
- TyKind::Mac(..) => return self.visit_macro_invoc(ty.id),
+ TyKind::MacCall(..) => return self.visit_macro_invoc(ty.id),
TyKind::ImplTrait(node_id, _) => {
self.create_def(node_id, DefPathData::ImplTrait, ty.span);
}
@@ -285,7 +285,7 @@ fn visit_ty(&mut self, ty: &'a Ty) {
fn visit_stmt(&mut self, stmt: &'a Stmt) {
match stmt.kind {
- StmtKind::Mac(..) => self.visit_macro_invoc(stmt.id),
+ StmtKind::MacCall(..) => self.visit_macro_invoc(stmt.id),
_ => visit::walk_stmt(self, stmt),
}
}
@@ -293,7 +293,7 @@ fn visit_stmt(&mut self, stmt: &'a Stmt) {
fn visit_token(&mut self, t: Token) {
if let token::Interpolated(nt) = t.kind {
if let token::NtExpr(ref expr) = *nt {
- if let ExprKind::Mac(..) = expr.kind {
+ if let ExprKind::MacCall(..) = expr.kind {
self.visit_macro_invoc(expr.id);
}
}
diff --git a/src/librustc_resolve/late.rs b/src/librustc_resolve/late.rs
index 97d60e1a23d8..fac5acc6f22b 100644
--- a/src/librustc_resolve/late.rs
+++ b/src/librustc_resolve/late.rs
@@ -449,7 +449,7 @@ fn visit_foreign_item(&mut self, foreign_item: &'ast ForeignItem) {
visit::walk_foreign_item(this, foreign_item);
});
}
- ForeignItemKind::Macro(..) => {
+ ForeignItemKind::MacCall(..) => {
visit::walk_foreign_item(self, foreign_item);
}
}
@@ -852,7 +852,7 @@ fn resolve_item(&mut self, item: &'ast Item) {
AssocItemKind::TyAlias(_, generics, _, _) => {
walk_assoc_item(this, generics, item);
}
- AssocItemKind::Macro(_) => {
+ AssocItemKind::MacCall(_) => {
panic!("unexpanded macro in resolve!")
}
};
@@ -897,7 +897,7 @@ fn resolve_item(&mut self, item: &'ast Item) {
// do nothing, these are just around to be encoded
}
- ItemKind::Mac(_) => panic!("unexpanded macro in resolve!"),
+ ItemKind::MacCall(_) => panic!("unexpanded macro in resolve!"),
}
}
@@ -1174,7 +1174,7 @@ fn resolve_implementation(
},
);
}
- AssocItemKind::Macro(_) => {
+ AssocItemKind::MacCall(_) => {
panic!("unexpanded macro in resolve!")
}
}
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 72c962749c8b..cf4a9e947be9 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -1067,7 +1067,7 @@ fn process_trait_item(&mut self, trait_item: &'l ast::AssocItem, trait_id: DefId
self.visit_ty(default_ty)
}
}
- ast::AssocItemKind::Macro(_) => {}
+ ast::AssocItemKind::MacCall(_) => {}
}
}
@@ -1103,7 +1103,7 @@ fn process_impl_item(&mut self, impl_item: &'l ast::AssocItem, impl_id: DefId) {
// trait.
self.visit_ty(ty)
}
- ast::AssocItemKind::Macro(_) => {}
+ ast::AssocItemKind::MacCall(_) => {}
}
}
@@ -1345,7 +1345,7 @@ fn visit_item(&mut self, item: &'l ast::Item) {
walk_list!(self, visit_ty, ty);
self.process_generic_params(ty_params, &qualname, item.id);
}
- Mac(_) => (),
+ MacCall(_) => (),
_ => visit::walk_item(self, item),
}
}
@@ -1549,7 +1549,7 @@ fn visit_foreign_item(&mut self, item: &'l ast::ForeignItem) {
self.dumper.dump_def(&access, var_data);
}
}
- ast::ForeignItemKind::Macro(..) => {}
+ ast::ForeignItemKind::MacCall(..) => {}
}
}
}
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index 88bfe7661e20..74a918b572d6 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -174,7 +174,7 @@ pub fn get_extern_item_data(&self, item: &ast::ForeignItem) -> Option {
}
// FIXME(plietar): needs a new DefKind in rls-data
ast::ForeignItemKind::TyAlias(..) => None,
- ast::ForeignItemKind::Macro(..) => None,
+ ast::ForeignItemKind::MacCall(..) => None,
}
}
diff --git a/src/librustc_save_analysis/sig.rs b/src/librustc_save_analysis/sig.rs
index 2005366f8398..d9c8594cdbf5 100644
--- a/src/librustc_save_analysis/sig.rs
+++ b/src/librustc_save_analysis/sig.rs
@@ -308,7 +308,7 @@ fn make(&self, offset: usize, _parent_id: Option, scx: &SaveContext<'_,
| ast::TyKind::Infer
| ast::TyKind::Err
| ast::TyKind::ImplicitSelf
- | ast::TyKind::Mac(_) => Err("Ty"),
+ | ast::TyKind::MacCall(_) => Err("Ty"),
}
}
}
@@ -544,7 +544,7 @@ fn make(&self, offset: usize, _parent_id: Option, scx: &SaveContext<'_,
ast::ItemKind::ExternCrate(_) => Err("extern crate"),
// FIXME should implement this (e.g., pub use).
ast::ItemKind::Use(_) => Err("import"),
- ast::ItemKind::Mac(..) | ast::ItemKind::MacroDef(_) => Err("Macro"),
+ ast::ItemKind::MacCall(..) | ast::ItemKind::MacroDef(_) => Err("Macro"),
}
}
}
@@ -795,7 +795,7 @@ fn make(&self, offset: usize, _parent_id: Option, scx: &SaveContext<'_,
Ok(Signature { text, defs, refs: vec![] })
}
- ast::ForeignItemKind::Macro(..) => Err("macro"),
+ ast::ForeignItemKind::MacCall(..) => Err("macro"),
}
}
}
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index b63dbbf80d86..9ad0f85ec941 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -449,7 +449,7 @@ pub fn make_test(
}
if !found_macro {
- if let ast::ItemKind::Mac(..) = item.kind {
+ if let ast::ItemKind::MacCall(..) = item.kind {
found_macro = true;
}
}