-
Notifications
You must be signed in to change notification settings - Fork 13.3k
CrateLocator refactorings #88538
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
CrateLocator refactorings #88538
Conversation
r? @wesleywiser (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
I'm guessing that this failure was caused by the extra filename changes. |
I'm going to review because "continue refactoring crate locator" is an item from my work queue on which I was going to work myself (cc #56935 (comment)). |
This comment has been minimized.
This comment has been minimized.
5e100a2
to
72af6d8
Compare
I forgot an ! in the |
@bors try @rust-timer queue |
Awaiting bors try build completion. @rustbot label: +S-waiting-on-perf |
⌛ Trying commit 72af6d865b37f99524b00b6704622b446d74fefd with merge 9fb7be546f93c5a3ff56d4d58c89247eceba6c68... |
I think I will revert "Don't pass Session to CrateError::report". Unlike with |
☀️ Try build successful - checks-actions |
Queued 9fb7be546f93c5a3ff56d4d58c89247eceba6c68 with parent 76d18cf, future comparison URL. |
As far as I understand, the crates will now be (usually) rejected via hash kept in metadata instead of the extra filename piece (which is also some kind of hash if cargo is used). Besides many versions of the same crate the perf regression can hit many crates with the same prefix like |
That and the file prefix depending in the crate name.
Didn't think about that. Would have been nice if the extra filename was required to start with |
Finished benchmarking try commit (9fb7be546f93c5a3ff56d4d58c89247eceba6c68): comparison url. Summary: This change led to moderate relevant mixed results 🤷 in compiler performance.
If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf. Next Steps: If you can justify the regressions found in this perf run, please indicate this with @bors rollup=never |
I think the regression is neglectable.
I think a perf regression for this specific case can be prevented by checking with |
It can change behavior in theory if the file is found with the specified extra prefix. |
I'm still not sure about no longer keeping the |
Doesn't the search stop as soon a crate with the right SVH was found if a required SVH was specified? |
It does not? I've just looked through the code, but haven't noticed any such early return logic. |
I will squash the reverts after review. |
I don't know the specifics of what this PR is about, and I can't find a necessarily clear question that's being asked, but I can try to offer some thoughts anyway. From the comment above it sounds like previously rustc is taking |
I reverted the extra-filename commit. While I think it would be nice to drop extra-filename, the downsides don't weight up against it. At least without some kind of cache to map from svh to filename, but that introduces much more complexity elsewhere. |
r=me with commits appropriately squashed. |
@bors rollup=maybe |
This also fixes a (theoretical) bug where a proc-macro may be loaded as plugin if it exports a symbol with the right name.
2b363c2
to
ff98cb6
Compare
Squashed all reverts and the bugfix commit. @bors r=petrochenkov |
📌 Commit ff98cb6 has been approved by |
☀️ Test successful - checks-actions |
This makes the
CrateLocator
a lot cleaner IMHO and much more self-contained. The last commit removesextra_filename
from the crate metadata. This is an insta-stable change as it allows a crate likelibfoo-abc.rlib
to be used as dependency and then be renamed aslibfoo-bcd.rlib
while still being found as indirect dependency. This may reduce performance when there are a lot of versions of the same crate available as the extra filename won't be used to do an early rejection of crates before trying to load metadata, but it makes the logic to find the right filename a lot cleaner.