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

Reorganize borrow check diagnostic code #66815

Merged
merged 8 commits into from
Dec 5, 2019

Conversation

mark-i-m
Copy link
Member

Currently borrow checker diagnostics are split across many different modules in different places in the librustc_mir crate. This moves them all to a diagnostics module. This also reduces the nesting of the modules a bit (sooo much nesting).

I am also thinking of moving stuff out of the nll module since we only have one borrow checker now (:tada:), and maybe it even makes sense to split out all of this stuff to a librustc_borrow_check, but those are for the future. Feel free to ping me here or on zulip and let me know what you think...

cc @nikomatsakis @matthewjasper @eddyb

@rust-highfive
Copy link
Collaborator

r? @matthewjasper

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

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

mark-i-m commented Nov 27, 2019

I still need to fix up a bunch of imports... also, I'm not super happy about sprinkling pub (in crate::borrow_check) in front of the fields of RegionInferenceContext and other structs... thoughts?

@mark-i-m mark-i-m marked this pull request as ready for review November 27, 2019 20:35
@mark-i-m
Copy link
Member Author

@matthewjasper Looks like this is ready for review.

I would like to take a crack at making region_errors/region_name not be implemented in RegionInferenceContext at some point in a followup so that we could clean up the pub(in crate::borrow_check) messes...

@mark-i-m
Copy link
Member Author

Sorry, one more thing: this will probably conflict with #66679, so maybe wait for that to merge first?

@bors
Copy link
Contributor

bors commented Nov 27, 2019

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

@eddyb
Copy link
Member

eddyb commented Nov 28, 2019

I wouldn't mind src/librustc_borrowck (not librustc_borrow_check because both "rustc" and fully-spelled-out "check" seem a bit excessive, but that's just a stylistic prefer), but:
That's only if there is no dependency between the rest of librustc_mir and borrowck (in either direction), i.e. if they are two independent components that only happen to be colocated.

@matthewjasper
Copy link
Contributor

Unfortunately there is a dependency until polonius is fully implemented.

@mark-i-m
Copy link
Member Author

Sorry, forgetting the command right now, but this is S-blocked on #66679

I rebased over that PR...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, 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.
2019-11-29T17:14:39.2266114Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-11-29T17:14:39.2436067Z ##[command]git config gc.auto 0
2019-11-29T17:14:39.2513431Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-11-29T17:14:39.2570664Z ##[command]git config --get-all http.proxy
2019-11-29T17:14:39.2726656Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/66815/merge:refs/remotes/pull/66815/merge
---
2019-11-29T17:25:22.7964484Z    Compiling rustc_parse v0.0.0 (/checkout/src/librustc_parse)
2019-11-29T17:26:14.0298288Z    Compiling syntax_expand v0.0.0 (/checkout/src/libsyntax_expand)
2019-11-29T17:27:24.5926545Z    Compiling rustc_typeck v0.0.0 (/checkout/src/librustc_typeck)
2019-11-29T17:31:20.1358147Z    Compiling rustc_mir v0.0.0 (/checkout/src/librustc_mir)
2019-11-29T17:31:39.2546688Z error[E0451]: field `local_names` of struct `borrow_check::diagnostics::region_errors::ErrorReportingCtx` is private
2019-11-29T17:31:39.2552068Z    --> src/librustc_mir/borrow_check/diagnostics/region_name.rs:217:38
2019-11-29T17:31:39.2578345Z     |
2019-11-29T17:31:39.2579177Z 217 |             infcx, body, mir_def_id, local_names, upvars, ..
2019-11-29T17:31:39.2579891Z     |                                      ^^^^^^^^^^^ field `local_names` is private
2019-11-29T17:31:39.2580255Z 
2019-11-29T17:31:39.2612055Z error[E0451]: field `local_names` of struct `borrow_check::diagnostics::region_errors::ErrorReportingCtx` is private
2019-11-29T17:31:39.2612769Z    --> src/librustc_mir/borrow_check/diagnostics/outlives_suggestion.rs:129:13
2019-11-29T17:31:39.2614551Z 129 |             local_names: self.local_names,
2019-11-29T17:31:39.2614551Z 129 |             local_names: self.local_names,
2019-11-29T17:31:39.2618182Z     |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ field `local_names` is private
2019-11-29T17:31:39.4364634Z error: aborting due to 2 previous errors
2019-11-29T17:31:39.4368300Z 
2019-11-29T17:31:39.4378982Z For more information about this error, try `rustc --explain E0451`.
2019-11-29T17:31:39.5785312Z error: could not compile `rustc_mir`.
---
2019-11-29T17:34:00.3215546Z   local time: Fri Nov 29 17:34:00 UTC 2019
2019-11-29T17:34:00.4750238Z   network time: Fri, 29 Nov 2019 17:34:00 GMT
2019-11-29T17:34:00.4750986Z == end clock drift check ==
2019-11-29T17:34:03.3148608Z 
2019-11-29T17:34:03.3270181Z ##[error]Bash exited with code '1'.
2019-11-29T17:34:03.3302413Z ##[section]Starting: Checkout
2019-11-29T17:34:03.3304756Z ==============================================================================
2019-11-29T17:34:03.3304814Z Task         : Get sources
2019-11-29T17:34:03.3304895Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

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 @TimNN. (Feature Requests)

@mark-i-m
Copy link
Member Author

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

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 29, 2019
@Dylan-DPC-zz Dylan-DPC-zz removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 29, 2019
@mark-i-m
Copy link
Member Author

mark-i-m commented Dec 1, 2019

@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: Blocked on something else such as an RFC or other implementation work. labels Dec 1, 2019
@bors
Copy link
Contributor

bors commented Dec 2, 2019

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

@matthewjasper
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Dec 3, 2019

📌 Commit 64925139b37086265ad4738a54c7a0ccfb5423b2 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 3, 2019
@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 4, 2019
@mark-i-m
Copy link
Member Author

mark-i-m commented Dec 4, 2019

@matthewjasper rebased

@Dylan-DPC-zz
Copy link

@bors r+

@bors
Copy link
Contributor

bors commented Dec 5, 2019

📌 Commit b998e83 has been approved by Dylan-DPC

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Dec 5, 2019
@bors
Copy link
Contributor

bors commented Dec 5, 2019

⌛ Testing commit b998e83 with merge a0312c1...

bors added a commit that referenced this pull request Dec 5, 2019
…-DPC

Reorganize borrow check diagnostic code

Currently borrow checker diagnostics are split across many different modules in different places in the `librustc_mir` crate. This moves them all to a `diagnostics` module. This also reduces the nesting of the modules a bit (sooo much nesting).

I am also thinking of moving stuff out of the `nll` module since we only have one borrow checker now (:tada:), and maybe it even makes sense to split out all of this stuff to a `librustc_borrow_check`, but those are for the future. Feel free to ping me here or on zulip and let me know what you think...

cc @nikomatsakis @matthewjasper @eddyb
@bors
Copy link
Contributor

bors commented Dec 5, 2019

☀️ Test successful - checks-azure
Approved by: Dylan-DPC
Pushing a0312c1 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Dec 5, 2019
@bors bors merged commit b998e83 into rust-lang:master Dec 5, 2019
@mark-i-m mark-i-m deleted the simplify-borrow_check-errors branch December 11, 2019 21:35
bors added a commit that referenced this pull request Dec 12, 2019
Remove the borrow check::nll submodule

NLL is the only borrow checker now, so no need to have a separate submodule.

@rustbot modify labels: +S-blocked

Waiting on #66815
bors added a commit that referenced this pull request Dec 12, 2019
Remove the borrow check::nll submodule

NLL is the only borrow checker now, so no need to have a separate submodule.

@rustbot modify labels: +S-blocked

Waiting on #66815
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.

7 participants