-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
rustup component rust-src should be used to load cross-crate sources. #53486
Copy link
Copy link
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
If I take this arbitrary example (that supports cross-crate spans, via
tcx.def_span(...)):and compiling it with a local rustc build, I get this error (note the
libcoresnippet):(NB: if that snippet disappears, find other
tcx.def_span(...)-using diagnostics and replace the test)but if try with
rustup-providedrustc, I only get this shorter error:But
$(rustc --print=sysroot)/lib/rustlib/src/rust/src/libcore/iter/traits.rsdoes exist, because I have therust-srccomponent enabled (it's enabled by default, which makes it likely to exist for most users), so it should be possible in theory, to teach rustc to look up certain paths relative tolib/rustlib/src/rustinside the sysroot, if it exists.Running this:
shows that
/checkout/src/libcore/iter/traits.rsandlibcore/iter/traits.rsboth exist in therlib, and I assume the former is the one that it tries to load - we can even test this:Trying the test again, we now get:
So it's definitely compatible, the hash check passes and whatnot, we just need to rename
/checkoutto something artificial like$rust, I'm guessing.# ... but also clean up afterwards. sudo rm /checkoutcc @alexcrichton @rust-lang/dev-tools @rust-lang/compiler