We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e84b3f commit e028b71Copy full SHA for e028b71
src/lib.rs
@@ -2811,6 +2811,14 @@ impl Build {
2811
cmd
2812
}
2813
2814
+ fn prefer_clang(&self) -> bool {
2815
+ if let Some(env) = self.getenv("CARGO_ENCODED_RUSTFLAGS") {
2816
+ env.to_string_lossy().contains("linker-plugin-lto")
2817
+ } else {
2818
+ false
2819
+ }
2820
2821
+
2822
fn get_base_compiler(&self) -> Result<Tool, Error> {
2823
let out_dir = self.get_out_dir().ok();
2824
let out_dir = out_dir.as_deref();
@@ -2844,6 +2852,8 @@ impl Build {
2844
2852
// also making it available as "cc".
2845
2853
let default = if cfg!(target_os = "solaris") || cfg!(target_os = "illumos") {
2846
2854
gnu
2855
+ } else if self.prefer_clang() {
2856
+ clang
2847
2857
} else {
2848
2858
traditional
2849
2859
};
0 commit comments