resolve: Simplify built-in macro table
This commit is contained in:
parent
34628e5b53
commit
f9b5859173
5 changed files with 15 additions and 19 deletions
|
@ -14,10 +14,9 @@ extern crate proc_macro;
|
|||
|
||||
use crate::deriving::*;
|
||||
|
||||
use rustc_expand::base::{MacroExpanderFn, ResolverExpand, SyntaxExtension, SyntaxExtensionKind};
|
||||
use rustc_expand::base::{MacroExpanderFn, ResolverExpand, SyntaxExtensionKind};
|
||||
use rustc_expand::proc_macro::BangProcMacro;
|
||||
use rustc_span::edition::Edition;
|
||||
use rustc_span::symbol::{sym, Ident};
|
||||
use rustc_span::symbol::sym;
|
||||
|
||||
mod asm;
|
||||
mod assert;
|
||||
|
@ -44,13 +43,8 @@ pub mod proc_macro_harness;
|
|||
pub mod standard_library_imports;
|
||||
pub mod test_harness;
|
||||
|
||||
pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand, edition: Edition) {
|
||||
let mut register = |name, kind| {
|
||||
resolver.register_builtin_macro(
|
||||
Ident::with_dummy_span(name),
|
||||
SyntaxExtension::default(kind, edition),
|
||||
)
|
||||
};
|
||||
pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) {
|
||||
let mut register = |name, kind| resolver.register_builtin_macro(name, kind);
|
||||
macro register_bang($($name:ident: $f:expr,)*) {
|
||||
$(register(sym::$name, SyntaxExtensionKind::LegacyBang(Box::new($f as MacroExpanderFn)));)*
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue