-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Region naming refactoring [6/N] #67476
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
109c30f
More separation of error reporting from region inference
mark-i-m c3e74f3
Move some methods to region_infer/mod.rs
mark-i-m 736348a
Move a bunch of methods to inherent impl MirBorrowckCtxt
mark-i-m 786db73
Move report_region_errors to region_errors.rs
mark-i-m 66c5d5b
Privatize the fields of RegionInferenceContext
mark-i-m 234b930
rename nonlexical_regioncx -> regioncx
mark-i-m a804868
Get rid of RegionErrorNamingContext
mark-i-m f05e40e
address review comments
mark-i-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move report_region_errors to region_errors.rs
- Loading branch information
commit 786db7399fa8214aa2412fbeb18033524bfa8b34
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you reset
next_region_nameto 1 here?Uh oh!
There was an error while loading. Please reload this page.
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.
I thought about this, as it is the cause of the one test out change... but I'm not really sure we want to. It seems more correct to use the previous counter.
EDIT: Ignore this comment... I thought we were talking about resetting in
explain_borrowto preserve the old behavior.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.
I think I would prefer to have errors that we report be independent of each other.
The errors can potentially be reordered, and we will have to reset the counter and map between different item bodies anyway.
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.
Actually, looking at this again now. Won't
do_mirborrowckonly ever be called once on a MIR def id? In that case, the counter will reset for the next def we check in the constructor ofMirBorrowckCtxt, right?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.
@matthewjasper I just tried resetting the counter forcibly, and none of the test output changed. So I think my second comment is correct. The counter will be recreated starting at 1 each time we borrowck a new MIR def, and we do not need to reset manually.
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.
I guess I wasn't being clear with "we will have to reset the counter and map between different item bodies anyway." I really meant that we can't store the counter somewhere global and share it between borrow checks, so we also shouldn't persist it between errors.
I guess if this matters then someone will raise an issue.
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.
Ah I see what you mean now. I argue that we don't want to. Having consistent numbering between error messages on the same MIR body makes sense IMHO. Additionally, outlives suggestions will sometimes output a combined suggestion across errors, in which case we do want consistent naming across errors.