File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ extern crate proc_macro;
2+ use proc_macro:: { TokenStream , TokenTree } ;
3+
4+ #[ proc_macro_derive( Empty2 , attributes( empty_helper) ) ]
5+ pub fn empty_derive2 ( _: TokenStream ) -> TokenStream {
6+ TokenStream :: new ( )
7+ }
Original file line number Diff line number Diff line change 1+ //@ proc-macro: test-macros.rs
2+ //@ proc-macro: extra-empty-derive.rs
3+ //@ check-pass
4+
5+ #[ macro_use( Empty ) ]
6+ extern crate test_macros;
7+ #[ macro_use( Empty2 ) ]
8+ extern crate extra_empty_derive;
9+
10+ // Testing the behavior of derive attributes with helpers that share the same name.
11+ //
12+ // Normally if the first derive below were absent the call to #[empty_helper] before it it
13+ // introduced by its own derive would produce a future incompat error.
14+ //
15+ // With the extra derive also introducing that attribute in advanced the warning gets supressed.
16+ // Demonstrates a lack of identity to helper attributes, the compiler does not track which derive
17+ // introduced a helper, just that a derive introduced the helper.
18+ #[ derive( Empty ) ]
19+ #[ empty_helper]
20+ #[ derive( Empty2 ) ]
21+ struct S ;
22+
23+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments