Skip to content
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

Merged
merged 4 commits into from
Jul 19, 2020

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented Jul 5, 2020

Instead of reporting span_errs 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 #55103
Fixes #56590

@rust-highfive
Copy link
Collaborator

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

(rust_highfive has picked a reviewer for you, use r? to override)

@bors
Copy link
Contributor

bors commented Jul 11, 2020

☔ The latest upstream changes (presumably #74235) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@matthewjasper matthewjasper left a 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.

@petrochenkov
Copy link
Contributor Author

@bors r=matthewjasper

@bors
Copy link
Contributor

bors commented Jul 18, 2020

📌 Commit 0a4217d has been approved by matthewjasper

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 18, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 19, 2020
…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
@bors bors merged commit 43ba840 into rust-lang:master Jul 19, 2020
@Mark-Simulacrum
Copy link
Member

@rust-timer make-pr-for 43ba840

rust-timer added a commit to rust-timer/rust that referenced this pull request Jul 21, 2020
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
@petrochenkov
Copy link
Contributor Author

This PR shouldn't affect performance in theory, it can potentially execute less code but only when errors are reported.

@Mark-Simulacrum
Copy link
Member

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.

@jyn514 jyn514 added A-metadata Area: Crate metadata T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 29, 2020
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metadata Area: Crate metadata S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
7 participants