Skip to content

Commit 9a473cc

Browse files
committed
Use LTO for librustdoc
1 parent 0185ff7 commit 9a473cc

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ fn prepare_lto(
132132
let module = SerializedModule::FromRlib(data.to_vec());
133133
upstream_modules.push((module, CString::new(name).unwrap()));
134134
}
135-
Err(msg) => return Err(diag_handler.fatal(&msg)),
135+
Err(msg) => {
136+
eprintln!("Couldn't add bitcode from {name}");
137+
return Err(diag_handler.fatal(&msg));
138+
}
136139
}
137140
}
138141
}

src/bootstrap/tool.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ impl Step for Rustdoc {
540540
features.push("jemalloc".to_string());
541541
}
542542

543-
let cargo = prepare_tool_cargo(
543+
let mut cargo = prepare_tool_cargo(
544544
builder,
545545
build_compiler,
546546
Mode::ToolRustc,
@@ -551,6 +551,11 @@ impl Step for Rustdoc {
551551
features.as_slice(),
552552
);
553553

554+
if build_compiler.stage == 1 {
555+
cargo.rustflag("-Cembed-bitcode=yes");
556+
cargo.rustflag("-Clto=thin");
557+
}
558+
554559
builder.info(&format!(
555560
"Building rustdoc for stage{} ({})",
556561
target_compiler.stage, target_compiler.host

src/librustdoc/clean/blanket_impl.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
5555
// FIXME(eddyb) ignoring `obligations` might cause false positives.
5656
drop(obligations);
5757

58-
trace!(
58+
tracing::trace!(
5959
"invoking predicate_may_hold: param_env={:?}, impl_trait_ref={:?}, impl_ty={:?}",
6060
param_env,
6161
impl_trait_ref,
@@ -87,9 +87,10 @@ impl<'a, 'tcx> BlanketImplFinder<'a, 'tcx> {
8787
_ => continue 'blanket_impls,
8888
}
8989
}
90-
debug!(
90+
tracing::debug!(
9191
"get_blanket_impls: found applicable impl for trait_ref={:?}, ty={:?}",
92-
trait_ref, ty
92+
trait_ref,
93+
ty
9394
);
9495

9596
cx.generated_synthetics.insert((ty.0, trait_def_id));

0 commit comments

Comments
 (0)