rust/tests/ui/proc-macro/crt-static.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
960 B
Rust
Raw Normal View History

2020-08-02 15:20:00 +00:00
// Test proc-macro crate can be built without additional RUSTFLAGS
// on musl target
2020-03-08 13:49:52 +00:00
// override -Ctarget-feature=-crt-static from compiletest
//@ compile-flags: --crate-type proc-macro -Ctarget-feature=
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
//@ force-host
//@ no-prefer-dynamic
2023-05-17 08:41:41 +00:00
//@ needs-dynamic-linking
//@ needs-unwind compiling proc macros with panic=abort causes a warning
#![crate_type = "proc-macro"]
// FIXME: This don't work when crate-type is specified by attribute
// `#![crate_type = "proc-macro"]`, not by `--crate-type=proc-macro`
// command line flag. This is because the list of `cfg` symbols is generated
// before attributes are parsed. See rustc_interface::util::add_configuration
#[cfg(target_feature = "crt-static")]
compile_error!("crt-static is enabled");
extern crate proc_macro;
use proc_macro::TokenStream;
#[proc_macro_derive(Foo)]
pub fn derive_foo(input: TokenStream) -> TokenStream {
input
}