1
Fork 0

syntax: Use MultiItemModifier for built-in derives

This commit is contained in:
Vadim Petrochenkov 2019-06-06 23:21:44 +03:00
parent 5a6ebec018
commit edb925a91f
3 changed files with 42 additions and 29 deletions

View file

@ -1,6 +1,6 @@
pub use SyntaxExtension::*;
use crate::ast::{self, Attribute, Name, PatKind, MetaItem};
use crate::ast::{self, Attribute, Name, PatKind};
use crate::attr::HasAttrs;
use crate::source_map::{SourceMap, Spanned, respan};
use crate::edition::Edition;
@ -519,9 +519,6 @@ impl MacResult for DummyResult {
}
}
pub type BuiltinDeriveFn =
for<'cx> fn(&'cx mut ExtCtxt<'_>, Span, &MetaItem, &Annotatable, &mut dyn FnMut(Annotatable));
/// Represents different kinds of macro invocations that can be resolved.
#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum MacroKind {
@ -607,7 +604,7 @@ pub enum SyntaxExtension {
Vec<Symbol> /* inert attribute names */, Edition),
/// An attribute-like procedural macro that derives a builtin trait.
BuiltinDerive(BuiltinDeriveFn),
BuiltinDerive(Box<dyn MultiItemModifier + sync::Sync + sync::Send>),
/// A declarative macro, e.g., `macro m() {}`.
DeclMacro {