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

Get rid of ErrorReportingCtx [5/N] #67474

Merged
merged 2 commits into from
Dec 30, 2019

Conversation

mark-i-m
Copy link
Member

@mark-i-m mark-i-m commented Dec 21, 2019

We can now use MirBorrowckCtxt instead :)

6 files changed, 122 insertions(+), 243 deletions(-)

This is a followup to (and thus blocked on) #67241.

r? @matthewjasper

cc @eddyb

I while try to do one more to get rid of the weird usage of RegionInferenceCtx in borrow_check::diagnostics::{region_errors, region_naming}. I think those uses can possibly also be refactored to use MirBorrowckCtxt...

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 21, 2019
@mark-i-m
Copy link
Member Author

@rustbot modify labels: -S-waiting-on-review +S-blocked

@rustbot rustbot added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 21, 2019
@mark-i-m mark-i-m force-pushed the simplify-borrow_check-4 branch 2 times, most recently from 208e42f to 12bc5e9 Compare December 22, 2019 23:29
@bors
Copy link
Contributor

bors commented Dec 23, 2019

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

@mark-i-m mark-i-m force-pushed the simplify-borrow_check-4 branch 2 times, most recently from 7d873e6 to 2dd035e Compare December 28, 2019 16:36
@mark-i-m
Copy link
Member Author

@matthewjasper @eddyb This is ready

@rustbot modify labels: +S-waiting-on-review -S-blocked

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Dec 28, 2019
@mark-i-m mark-i-m changed the title Get rid of ErrorReportingCtx Get rid of ErrorReportingCtx [5/N] Dec 29, 2019
@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 29, 2019

📌 Commit c8ebc319a4bf75a9184af86a6b61616242857788 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 Dec 29, 2019
@bors
Copy link
Contributor

bors commented Dec 30, 2019

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout simplify-borrow_check-4 (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self simplify-borrow_check-4 --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging src/librustc_mir/borrow_check/diagnostics/region_name.rs
CONFLICT (content): Merge conflict in src/librustc_mir/borrow_check/diagnostics/region_name.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 30, 2019
@bors
Copy link
Contributor

bors commented Dec 30, 2019

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

@mark-i-m
Copy link
Member Author

Rebased. Rerunning tests locally (it will take a while), but I'm not expecting changes...

@mark-i-m
Copy link
Member Author

@rustbot modify labels: +S-waiting-on-review -S-waiting-on-author

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Dec 30, 2019
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 30, 2019
@mark-i-m
Copy link
Member Author

Tests passing locally (stage 1, compare-mode=nll)

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 30, 2019

📌 Commit 96ce607 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 Dec 30, 2019
@bors
Copy link
Contributor

bors commented Dec 30, 2019

⌛ Testing commit 96ce607 with merge 9d6f871...

bors added a commit that referenced this pull request Dec 30, 2019
Get rid of ErrorReportingCtx [5/N]

We can now use `MirBorrowckCtxt` instead :)

```
6 files changed, 122 insertions(+), 243 deletions(-)
```

This is a followup to (and thus blocked on) #67241.

r? @matthewjasper

cc @eddyb

I while try to do one more to get rid of the weird usage of `RegionInferenceCtx` in `borrow_check::diagnostics::{region_errors, region_naming}`. I think those uses can possibly also be refactored to use `MirBorrowckCtxt`...
@bors
Copy link
Contributor

bors commented Dec 30, 2019

☀️ Test successful - checks-azure
Approved by: matthewjasper
Pushing 9d6f871 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 30, 2019
@bors bors merged commit 96ce607 into rust-lang:master Dec 30, 2019
@mark-i-m mark-i-m deleted the simplify-borrow_check-4 branch December 30, 2019 20:17
bors added a commit that referenced this pull request Jan 17, 2020
Region naming refactoring [6/N]

Followup to #67474

EDIT: this PR is probably best read commit-by-commit...

The major changes in this PR include:
- moving many functions around to modules that better suit them. In particular, a lot of methods were moved from `borrow_check::diagnostics::region_errors` to `borrow_check::region_infer`, and `report_region_errors` was moved from `borrow_check` to `borrow_check::diagnostics::region_errors`.
- `borrow_check::diagnostics::{region_errors, region_name}` are now most comprised of methods on `MirBorrowckCtxt` instead of `RegionInferenceContext`, allowing us to get rid of the annoying `pub(in crate::borrow_check)` on most of the fields of the latter, along with a number of method arguments on many methods.
- I renamed `MirBorrowckCtxt.nonlexical_regioncx` to just `regioncx` because their is no lexical lifetimes any more, and the old name was annoyingly verbose, causing many lines to wrap unnecessarily.
- I got rid of `ErrorRegionNamingContext`. Region naming is implemented as inherent methods on `MirBorrowckCtxt`, so we just move the naming stuff into that struct.

The PR is rather large, but the commits are fairly self-contained (though they don't all compile). There was one minor output change to one test with `compare-mode=nll`, which I think is acceptable.

Between this PR and the last one, a net of 200 lines are removed, most of which was function parameters and context structs :tada:

Some samples:

```diff
-                        self.nonlexical_regioncx.free_region_constraint_info(
-                            &self.body,
-                            &self.local_names,
-                            &self.upvars,
-                            self.mir_def_id,
-                            self.infcx,
-                            borrow_region_vid,
-                            region,
-                        );
+                        self.free_region_constraint_info(borrow_region_vid, region);
```

```diff
-            .or_else(|| {
-                self.give_name_if_anonymous_region_appears_in_yield_ty(
-                    infcx,
-                    body,
-                    *mir_def_id,
-                    fr,
-                    renctx,
-                )
-            });
+            .or_else(|| self.give_name_if_anonymous_region_appears_in_arguments(fr))
```

r? @matthewjasper

cc @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants