diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-06-22 02:44:45 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-07-07 13:04:07 +0300 |
| commit | 0817fc6c6cd880c51318d476de9ecb43327e12b1 (patch) | |
| tree | 49ba7e3b8a4e84caab0cc58015851ead69543502 /src/libsyntax | |
| parent | d9ee97e896125b38dba199c763e5e35c5107a735 (diff) | |
| download | rust-0817fc6c6cd880c51318d476de9ecb43327e12b1.tar.gz rust-0817fc6c6cd880c51318d476de9ecb43327e12b1.zip | |
Support deprecation checking for macros
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 7 | ||||
| -rw-r--r-- | src/libsyntax/ext/tt/macro_rules.rs | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index d5d1c7662b2..15c0b6ca5aa 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -1,5 +1,5 @@ use crate::ast::{self, Attribute, Name, PatKind}; -use crate::attr::{HasAttrs, Stability}; +use crate::attr::{HasAttrs, Stability, Deprecation}; use crate::source_map::{SourceMap, Spanned, respan}; use crate::edition::Edition; use crate::ext::expand::{self, AstFragment, Invocation}; @@ -616,8 +616,10 @@ pub struct SyntaxExtension { pub allow_internal_unsafe: bool, /// Enables the macro helper hack (`ident!(...)` -> `$crate::ident!(...)`) for this macro. pub local_inner_macros: bool, - /// The macro's stability and deprecation info. + /// The macro's stability info. pub stability: Option<Stability>, + /// The macro's deprecation info. + pub deprecation: Option<Deprecation>, /// Names of helper attributes registered by this macro. pub helper_attrs: Vec<Symbol>, /// Edition of the crate in which this macro is defined. @@ -663,6 +665,7 @@ impl SyntaxExtension { allow_internal_unsafe: false, local_inner_macros: false, stability: None, + deprecation: None, helper_attrs: Vec::new(), edition, kind, diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 5b5588a02f2..665c794422d 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -437,6 +437,7 @@ pub fn compile( allow_internal_unsafe: attr::contains_name(&def.attrs, sym::allow_internal_unsafe), local_inner_macros, stability: attr::find_stability(&sess, &def.attrs, def.span), + deprecation: attr::find_deprecation(&sess, &def.attrs, def.span), helper_attrs: Vec::new(), edition, } |
