2020-08-02 15:20:00 +00:00
|
|
|
// Test proc-macro crate can be built without additional RUSTFLAGS
|
2020-03-03 08:17:15 +00:00
|
|
|
// on musl target
|
2020-03-08 13:49:52 +00:00
|
|
|
// override -Ctarget-feature=-crt-static from compiletest
|
2021-08-28 06:40:17 +00:00
|
|
|
// compile-flags: --crate-type proc-macro -Ctarget-feature=
|
2020-03-17 01:57:11 +00:00
|
|
|
// ignore-wasm32
|
2020-05-06 01:12:50 +00:00
|
|
|
// ignore-sgx no support for proc-macro crate type
|
2020-03-03 11:17:24 +00:00
|
|
|
// build-pass
|
2023-02-01 21:35:36 +00:00
|
|
|
// force-host
|
|
|
|
// no-prefer-dynamic
|
2023-05-17 08:41:41 +00:00
|
|
|
// needs-dynamic-linking
|
2023-02-01 21:35:36 +00:00
|
|
|
|
2020-03-03 08:17:15 +00:00
|
|
|
#![crate_type = "proc-macro"]
|
|
|
|
|
2021-08-28 06:40:17 +00: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-18 02:13:37 +00:00
|
|
|
// command line flag. This is because the list of `cfg` symbols is generated
|
2021-08-28 06:40:17 +00: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 08:17:15 +00:00
|
|
|
extern crate proc_macro;
|
|
|
|
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
|
|
|
|
#[proc_macro_derive(Foo)]
|
|
|
|
pub fn derive_foo(input: TokenStream) -> TokenStream {
|
|
|
|
input
|
|
|
|
}
|