Skip to content

Avoid unconditional deps from doc links#158080

Open
kevin-valerio wants to merge 1 commit into
rust-lang:mainfrom
kevin-valerio:fix/issue-158078-rustdoc-doc-link-dep
Open

Avoid unconditional deps from doc links#158080
kevin-valerio wants to merge 1 commit into
rust-lang:mainfrom
kevin-valerio:fix/issue-158078-rustdoc-doc-link-dep

Conversation

@kevin-valerio

Copy link
Copy Markdown
Contributor

Fixes #158078

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 18, 2026
@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

r? @Kivooeo

rustbot has assigned @Kivooeo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 19 candidates


pub fn maybe_process_path_extern(&mut self, tcx: TyCtxt<'_>, name: Symbol) -> Option<CrateNum> {
self.maybe_resolve_crate(tcx, name, CrateDepKind::Unconditional, CrateOrigin::Extern).ok()
self.maybe_resolve_crate(tcx, name, CrateDepKind::Conditional, CrateOrigin::Extern).ok()

@bjorn3 bjorn3 Jun 18, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CrateDepKind::Conditional is currently only used for crates that are implicitly injected by the compiler like the panic runtime and profiler runtime.

In any case can you explain why this is actually correct? In that cases does maybe_process_path_extern get called without a later process_path_extern? Is there any risk that this will cause a crate actually referenced outside of a doc comment to be loaded as conditional?

View changes since the review

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
Diff in /checkout/tests/run-make/rustdoc-doc-link-conditional-dep/rmake.rs:17:
 
     run("app").assert_stdout_equals("7").assert_stderr_not_contains("constructor ran");
 
-    llvm_nm()
-        .input(bin_name("app"))
-        .run()
-        .assert_stdout_not_contains_regex("[Tt] _*mark_ctor");
+    llvm_nm().input(bin_name("app")).run().assert_stdout_not_contains_regex("[Tt] _*mark_ctor");
 }
 
fmt: checked 6929 files
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Build completed unsuccessfully in 0:00:50

@Kivooeo

Kivooeo commented Jun 22, 2026

Copy link
Copy Markdown
Member

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 22, 2026
@rustbot

rustbot commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rustdoc links can force constructors to run

5 participants