conditional compilation
Choosing which code to compile for each target, with #[cfg], cfg! and cfg_select!.
#[cfg(pred)] and cfg_select! remove code whose predicate is false before type checking; cfg!(pred) is a bool expression, so every branch must compile on every target.
Examples
#[cfg(unix)] fn home()and#[cfg(windows)] fn home()give one version per target;if cfg!(windows) { .. }keeps both branches, so both must compile everywhere.
See also