]>
git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/auxiliary/proc_macro_derive.rs
1 // compile-flags: --emit=link
4 #![crate_type = "proc-macro"]
5 #![feature(repr128, proc_macro_quote)]
6 #![allow(incomplete_features)]
7 #![allow(clippy::field_reassign_with_default)]
8 #![allow(clippy::eq_op)]
10 extern crate proc_macro
;
12 use proc_macro
::{quote, TokenStream}
;
14 #[proc_macro_derive(DeriveSomething)]
15 pub fn derive(_
: TokenStream
) -> TokenStream
{
16 // Shound not trigger `used_underscore_binding`
17 let _inside_derive
= 1;
18 assert_eq
!(_inside_derive
, _inside_derive
);
21 // Should not trigger `useless_attribute`
23 extern crate rustc_middle
;
28 #[proc_macro_derive(FieldReassignWithDefault)]
29 pub fn derive_foo(_input
: TokenStream
) -> TokenStream
{
36 #[automatically_derived]
38 let mut a
: A
= Default
::default();
45 #[proc_macro_derive(StructAUseSelf)]
46 pub fn derive_use_self(_input
: TokenStream
) -> proc_macro
::TokenStream
{