Skip to content

Add -Zimplicit-sysroot-deps#159717

Open
adamgemmell wants to merge 4 commits into
rust-lang:mainfrom
adamgemmell:dev/reucru01/no-implicit-sysroot-deps
Open

Add -Zimplicit-sysroot-deps#159717
adamgemmell wants to merge 4 commits into
rust-lang:mainfrom
adamgemmell:dev/reucru01/no-implicit-sysroot-deps

Conversation

@adamgemmell

Copy link
Copy Markdown
Contributor

This PR, originally authored by @CrooseGit, adds support for a new flag proposed in the build-std=always RFC. It unblocks work by @Bryanskiy around handling panic strategies in build-std, for which rustc must look for them in -Ldependency locations and not the sysroot.

-Zimplicit-sysroot-deps is true by default. When false, rustc will not look in the sysroot when attempting to resolve direct dependencies. It is intended to be used by Cargo when using build-std to improve error messages, avoiding the common "duplicate lang item in crate core" error that occurs when not all required standard library crates have been built.

Not included in this PR is the behaviour around dependencies injected by rustc in rustc_metadata, such as panic runtimes and compiler-builtins, which will be addressed in the future.

When `-Z implicit-sysroot-deps=false`, the sysroot is not added to the list of search paths for resolving top level dependencies.
One UI test that fails to find crate `std` as it does not look in the sysroot.
One UI test that which only transitively depends on std, and thus it is
searched for in the sysroot.
1) Depending transitively on a lib in the sysroot resolves fine with `-Zimplicit-sysroot-deps=false`
2) Depending directly on a lib in the sysroot does not resolve implicitly with `-Zimplicit-sysroot-deps=false`
@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 Jul 22, 2026
@rustbot

rustbot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
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 74 candidates
  • Random selection from 20 candidates

@adamgemmell

Copy link
Copy Markdown
Contributor Author

r? compiler reroll

@rustbot rustbot assigned nnethercote and unassigned davidtwco Jul 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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants