Skip to content

Commit fb602c7

Browse files
authored
Rollup merge of #65666 - XiangQingW:proc_macro, r=petrochenkov
Deprecated proc_macro doesn't trigger warning on build library Fix #65189
2 parents 50e8c41 + b133156 commit fb602c7

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/libsyntax_ext/proc_macro_harness.rs

+11
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
337337
// use proc_macro::bridge::client::ProcMacro;
338338
//
339339
// #[rustc_proc_macro_decls]
340+
// #[allow(deprecated)]
340341
// static DECLS: &[ProcMacro] = &[
341342
// ProcMacro::custom_derive($name_trait1, &[], ::$name1);
342343
// ProcMacro::custom_derive($name_trait2, &["attribute_name"], ::$name2);
@@ -416,6 +417,16 @@ fn mk_decls(
416417
).map(|mut i| {
417418
let attr = cx.meta_word(span, sym::rustc_proc_macro_decls);
418419
i.attrs.push(cx.attribute(attr));
420+
421+
let deprecated_attr = attr::mk_nested_word_item(
422+
Ident::new(sym::deprecated, span)
423+
);
424+
let allow_deprecated_attr = attr::mk_list_item(
425+
Ident::new(sym::allow, span),
426+
vec![deprecated_attr]
427+
);
428+
i.attrs.push(cx.attribute(allow_deprecated_attr));
429+
419430
i
420431
});
421432

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// check-pass
2+
// force-host
3+
// no-prefer-dynamic
4+
5+
#![deny(deprecated)]
6+
7+
#![crate_type = "proc-macro"]
8+
9+
extern crate proc_macro;
10+
use proc_macro::*;
11+
12+
#[proc_macro]
13+
#[deprecated(since = "1.0.0", note = "test")]
14+
pub fn test_compile_without_warning_with_deprecated(_: TokenStream) -> TokenStream {
15+
TokenStream::new()
16+
}

0 commit comments

Comments
 (0)