Skip to content

Commit e58aa21

Browse files
Re-enable "jump to def" feature on rustc docs
1 parent 820bfff commit e58aa21

File tree

2 files changed

+5
-2
lines changed
  • compiler/rustc_interface/src
  • src/bootstrap/src/core/build_steps

2 files changed

+5
-2
lines changed

compiler/rustc_interface/src/passes.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,9 @@ fn run_required_analyses(tcx: TyCtxt<'_>) {
827827
if tcx.sess.opts.unstable_opts.input_stats {
828828
rustc_passes::input_stats::print_hir_stats(tcx);
829829
}
830-
#[cfg(debug_assertions)]
830+
// When using rustdoc's "jump to def" feature, it enters this code and `check_crate`
831+
// is not defined. So we need to cfg it out.
832+
#[cfg(all(not(doc), debug_assertions))]
831833
rustc_passes::hir_id_validator::check_crate(tcx);
832834
let sess = tcx.sess;
833835
sess.time("misc_checking_1", || {

src/bootstrap/src/core/build_steps/doc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,8 @@ impl Step for Rustc {
830830
cargo.rustdocflag("--show-type-layout");
831831
// FIXME: `--generate-link-to-definition` tries to resolve cfged out code
832832
// see https://github.com/rust-lang/rust/pull/122066#issuecomment-1983049222
833-
// cargo.rustdocflag("--generate-link-to-definition");
833+
// If there is any bug, please comment out the next line.
834+
cargo.rustdocflag("--generate-link-to-definition");
834835

835836
compile::rustc_cargo(builder, &mut cargo, target, &compiler, &self.crates);
836837
cargo.arg("-Zskip-rustdoc-fingerprint");

0 commit comments

Comments
 (0)