Detect crate_type in cfg?


#1

Is there a way to use #[cfg] attributes to conditionally compile code depending on what crate_type is passed to rustc? E.g.:

#[cfg(crate_type = "dylib")]
fn used_in_dynamic_libraries() { ... }

#2

Seems not. You can see the active settings with rustc --print cfg.


#3

Ah good tip. Thanks!