Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecated proc_macro doesn't trigger warning on build library #65666

Merged
merged 3 commits into from
Oct 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/libsyntax_ext/proc_macro_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,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));
XiangQingW marked this conversation as resolved.
Show resolved Hide resolved

i
});

Expand Down
15 changes: 15 additions & 0 deletions src/test/ui/proc-macro/proc-macro-deprecated-attr.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// build-pass
petrochenkov marked this conversation as resolved.
Show resolved Hide resolved

XiangQingW marked this conversation as resolved.
Show resolved Hide resolved
#![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()
petrochenkov marked this conversation as resolved.
Show resolved Hide resolved
}