Skip to content
Snippets Groups Projects
Commit ea95627d authored by Jason Volk's avatar Jason Volk Committed by Jason Volk
Browse files

hoist rustc flag string array to global const


Signed-off-by: default avatarJason Volk <jason@zemos.net>
parent c3e75154
No related branches found
No related tags found
No related merge requests found
...@@ -9,11 +9,13 @@ pub(super) fn flags_capture(args: TokenStream) -> TokenStream { ...@@ -9,11 +9,13 @@ pub(super) fn flags_capture(args: TokenStream) -> TokenStream {
}; };
let flag = std::env::args().collect::<Vec<_>>(); let flag = std::env::args().collect::<Vec<_>>();
let flag_len = flag.len();
let ret = quote! { let ret = quote! {
pub static RUSTC_FLAGS: [&str; #flag_len] = [#( #flag ),*];
#[conduit_core::ctor] #[conduit_core::ctor]
fn _set_rustc_flags() { fn _set_rustc_flags() {
let flags = &[#( #flag ),*]; conduit_core::info::rustc::FLAGS.lock().expect("locked").insert(#crate_name, &RUSTC_FLAGS);
conduit_core::info::rustc::FLAGS.lock().expect("locked").insert(#crate_name, flags);
} }
// static strings have to be yanked on module unload // static strings have to be yanked on module unload
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment