mirror of https://github.com/rust-lang/rust
27 lines
556 B
Rust
27 lines
556 B
Rust
//@ force-host
|
|
//@ no-prefer-dynamic
|
|
|
|
#![crate_type = "proc-macro"]
|
|
|
|
extern crate proc_macro;
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
fn compile_error() -> TokenStream {
|
|
r#"compile_error!("")"#.parse().unwrap()
|
|
}
|
|
|
|
#[proc_macro_derive(MyTrait)]
|
|
pub fn derive(input: TokenStream) -> TokenStream {
|
|
compile_error()
|
|
}
|
|
#[proc_macro_attribute]
|
|
pub fn attribute_macro(_attr: TokenStream, mut input: TokenStream) -> TokenStream {
|
|
input.extend(compile_error());
|
|
input
|
|
}
|
|
#[proc_macro]
|
|
pub fn fn_macro(_item: TokenStream) -> TokenStream {
|
|
compile_error()
|
|
}
|