rust/tests/ui/auxiliary/proc_macro_derive.rs

26 lines
616 B
Rust
Raw Normal View History

// compile-flags: --emit=link
// no-prefer-dynamic
#![crate_type = "proc-macro"]
#![feature(repr128, proc_macro_quote)]
2020-10-22 07:23:14 -05:00
#![allow(incomplete_features)]
#![allow(clippy::eq_op)]
extern crate proc_macro;
use proc_macro::{quote, TokenStream};
#[proc_macro_derive(DeriveSomething)]
pub fn derive(_: TokenStream) -> TokenStream {
// Shound not trigger `used_underscore_binding`
let _inside_derive = 1;
assert_eq!(_inside_derive, _inside_derive);
let output = quote! {
// Should not trigger `useless_attribute`
#[allow(dead_code)]
extern crate rustc_middle;
};
output
}