mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Add test for derive helper compat collisions
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
extern crate proc_macro;
|
||||
use proc_macro::{TokenStream, TokenTree};
|
||||
|
||||
#[proc_macro_derive(Empty2, attributes(empty_helper))]
|
||||
pub fn empty_derive2(_: TokenStream) -> TokenStream {
|
||||
TokenStream::new()
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
//@ proc-macro: test-macros.rs
|
||||
//@ proc-macro: extra-empty-derive.rs
|
||||
//@ build-pass
|
||||
|
||||
#[macro_use(Empty)]
|
||||
extern crate test_macros;
|
||||
#[macro_use(Empty2)]
|
||||
extern crate extra_empty_derive;
|
||||
|
||||
// Testing the behavior of derive attributes with helpers that share the same name.
|
||||
//
|
||||
// Normally if the first derive below were absent the call to #[empty_helper] before it it
|
||||
// introduced by its own derive would produce a future incompat error.
|
||||
//
|
||||
// With the extra derive also introducing that attribute in advanced the warning gets supressed.
|
||||
// Demonstrates a lack of identity to helper attributes, the compiler does not track which derive
|
||||
// introduced a helper, just that a derive introduced the helper.
|
||||
#[derive(Empty)]
|
||||
#[empty_helper]
|
||||
#[derive(Empty2)]
|
||||
struct S;
|
||||
|
||||
fn main() {}
|
||||
Reference in New Issue
Block a user