Deprecated proc_macro doesn't trigger warning on build library
Change-Id: Ib3a396e7334d209fe6c6ef425bbfc7b2ae471378
This commit is contained in:
parent
b7a9c285a5
commit
33910f9d86
2 changed files with 25 additions and 0 deletions
|
@ -416,6 +416,16 @@ fn mk_decls(
|
||||||
).map(|mut i| {
|
).map(|mut i| {
|
||||||
let attr = cx.meta_word(span, sym::rustc_proc_macro_decls);
|
let attr = cx.meta_word(span, sym::rustc_proc_macro_decls);
|
||||||
i.attrs.push(cx.attribute(attr));
|
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
|
i
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
15
src/test/ui/proc-macro/proc-macro-deprecated-attr.rs
Normal file
15
src/test/ui/proc-macro/proc-macro-deprecated-attr.rs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// build-pass
|
||||||
|
|
||||||
|
#![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 {
|
||||||
|
"
|
||||||
|
extern crate proc_macro;
|
||||||
|
fn foo() { }
|
||||||
|
".parse().unwrap()
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue