Skip to content

Package rust toolchain more selectively - #2852

Open
pprkut wants to merge 1 commit into
mozilla:mainfrom
pprkut:system-rust
Open

pprkut wants to merge 1 commit into
mozilla:mainfrom
pprkut:system-rust

Conversation

@pprkut

@pprkut pprkut commented Sep 12, 2026

Copy link
Copy Markdown

By querying rustc for its actual target-libdir, linux distro provided rust toolchains installed in, for example, lib64 rather than lib are now packaged correctly as well.

Additionally filtering down to actually needed files prevents the toolchain from including all of /usr/{bin,lib} in the toolchain package.

As a side effect this should also make the toolchain packages for standalone rust toolchains a bit more compact.

I kept a couple longer comments in that explain the choices/reasoning. If you'd rather I remove them before merging that's fine with me, but I figured they would be handy for the review at least.

Related

Potentially fixes #1870 (hard to tell from the error messages, but I also started with gcc working and rust failing).

Partially conflicts/overlaps with #2850 (Fix 4). Similar conclusions, but the approach here also considers lib64. #2850 in turn retains the old behavior as fallback functionality, while the approach here errors out.

Comment thread src/compiler/compiler.rs
next_command(creator, Ok(MockChild::new(exit_status(0), sysroot, "")));
next_command(creator, Ok(MockChild::new(exit_status(0), sysroot, "")));
let sysroot_and_target_libdir =
format!("{sysroot}\n{sysroot}/lib/rustlib/x86_64-unknown-linux-gnu/lib");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hardcording x86_64 ?!
sorry

@pprkut pprkut Sep 14, 2026 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The function is only used in test code, afaics, and other tests used the same target. That's why I left it. But it's fair, I can fix it.

On second thought, it matches the mocked command output above, so it should probably stay like this.

@codecov-commenter

codecov-commenter commented Sep 14, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.70130% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.44%. Comparing base (01c35e6) to head (6c919bd).
⚠️ Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
src/compiler/rust.rs 98.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2852      +/-   ##
==========================================
+ Coverage   76.32%   76.44%   +0.11%     
==========================================
  Files          72       72              
  Lines       40180    40317     +137     
==========================================
+ Hits        30669    30821     +152     
+ Misses       9511     9496      -15     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

By querying rustc for its actual target-libdir, linux distro
provided rust toolchains installed in, for example, lib64 rather
than lib are now packaged correctly as well.

Additionally filtering down to actually needed files prevents the
toolchain from including all of /usr/bin in the toolchain package.

As a side effect this should also make the toolchain packages for
standalone rust toolchains a bit more compact.
Comment thread src/compiler/rust.rs
/// src -> the standard library sources
/// etc -> the gdb/lldb pretty-printers.
#[cfg(feature = "dist-client")]
#[allow(unused)]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

could we use the same linux cfg as the ToolchainPackager impl instead of #[allow(unused)] on these 3 items?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rust distributed compilations always fail

3 participants