From 0817fc6c6cd880c51318d476de9ecb43327e12b1 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 22 Jun 2019 02:44:45 +0300 Subject: Support deprecation checking for macros --- src/libsyntax/ext/base.rs | 7 +++++-- src/libsyntax/ext/tt/macro_rules.rs | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src/libsyntax') 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, + /// The macro's deprecation info. + pub deprecation: Option, /// Names of helper attributes registered by this macro. pub helper_attrs: Vec, /// 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, } -- cgit 1.4.1-3-g733a5