Skip to content

Commit aebfe2b

Browse files
Rollup merge of rust-lang#43712 - oli-obk:cfg, r=arielb1
Reexport all SyntaxExtension variants This was previously done very inconsistently and made matches look weird since some variants had the `SyntaxExtension::` prefix while others didn't.
2 parents 96c09f8 + 970c780 commit aebfe2b

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/libsyntax/ext/base.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
pub use self::SyntaxExtension::{MultiDecorator, MultiModifier, NormalTT, IdentTT};
11+
pub use self::SyntaxExtension::*;
1212

1313
use ast::{self, Attribute, Name, PatKind, MetaItem};
1414
use attr::HasAttrs;

src/libsyntax/ext/expand.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
294294
let item = match self.cx.resolver.resolve_macro(
295295
Mark::root(), path, MacroKind::Derive, false) {
296296
Ok(ext) => match *ext {
297-
SyntaxExtension::BuiltinDerive(..) => item_with_markers.clone(),
297+
BuiltinDerive(..) => item_with_markers.clone(),
298298
_ => item.clone(),
299299
},
300300
_ => item.clone(),
@@ -427,7 +427,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
427427
items.push(item);
428428
kind.expect_from_annotatables(items)
429429
}
430-
SyntaxExtension::AttrProcMacro(ref mac) => {
430+
AttrProcMacro(ref mac) => {
431431
let item_tok = TokenTree::Token(DUMMY_SP, Token::interpolated(match item {
432432
Annotatable::Item(item) => token::NtItem(item),
433433
Annotatable::TraitItem(item) => token::NtTraitItem(item.unwrap()),
@@ -436,7 +436,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
436436
let tok_result = mac.expand(self.cx, attr.span, attr.tokens, item_tok);
437437
self.parse_expansion(tok_result, kind, &attr.path, attr.span)
438438
}
439-
SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => {
439+
ProcMacroDerive(..) | BuiltinDerive(..) => {
440440
self.cx.span_err(attr.span, &format!("`{}` is a derive mode", attr.path));
441441
kind.dummy(attr.span)
442442
}
@@ -474,7 +474,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
474474
};
475475

476476
let opt_expanded = match *ext {
477-
SyntaxExtension::DeclMacro(ref expand, def_span) => {
477+
DeclMacro(ref expand, def_span) => {
478478
if let Err(msg) = validate_and_set_expn_info(def_span.map(|(_, s)| s),
479479
false) {
480480
self.cx.span_err(path.span, &msg);
@@ -512,18 +512,18 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
512512
kind.make_from(expander.expand(self.cx, span, ident, input))
513513
}
514514

515-
MultiDecorator(..) | MultiModifier(..) | SyntaxExtension::AttrProcMacro(..) => {
515+
MultiDecorator(..) | MultiModifier(..) | AttrProcMacro(..) => {
516516
self.cx.span_err(path.span,
517517
&format!("`{}` can only be used in attributes", path));
518518
return kind.dummy(span);
519519
}
520520

521-
SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => {
521+
ProcMacroDerive(..) | BuiltinDerive(..) => {
522522
self.cx.span_err(path.span, &format!("`{}` is a derive mode", path));
523523
return kind.dummy(span);
524524
}
525525

526-
SyntaxExtension::ProcMacro(ref expandfun) => {
526+
ProcMacro(ref expandfun) => {
527527
if ident.name != keywords::Invalid.name() {
528528
let msg =
529529
format!("macro {}! expects no ident argument, given '{}'", path, ident);
@@ -582,7 +582,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
582582
};
583583

584584
match *ext {
585-
SyntaxExtension::ProcMacroDerive(ref ext, _) => {
585+
ProcMacroDerive(ref ext, _) => {
586586
invoc.expansion_data.mark.set_expn_info(expn_info);
587587
let span = Span { ctxt: self.cx.backtrace(), ..span };
588588
let dummy = ast::MetaItem { // FIXME(jseyfried) avoid this
@@ -592,7 +592,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
592592
};
593593
kind.expect_from_annotatables(ext.expand(self.cx, span, &dummy, item))
594594
}
595-
SyntaxExtension::BuiltinDerive(func) => {
595+
BuiltinDerive(func) => {
596596
expn_info.callee.allow_internal_unstable = true;
597597
invoc.expansion_data.mark.set_expn_info(expn_info);
598598
let span = Span { ctxt: self.cx.backtrace(), ..span };

0 commit comments

Comments
 (0)