-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc: Ignore fs::canonicalize errors in metadata #74915
rustc: Ignore fs::canonicalize errors in metadata #74915
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
It looks like rust/src/librustc_metadata/creader.rs Line 239 in 584e83d
rust/src/librustc_session/filesearch.rs Line 127 in 584e83d
I didn't look at tools or bootstrap but those probably have more cases like this as well. r=me if you don't want to fix those in this PR though! |
This commit updates the metadata location logic to ignore errors when calling `fs::canonicalize`. Canonicalization was added historically so multiple `-L` paths to the same directory don't print errors about multiple candidates (since rustc can deduplicate same-named paths), but canonicalization doesn't work on all filesystems. Cargo, for example, always uses this sort of fallback where it will opportunitistically try to canonicalize but fall back to using the input path if it otherwise doesn't work. If rustc is run on a filesystem that doesn't support canonicalization then the effect of this change will be that `-L` paths which logically point to the same directory will cause errors, but that's a rare enough occurrence it shouldn't cause much issue in practice. Otherwise rustc doesn't work at all today on those sorts of filesystem where canonicalization isn't supported!
92e1101
to
cd8bdb5
Compare
Ah good catch! I've gone ahead and fixed those too. @bors: r=Mark-Simulacrum |
📌 Commit cd8bdb5 has been approved by |
…arth Rollup of 9 pull requests Successful merges: - rust-lang#74751 (Clean up E0730 explanation) - rust-lang#74782 (Don't use "weak count" around Weak::from_raw_ptr) - rust-lang#74835 (Clean up E0734 explanation) - rust-lang#74871 (Enable docs on dist-x86_64-musl) - rust-lang#74905 (Avoid bool-like naming) - rust-lang#74907 (Clean up E0740 explanation) - rust-lang#74915 (rustc: Ignore fs::canonicalize errors in metadata) - rust-lang#74934 (Improve diagnostics when constant pattern is too generic) - rust-lang#74951 (Cherry-pick the release notes for 1.45.1) Failed merges: r? @ghost
This commit updates the metadata location logic to ignore errors when
calling
fs::canonicalize
. Canonicalization was added historically somultiple
-L
paths to the same directory don't print errors aboutmultiple candidates (since rustc can deduplicate same-named paths), but
canonicalization doesn't work on all filesystems. Cargo, for example,
always uses this sort of fallback where it will opportunitistically try
to canonicalize but fall back to using the input path if it otherwise
doesn't work.
If rustc is run on a filesystem that doesn't support canonicalization
then the effect of this change will be that
-L
paths which logicallypoint to the same directory will cause errors, but that's a rare enough
occurrence it shouldn't cause much issue in practice. Otherwise rustc
doesn't work at all today on those sorts of filesystem where
canonicalization isn't supported!