Rollup merge of #65666 - XiangQingW:proc_macro, r=petrochenkov

Deprecated proc_macro doesn't trigger warning on build library

Fix #65189
This commit is contained in:
Mazdak Farrokhzad 2019-10-25 06:18:08 +02:00 committed by GitHub
commit fb602c7e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 0 deletions

View File

@ -337,6 +337,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
// use proc_macro::bridge::client::ProcMacro;
//
// #[rustc_proc_macro_decls]
// #[allow(deprecated)]
// static DECLS: &[ProcMacro] = &[
// ProcMacro::custom_derive($name_trait1, &[], ::$name1);
// ProcMacro::custom_derive($name_trait2, &["attribute_name"], ::$name2);
@ -416,6 +417,16 @@ fn mk_decls(
).map(|mut i| {
let attr = cx.meta_word(span, sym::rustc_proc_macro_decls);
i.attrs.push(cx.attribute(attr));
let deprecated_attr = attr::mk_nested_word_item(
Ident::new(sym::deprecated, span)
);
let allow_deprecated_attr = attr::mk_list_item(
Ident::new(sym::allow, span),
vec![deprecated_attr]
);
i.attrs.push(cx.attribute(allow_deprecated_attr));
i
});

View File

@ -0,0 +1,16 @@
// check-pass
// force-host
// no-prefer-dynamic
#![deny(deprecated)]
#![crate_type = "proc-macro"]
extern crate proc_macro;
use proc_macro::*;
#[proc_macro]
#[deprecated(since = "1.0.0", note = "test")]
pub fn test_compile_without_warning_with_deprecated(_: TokenStream) -> TokenStream {
TokenStream::new()
}