summaryrefslogtreecommitdiffstats
path: root/tests/ui/proc-macro/auxiliary/derive-union.rs
blob: 05883170c6c48006c771e8e4b327272a9c90f1ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// force-host
// no-prefer-dynamic

#![crate_type = "proc-macro"]

extern crate proc_macro;

use proc_macro::TokenStream;

#[proc_macro_derive(UnionTest)]
pub fn derive(input: TokenStream) -> TokenStream {
    let input = input.to_string();
    assert!(input.contains("#[repr(C)]"));
    assert!(input.contains("union Test {"));
    assert!(input.contains("a : u8,"));
    assert!(input.contains("}"));
    "".parse().unwrap()
}