]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/crt-static.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / ui / proc-macro / crt-static.rs
1 // Test proc-macro crate can be built without additional RUSTFLAGS
2 // on musl target
3 // override -Ctarget-feature=-crt-static from compiletest
4 // compile-flags: --crate-type proc-macro -Ctarget-feature=
5 // ignore-wasm32
6 // ignore-sgx no support for proc-macro crate type
7 // build-pass
8 // force-host
9 // no-prefer-dynamic
10
11 #![crate_type = "proc-macro"]
12
13 // FIXME: This don't work when crate-type is specified by attribute
14 // `#![crate_type = "proc-macro"]`, not by `--crate-type=proc-macro`
15 // command line flag. This is because the list of `cfg` symbols is generated
16 // before attributes are parsed. See rustc_interface::util::add_configuration
17 #[cfg(target_feature = "crt-static")]
18 compile_error!("crt-static is enabled");
19
20 extern crate proc_macro;
21
22 use proc_macro::TokenStream;
23
24 #[proc_macro_derive(Foo)]
25 pub fn derive_foo(input: TokenStream) -> TokenStream {
26     input
27 }