diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-02-02 07:01:15 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2017-02-12 07:20:04 +0000 |
| commit | 2cc61eebb7f1677af2a20f76fb1411ed40f6901b (patch) | |
| tree | 499464b6464aef1624f01cf6c98c686ddbfa04f2 /src/libsyntax/ext/base.rs | |
| parent | 4b413bc393d8cde89ce0d687c3ef4ea50374af2c (diff) | |
| download | rust-2cc61eebb7f1677af2a20f76fb1411ed40f6901b.tar.gz rust-2cc61eebb7f1677af2a20f76fb1411ed40f6901b.zip | |
Allow using inert attributes from `proc_macro_derive`s with `#![feature(proc_macro)]`.
Diffstat (limited to 'src/libsyntax/ext/base.rs')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 9a717b86d09..b5afd0c453a 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -514,7 +514,7 @@ pub enum SyntaxExtension { /// The input is the annotated item. /// Allows generating code to implement a Trait for a given struct /// or enum item. - ProcMacroDerive(Box<MultiItemModifier>), + ProcMacroDerive(Box<MultiItemModifier>, Vec<Symbol> /* inert attribute names */), /// An attribute-like procedural macro that derives a builtin trait. BuiltinDerive(BuiltinDeriveFn), @@ -528,15 +528,15 @@ pub trait Resolver { fn eliminate_crate_var(&mut self, item: P<ast::Item>) -> P<ast::Item>; fn is_whitelisted_legacy_custom_derive(&self, name: Name) -> bool; - fn visit_expansion(&mut self, mark: Mark, expansion: &Expansion); + fn visit_expansion(&mut self, mark: Mark, expansion: &Expansion, derives: &[Mark]); fn add_ext(&mut self, ident: ast::Ident, ext: Rc<SyntaxExtension>); fn add_expansions_at_stmt(&mut self, id: ast::NodeId, macros: Vec<Mark>); fn resolve_imports(&mut self); - fn find_attr_invoc(&mut self, attrs: &mut Vec<Attribute>) -> Option<Attribute>; + // Resolves attribute and derive legacy macros from `#![plugin(..)]`. + fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec<Attribute>) -> Option<Attribute>; fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, force: bool) -> Result<Rc<SyntaxExtension>, Determinacy>; - fn resolve_builtin_macro(&mut self, tname: Name) -> Result<Rc<SyntaxExtension>, Determinacy>; fn resolve_derive_macro(&mut self, scope: Mark, path: &ast::Path, force: bool) -> Result<Rc<SyntaxExtension>, Determinacy>; } @@ -555,19 +555,16 @@ impl Resolver for DummyResolver { fn eliminate_crate_var(&mut self, item: P<ast::Item>) -> P<ast::Item> { item } fn is_whitelisted_legacy_custom_derive(&self, _name: Name) -> bool { false } - fn visit_expansion(&mut self, _invoc: Mark, _expansion: &Expansion) {} + fn visit_expansion(&mut self, _invoc: Mark, _expansion: &Expansion, _derives: &[Mark]) {} fn add_ext(&mut self, _ident: ast::Ident, _ext: Rc<SyntaxExtension>) {} fn add_expansions_at_stmt(&mut self, _id: ast::NodeId, _macros: Vec<Mark>) {} fn resolve_imports(&mut self) {} - fn find_attr_invoc(&mut self, _attrs: &mut Vec<Attribute>) -> Option<Attribute> { None } + fn find_legacy_attr_invoc(&mut self, _attrs: &mut Vec<Attribute>) -> Option<Attribute> { None } fn resolve_macro(&mut self, _scope: Mark, _path: &ast::Path, _force: bool) -> Result<Rc<SyntaxExtension>, Determinacy> { Err(Determinacy::Determined) } - fn resolve_builtin_macro(&mut self, _tname: Name) -> Result<Rc<SyntaxExtension>, Determinacy> { - Err(Determinacy::Determined) - } fn resolve_derive_macro(&mut self, _scope: Mark, _path: &ast::Path, _force: bool) -> Result<Rc<SyntaxExtension>, Determinacy> { Err(Determinacy::Determined) |
