1 // Test proc-macro crate can be built without additional RUSTFLAGS
3 // override -Ctarget-feature=-crt-static from compiletest
4 // compile-flags: --crate-type proc-macro -Ctarget-feature=
6 // ignore-sgx no support for proc-macro crate type
8 #![crate_type = "proc-macro"]
10 // FIXME: This don't work when crate-type is specified by attribute
11 // `#![crate_type = "proc-macro"]`, not by `--crate-type=proc-macro`
12 // command line flag. This is beacuse the list of `cfg` symbols is generated
13 // before attributes are parsed. See rustc_interface::util::add_configuration
14 #[cfg(target_feature = "crt-static")]
15 compile_error!("crt-static is enabled");
17 extern crate proc_macro;
19 use proc_macro::TokenStream;
21 #[proc_macro_derive(Foo)]
22 pub fn derive_foo(input: TokenStream) -> TokenStream {