2020-08-02 10:20:00 -05:00
|
|
|
// Test proc-macro crate can be built without additional RUSTFLAGS
|
2020-03-03 02:17:15 -06:00
|
|
|
// on musl target
|
2020-03-08 08:49:52 -05:00
|
|
|
// override -Ctarget-feature=-crt-static from compiletest
|
2021-08-28 01:40:17 -05:00
|
|
|
// compile-flags: --crate-type proc-macro -Ctarget-feature=
|
2020-03-16 20:57:11 -05:00
|
|
|
// ignore-wasm32
|
2020-05-05 20:12:50 -05:00
|
|
|
// ignore-sgx no support for proc-macro crate type
|
2020-03-03 05:17:24 -06:00
|
|
|
// build-pass
|
2023-02-01 15:35:36 -06:00
|
|
|
// force-host
|
|
|
|
// no-prefer-dynamic
|
|
|
|
|
2020-03-03 02:17:15 -06:00
|
|
|
#![crate_type = "proc-macro"]
|
|
|
|
|
2021-08-28 01:40:17 -05:00
|
|
|
// FIXME: This don't work when crate-type is specified by attribute
|
|
|
|
// `#![crate_type = "proc-macro"]`, not by `--crate-type=proc-macro`
|
2022-08-17 21:13:37 -05:00
|
|
|
// command line flag. This is because the list of `cfg` symbols is generated
|
2021-08-28 01:40:17 -05:00
|
|
|
// before attributes are parsed. See rustc_interface::util::add_configuration
|
|
|
|
#[cfg(target_feature = "crt-static")]
|
|
|
|
compile_error!("crt-static is enabled");
|
|
|
|
|
2020-03-03 02:17:15 -06:00
|
|
|
extern crate proc_macro;
|
|
|
|
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
|
|
|
|
#[proc_macro_derive(Foo)]
|
|
|
|
pub fn derive_foo(input: TokenStream) -> TokenStream {
|
|
|
|
input
|
|
|
|
}
|