-
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
prep work for using timely dataflow with NLL #49836
Conversation
NB. Not 100% tested yet =) will fix as needed. |
@@ -303,28 +303,28 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { | |||
) { | |||
debug!("report_region_errors(): {} errors to start", errors.len()); | |||
|
|||
if will_later_be_reported_by_nll && self.tcx.nll() { | |||
if will_later_be_reported_by_nll && self.tcx.use_mir() { |
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.
eek; while I understand collapsing -Z nll
into -Z borrowck=mir
, you've chosen the method name "use_mir" to represent this collapsed flag? I would have expected you to either reuse "nll" again, or to include something about borrow-checking in the method name... "use_mir" just seems very broad and easy to misinterpret...
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.
indeed I should rename it =)
019d8a2
to
9ccd28f
Compare
Your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem. Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
@pnkfelix ok addressed your nit :) |
@@ -26,10 +26,12 @@ fn foo(a: &mut i32) { | |||
inside_closure(a) | |||
}; | |||
outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access | |||
//[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access |
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.
Of course, there was a reason that these comments were indented so much: To allow ease of comparison with the line above.
Having said that, we all hope that compare-mode=nll will provide a much better path forward, so I don't really care to try to preserve details like this here.
This all seems fine. If I were writing this I might have changed the |
@bors r+ |
📌 Commit 9ccd28f has been approved by |
☔ The latest upstream changes (presumably #49808) made this pull request unmergeable. Please resolve the merge conflicts. |
Also: - Extract common helper functions into a helper trait. - Kill a bit of dead code.
9ccd28f
to
96dba93
Compare
Rebased. That was a bit of a tricky rebase (git diffs were pretty messed up). =) But I think I got it right. |
@bors r=pnkfelix |
📌 Commit 96dba93 has been approved by |
prep work for using timely dataflow with NLL Two major changes: **Two-phase borrows are overhauled.** We no longer have two bits per borrow. Instead, we track -- for each borrow -- an (optional) "activation point". Then, for each point P where the borrow is in scope, we check where P falls relative to the activation point. If P is between the reservation point and the activation point, then this is the "reservation" phase of the borrow, else the borrow is considered active. This is simpler and means that the dataflow doesn't have to care about 2-phase at all, at last not yet. **We no longer support using the MIR borrow checker without NLL.** It is going to be increasingly untenable to support lexical mode as we go forward, I think, and also of increasingly little value. This also exposed a few bugs in NLL mode due to increased testing. r? @pnkfelix cc @bobtwinkles
☀️ Test successful - status-appveyor, status-travis |
Two major changes:
Two-phase borrows are overhauled. We no longer have two bits per borrow. Instead, we track -- for each borrow -- an (optional) "activation point". Then, for each point P where the borrow is in scope, we check where P falls relative to the activation point. If P is between the reservation point and the activation point, then this is the "reservation" phase of the borrow, else the borrow is considered active. This is simpler and means that the dataflow doesn't have to care about 2-phase at all, at last not yet.
We no longer support using the MIR borrow checker without NLL. It is going to be increasingly untenable to support lexical mode as we go forward, I think, and also of increasingly little value. This also exposed a few bugs in NLL mode due to increased testing.
r? @pnkfelix
cc @bobtwinkles