Skip to content

Conversation

@Felixoid
Copy link
Contributor

Fixes #2303

If the CARGO_HOME is empty, but rustc is installed globally, it will be used in the compiler::rust::test::test_rlib_dep_reader_call.

Now, the test fails as:

---- compiler::rust::test::test_rlib_dep_reader_call stdout ----

thread 'compiler::rust::test::test_rlib_dep_reader_call' panicked at src/compiler/rust.rs:3321:33:
called `Result::unwrap()` on an `Err` value: No such file or directory (os error 2)

@sylvestre
Copy link
Collaborator

is it possible to add a test to make sure it doesn't regress? thanks

@codecov-commenter
Copy link

codecov-commenter commented Dec 23, 2025

Codecov Report

❌ Patch coverage is 40.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.05%. Comparing base (cd7dcd5) to head (7e3cbf2).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
src/compiler/rust.rs 40.00% 3 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2527   +/-   ##
=======================================
  Coverage   71.04%   71.05%           
=======================================
  Files          64       64           
  Lines       35369    35393   +24     
=======================================
+ Hits        25128    25147   +19     
- Misses      10241    10246    +5     

☔ View full report in Codecov by Sentry.
📢 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.

@Felixoid
Copy link
Contributor Author

Felixoid commented Dec 23, 2025

I don't know how to do it. The test is environment-dependent, so what should the regression test do?

Neither of rustc in $PATH nor $CARGO_home/bin/rustc looks mandatory to me. It's unclear how the regression can be caught.

@Felixoid
Copy link
Contributor Author

I added the comment on why the code looks like this. It's the best I can think of.

Checking if rustc exists when CARGO_HOME is not set would fail for environments where there's no globally installed rust. And vise-versa as well, that's why this fallback is actually necessary.

@sylvestre sylvestre merged commit 058b377 into mozilla:main Dec 30, 2025
54 checks passed
@Felixoid Felixoid deleted the fix-test-rlib branch December 30, 2025 11:18
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.

test_rlib_dep_reader_call asserts env::var("CARGO_HOME").is_ok() but it's not necessarily true

3 participants