|
1 | 1 | use std::path::PathBuf;
|
2 | 2 | use std::{env, fs};
|
3 | 3 |
|
| 4 | +use crate::core::build_steps::compile::is_lto_stage; |
4 | 5 | use crate::core::build_steps::toolstate::ToolState;
|
5 | 6 | use crate::core::build_steps::{compile, llvm};
|
6 | 7 | use crate::core::builder;
|
@@ -659,14 +660,16 @@ impl Step for Rustdoc {
|
659 | 660 | );
|
660 | 661 |
|
661 | 662 | // rustdoc is performance sensitive, so apply LTO to it.
|
662 |
| - let lto = match builder.config.rust_lto { |
663 |
| - RustcLto::Off => Some("off"), |
664 |
| - RustcLto::Thin => Some("thin"), |
665 |
| - RustcLto::Fat => Some("fat"), |
666 |
| - RustcLto::ThinLocal => None, |
667 |
| - }; |
668 |
| - if let Some(lto) = lto { |
669 |
| - cargo.env(cargo_profile_var("LTO", &builder.config), lto); |
| 663 | + if is_lto_stage(&build_compiler) { |
| 664 | + let lto = match builder.config.rust_lto { |
| 665 | + RustcLto::Off => Some("off"), |
| 666 | + RustcLto::Thin => Some("thin"), |
| 667 | + RustcLto::Fat => Some("fat"), |
| 668 | + RustcLto::ThinLocal => None, |
| 669 | + }; |
| 670 | + if let Some(lto) = lto { |
| 671 | + cargo.env(cargo_profile_var("LTO", &builder.config), lto); |
| 672 | + } |
670 | 673 | }
|
671 | 674 |
|
672 | 675 | let _guard = builder.msg_tool(
|
|
0 commit comments