-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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_metadata: Make crate loading fully speculative #74071
Conversation
Some changes occurred in diagnostic error codes |
(rust_highfive has picked a reviewer for you, use r? to override) |
☔ The latest upstream changes (presumably #74235) made this pull request unmergeable. Please resolve the merge conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, r=me with conflicts resolved.
They are deprecated so doing extra work for error recovery doesn't make sense
@bors r=matthewjasper |
📌 Commit 0a4217d has been approved by |
…arth Rollup of 7 pull requests Successful merges: - rust-lang#70817 (Add core::task::ready! macro) - rust-lang#73762 (Document the trait keyword) - rust-lang#74021 (impl Index<RangeFrom> for CStr) - rust-lang#74071 (rustc_metadata: Make crate loading fully speculative) - rust-lang#74445 (add test for rust-lang#62878) - rust-lang#74459 (Make unreachable_unchecked a const fn) - rust-lang#74478 (Revert "Use an UTF-8 locale for the linker.") Failed merges: r? @ghost
@rust-timer make-pr-for 43ba840 |
Original message: Rollup merge of rust-lang#74071 - petrochenkov:cload3, r=matthewjasper rustc_metadata: Make crate loading fully speculative Instead of reporting `span_err`s on the spot crate loading errors are now wrapped into the `CrateError` enum and returned, so they are reported only at the top level `resolve_crate` call, and not reported at all if we are resolving speculatively with `maybe_resolve_crate`. As a result we can attempt loading crates for error recovery (e.g. import suggestions) without any risk of producing extra errors. Also, this means better separation between error reporting and actual logic. Fixes rust-lang#55103 Fixes rust-lang#56590
This PR shouldn't affect performance in theory, it can potentially execute less code but only when errors are reported. |
It was noted as a candidate for performance changes by @nnethercote in #74493; I'm also partially using this as a way to test the tooling for the auto-testing of already landed PRs. |
Instead of reporting
span_err
s on the spot crate loading errors are now wrapped into theCrateError
enum and returned, so they are reported only at the top levelresolve_crate
call, and not reported at all if we are resolving speculatively withmaybe_resolve_crate
.As a result we can attempt loading crates for error recovery (e.g. import suggestions) without any risk of producing extra errors.
Also, this means better separation between error reporting and actual logic.
Fixes #55103
Fixes #56590