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

Region naming refactoring [6/N] #67476

Merged
merged 8 commits into from
Jan 18, 2020
Merged

Conversation

mark-i-m
Copy link
Member

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

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 🎉

Some samples:

-                        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);
-            .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

@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

This comment has been minimized.

@rustbot rustbot added S-blocked Status: Marked as 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 Dec 21, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-21T06:23:23.1513587Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-21T06:23:23.1530688Z ##[command]git config gc.auto 0
2019-12-21T06:23:23.1536605Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-21T06:23:23.1540298Z ##[command]git config --get-all http.proxy
2019-12-21T06:23:23.1544922Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-21T06:29:44.9742341Z    Compiling serde_json v1.0.40
2019-12-21T06:29:46.8303004Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-21T06:29:57.9341604Z     Finished release [optimized] target(s) in 1m 30s
2019-12-21T06:29:57.9450107Z tidy check
2019-12-21T06:29:58.9305457Z tidy error: /checkout/src/librustc_mir/borrow_check/mod.rs:1595: TODO is deprecated; use FIXME
2019-12-21T06:29:58.9394990Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_name.rs:178: TODO is deprecated; use FIXME
2019-12-21T06:29:58.9430374Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:753: TODO is deprecated; use FIXME
2019-12-21T06:30:00.7725483Z some tidy checks failed
2019-12-21T06:30:00.7725597Z Found 485 error codes
2019-12-21T06:30:00.7725652Z Found 0 error codes with no tests
2019-12-21T06:30:00.7725747Z Done!
2019-12-21T06:30:00.7725747Z Done!
2019-12-21T06:30:00.7733164Z 
2019-12-21T06:30:00.7737650Z 
2019-12-21T06:30:00.7740998Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-21T06:30:00.7744925Z 
2019-12-21T06:30:00.7744957Z 
2019-12-21T06:30:00.7751445Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-21T06:30:00.7751514Z Build completed unsuccessfully in 0:01:34
2019-12-21T06:30:00.7751514Z Build completed unsuccessfully in 0:01:34
2019-12-21T06:30:00.7798635Z == clock drift check ==
2019-12-21T06:30:00.7837714Z   local time: Sat Dec 21 06:30:00 UTC 2019
2019-12-21T06:30:01.0749886Z   network time: Sat, 21 Dec 2019 06:30:01 GMT
2019-12-21T06:30:01.0750018Z == end clock drift check ==
2019-12-21T06:30:02.5243032Z 
2019-12-21T06:30:02.5373863Z ##[error]Bash exited with code '1'.
2019-12-21T06:30:02.5413252Z ##[section]Starting: Checkout
2019-12-21T06:30:02.5415361Z ==============================================================================
2019-12-21T06:30:02.5415423Z Task         : Get sources
2019-12-21T06:30:02.5415477Z 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)

@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 Dec 21, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-21T22:06:51.8243112Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-21T22:06:51.8475870Z ##[command]git config gc.auto 0
2019-12-21T22:06:51.8556135Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-21T22:06:51.8609587Z ##[command]git config --get-all http.proxy
2019-12-21T22:06:51.8779702Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-21T22:12:42.3602521Z    Compiling serde_json v1.0.40
2019-12-21T22:12:44.0514068Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-21T22:12:55.3490920Z     Finished release [optimized] target(s) in 1m 29s
2019-12-21T22:12:55.3600689Z tidy check
2019-12-21T22:12:56.2763869Z tidy error: /checkout/src/librustc_mir/borrow_check/mod.rs:1595: TODO is deprecated; use FIXME
2019-12-21T22:12:56.2850115Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_name.rs:178: TODO is deprecated; use FIXME
2019-12-21T22:12:56.2877761Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:758: TODO is deprecated; use FIXME
2019-12-21T22:12:58.0726423Z some tidy checks failed
2019-12-21T22:12:58.0727603Z Found 485 error codes
2019-12-21T22:12:58.0727931Z Found 0 error codes with no tests
2019-12-21T22:12:58.0728178Z Done!
2019-12-21T22:12:58.0728178Z Done!
2019-12-21T22:12:58.0734523Z 
2019-12-21T22:12:58.0734877Z 
2019-12-21T22:12:58.0736210Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-21T22:12:58.0736457Z 
2019-12-21T22:12:58.0741585Z 
2019-12-21T22:12:58.0742138Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-21T22:12:58.0742517Z Build completed unsuccessfully in 0:01:33
2019-12-21T22:12:58.0742517Z Build completed unsuccessfully in 0:01:33
2019-12-21T22:12:58.0804941Z == clock drift check ==
2019-12-21T22:12:58.0812282Z   local time: Sat Dec 21 22:12:58 UTC 2019
2019-12-21T22:12:58.2347134Z   network time: Sat, 21 Dec 2019 22:12:58 GMT
2019-12-21T22:12:58.2350390Z == end clock drift check ==
2019-12-21T22:12:59.9709110Z 
2019-12-21T22:12:59.9819200Z ##[error]Bash exited with code '1'.
2019-12-21T22:12:59.9847041Z ##[section]Starting: Checkout
2019-12-21T22:12:59.9848656Z ==============================================================================
2019-12-21T22:12:59.9848705Z Task         : Get sources
2019-12-21T22:12:59.9848745Z 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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-22T23:41:03.4517466Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-22T23:41:04.2414678Z ##[command]git config gc.auto 0
2019-12-22T23:41:04.2418642Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-22T23:41:04.2420885Z ##[command]git config --get-all http.proxy
2019-12-22T23:41:04.2425236Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-22T23:46:54.2317602Z    Compiling serde_json v1.0.40
2019-12-22T23:46:56.1524885Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-22T23:47:06.7362935Z     Finished release [optimized] target(s) in 1m 24s
2019-12-22T23:47:06.7458352Z tidy check
2019-12-22T23:47:07.6338476Z tidy error: /checkout/src/librustc_mir/borrow_check/mod.rs:1595: TODO is deprecated; use FIXME
2019-12-22T23:47:07.6420496Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_name.rs:178: TODO is deprecated; use FIXME
2019-12-22T23:47:07.6447453Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:758: TODO is deprecated; use FIXME
2019-12-22T23:47:09.3877662Z some tidy checks failed
2019-12-22T23:47:09.3883507Z Found 485 error codes
2019-12-22T23:47:09.3883587Z Found 0 error codes with no tests
2019-12-22T23:47:09.3893321Z Done!
2019-12-22T23:47:09.3893321Z Done!
2019-12-22T23:47:09.3893670Z 
2019-12-22T23:47:09.3893871Z 
2019-12-22T23:47:09.3895339Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-22T23:47:09.3895745Z 
2019-12-22T23:47:09.3895885Z 
2019-12-22T23:47:09.3896088Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-22T23:47:09.3896237Z Build completed unsuccessfully in 0:01:28
2019-12-22T23:47:09.3896237Z Build completed unsuccessfully in 0:01:28
2019-12-22T23:47:09.3947378Z == clock drift check ==
2019-12-22T23:47:09.3953398Z   local time: Sun Dec 22 23:47:09 UTC 2019
2019-12-22T23:47:09.6745582Z   network time: Sun, 22 Dec 2019 23:47:09 GMT
2019-12-22T23:47:09.6753463Z == end clock drift check ==
2019-12-22T23:47:11.0908765Z 
2019-12-22T23:47:11.1016094Z ##[error]Bash exited with code '1'.
2019-12-22T23:47:11.1046279Z ##[section]Starting: Checkout
2019-12-22T23:47:11.1047799Z ==============================================================================
2019-12-22T23:47:11.1047869Z Task         : Get sources
2019-12-22T23:47:11.1047909Z 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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-23T00:32:17.7098535Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-23T00:32:17.7115390Z ##[command]git config gc.auto 0
2019-12-23T00:32:17.7117866Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-23T00:32:17.7119986Z ##[command]git config --get-all http.proxy
2019-12-23T00:32:17.7122580Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-23T00:37:48.6215144Z    Compiling serde_json v1.0.40
2019-12-23T00:37:50.1254132Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-23T00:38:00.2686871Z     Finished release [optimized] target(s) in 1m 20s
2019-12-23T00:38:00.2787687Z tidy check
2019-12-23T00:38:01.1196528Z tidy error: /checkout/src/librustc_mir/borrow_check/mod.rs:1595: TODO is deprecated; use FIXME
2019-12-23T00:38:01.1270272Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_name.rs:164: TODO is deprecated; use FIXME
2019-12-23T00:38:01.1294803Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:778: TODO is deprecated; use FIXME
2019-12-23T00:38:02.7195230Z some tidy checks failed
2019-12-23T00:38:02.7195379Z Found 485 error codes
2019-12-23T00:38:02.7195434Z Found 0 error codes with no tests
2019-12-23T00:38:02.7200776Z Done!
2019-12-23T00:38:02.7200776Z Done!
2019-12-23T00:38:02.7201083Z 
2019-12-23T00:38:02.7201246Z 
2019-12-23T00:38:02.7212162Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-23T00:38:02.7218007Z 
2019-12-23T00:38:02.7218304Z 
2019-12-23T00:38:02.7218613Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-23T00:38:02.7228551Z Build completed unsuccessfully in 0:01:23
2019-12-23T00:38:02.7228551Z Build completed unsuccessfully in 0:01:23
2019-12-23T00:38:02.7289833Z == clock drift check ==
2019-12-23T00:38:02.7294923Z   local time: Mon Dec 23 00:38:02 UTC 2019
2019-12-23T00:38:02.8698146Z   network time: Mon, 23 Dec 2019 00:38:02 GMT
2019-12-23T00:38:02.8700381Z == end clock drift check ==
2019-12-23T00:38:04.1434036Z 
2019-12-23T00:38:04.1542947Z ##[error]Bash exited with code '1'.
2019-12-23T00:38:04.1567042Z ##[section]Starting: Checkout
2019-12-23T00:38:04.1568576Z ==============================================================================
2019-12-23T00:38:04.1568644Z Task         : Get sources
2019-12-23T00:38:04.1568688Z 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)

@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.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-23T07:30:25.6618274Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-23T07:30:25.6839403Z ##[command]git config gc.auto 0
2019-12-23T07:30:25.6914504Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-23T07:30:25.6994659Z ##[command]git config --get-all http.proxy
2019-12-23T07:30:25.7170810Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-23T07:36:30.5496111Z    Compiling serde_json v1.0.40
2019-12-23T07:36:32.2463326Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-23T07:36:42.9173911Z     Finished release [optimized] target(s) in 1m 24s
2019-12-23T07:36:42.9263613Z tidy check
2019-12-23T07:36:43.7902125Z tidy error: /checkout/src/librustc_mir/borrow_check/mod.rs:1483: TODO is deprecated; use FIXME
2019-12-23T07:36:43.7972426Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_name.rs:164: TODO is deprecated; use FIXME
2019-12-23T07:36:43.8004555Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:778: TODO is deprecated; use FIXME
2019-12-23T07:36:45.5280882Z some tidy checks failed
2019-12-23T07:36:45.5283118Z Found 485 error codes
2019-12-23T07:36:45.5283354Z Found 0 error codes with no tests
2019-12-23T07:36:45.5283539Z Done!
2019-12-23T07:36:45.5283539Z Done!
2019-12-23T07:36:45.5283682Z 
2019-12-23T07:36:45.5283813Z 
2019-12-23T07:36:45.5284936Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-23T07:36:45.5285482Z 
2019-12-23T07:36:45.5285636Z 
2019-12-23T07:36:45.5290954Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-23T07:36:45.5291265Z Build completed unsuccessfully in 0:01:35
2019-12-23T07:36:45.5291265Z Build completed unsuccessfully in 0:01:35
2019-12-23T07:36:45.5346646Z == clock drift check ==
2019-12-23T07:36:45.5358298Z   local time: Mon Dec 23 07:36:45 UTC 2019
2019-12-23T07:36:45.8145405Z   network time: Mon, 23 Dec 2019 07:36:45 GMT
2019-12-23T07:36:45.8150675Z == end clock drift check ==
2019-12-23T07:36:47.3118751Z 
2019-12-23T07:36:47.3223555Z ##[error]Bash exited with code '1'.
2019-12-23T07:36:47.3251754Z ##[section]Starting: Checkout
2019-12-23T07:36:47.3253417Z ==============================================================================
2019-12-23T07:36:47.3253469Z Task         : Get sources
2019-12-23T07:36:47.3253529Z 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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-28T16:43:38.3266804Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-28T16:43:39.0508640Z ##[command]git config gc.auto 0
2019-12-28T16:43:39.0514432Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-28T16:43:39.0529823Z ##[command]git config --get-all http.proxy
2019-12-28T16:43:39.0534806Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-28T16:49:46.2881736Z    Compiling serde_json v1.0.40
2019-12-28T16:49:47.8083703Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-28T16:49:57.5711275Z     Finished release [optimized] target(s) in 1m 18s
2019-12-28T16:49:57.5805159Z tidy check
2019-12-28T16:49:58.3877548Z tidy error: /checkout/src/librustc_mir/borrow_check/mod.rs:1483: TODO is deprecated; use FIXME
2019-12-28T16:49:58.3939098Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_name.rs:164: TODO is deprecated; use FIXME
2019-12-28T16:49:58.3959462Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:778: TODO is deprecated; use FIXME
2019-12-28T16:50:00.0985038Z Found 486 error codes
2019-12-28T16:50:00.0985297Z Found 0 error codes with no tests
2019-12-28T16:50:00.0985333Z Done!
2019-12-28T16:50:00.0985412Z some tidy checks failed
2019-12-28T16:50:00.0985412Z some tidy checks failed
2019-12-28T16:50:00.0994092Z 
2019-12-28T16:50:00.0994591Z 
2019-12-28T16:50:00.0996095Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-28T16:50:00.0996433Z 
2019-12-28T16:50:00.0996546Z 
2019-12-28T16:50:00.0996666Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-28T16:50:00.0996782Z Build completed unsuccessfully in 0:01:28
2019-12-28T16:50:00.0996782Z Build completed unsuccessfully in 0:01:28
2019-12-28T16:50:00.1050548Z == clock drift check ==
2019-12-28T16:50:00.1059279Z   local time: Sat Dec 28 16:50:00 UTC 2019
2019-12-28T16:50:01.1637271Z   network time: Sat, 28 Dec 2019 16:50:00 GMT
2019-12-28T16:50:01.1637927Z == end clock drift check ==
2019-12-28T16:50:01.6155701Z 
2019-12-28T16:50:01.6221843Z ##[error]Bash exited with code '1'.
2019-12-28T16:50:01.6248700Z ##[section]Starting: Checkout
2019-12-28T16:50:01.6250999Z ==============================================================================
2019-12-28T16:50:01.6251077Z Task         : Get sources
2019-12-28T16:50:01.6251127Z 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)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-7 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-12-29T02:03:02.4895743Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-12-29T02:03:02.4919745Z ##[command]git config gc.auto 0
2019-12-29T02:03:02.4922632Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-12-29T02:03:02.4927077Z ##[command]git config --get-all http.proxy
2019-12-29T02:03:02.4930161Z ##[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/67476/merge:refs/remotes/pull/67476/merge
---
2019-12-29T02:09:03.4655917Z    Compiling serde_json v1.0.40
2019-12-29T02:09:04.9887093Z    Compiling tidy v0.1.0 (/checkout/src/tools/tidy)
2019-12-29T02:09:14.9761465Z     Finished release [optimized] target(s) in 1m 19s
2019-12-29T02:09:14.9854090Z tidy check
2019-12-29T02:09:15.8375689Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/explain_borrow.rs:231: TODO is deprecated; use FIXME
2019-12-29T02:09:15.8385176Z tidy error: /checkout/src/librustc_mir/borrow_check/diagnostics/region_errors.rs:154: TODO is deprecated; use FIXME
2019-12-29T02:09:17.4896376Z Found 486 error codes
2019-12-29T02:09:17.4897074Z Found 0 error codes with no tests
2019-12-29T02:09:17.4897175Z Done!
2019-12-29T02:09:17.4897242Z some tidy checks failed
2019-12-29T02:09:17.4897242Z some tidy checks failed
2019-12-29T02:09:17.4897300Z 
2019-12-29T02:09:17.4897494Z 
2019-12-29T02:09:17.4898480Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/tidy" "/checkout/src" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "--no-vendor"
2019-12-29T02:09:17.4898676Z 
2019-12-29T02:09:17.4898714Z 
2019-12-29T02:09:17.4915585Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test src/tools/tidy
2019-12-29T02:09:17.4915674Z Build completed unsuccessfully in 0:01:29
2019-12-29T02:09:17.4915674Z Build completed unsuccessfully in 0:01:29
2019-12-29T02:09:17.4975498Z == clock drift check ==
2019-12-29T02:09:17.5006224Z   local time: Sun Dec 29 02:09:17 UTC 2019
2019-12-29T02:09:18.0212535Z   network time: Sun, 29 Dec 2019 02:09:18 GMT
2019-12-29T02:09:18.0212642Z == end clock drift check ==
2019-12-29T02:09:19.6162274Z 
2019-12-29T02:09:19.6265354Z ##[error]Bash exited with code '1'.
2019-12-29T02:09:19.6319119Z ##[section]Starting: Checkout
2019-12-29T02:09:19.6320694Z ==============================================================================
2019-12-29T02:09:19.6320763Z Task         : Get sources
2019-12-29T02:09:19.6320807Z 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 mark-i-m marked this pull request as ready for review December 29, 2019 03:34
@mark-i-m
Copy link
Member Author

mark-i-m commented Dec 29, 2019

@matthewjasper @eddyb Ok, this looks ready for review, though it is still waiting for the previous PR to merge.

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 🎉

EDIT: also copied this ^^ to the OP...

@mark-i-m
Copy link
Member Author

Oh, forgot to mention: I realize this is a big PR, and I can think of at least 3 smaller PRs that this could be split into if you would like (though I would prefer to get it over with :P)

@mark-i-m mark-i-m changed the title Region naming refactoring Region naming refactoring [6/N] Dec 29, 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 mark-i-m force-pushed the simplify-borrow_check-5 branch 2 times, most recently from f8ae596 to b5a6656 Compare December 30, 2019 20:01
@mark-i-m
Copy link
Member Author

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

@rustbot rustbot removed the S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. label Dec 30, 2019
@matthewjasper matthewjasper 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 8, 2020
@mark-i-m
Copy link
Member Author

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 15, 2020
@eddyb
Copy link
Member

eddyb commented Jan 16, 2020

The diffs in the PR description make me very confused as to why this wasn't done from the start.
cc @nikomatsakis just in case there's a reasoning behind it

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.

@bors r+

@matthewjasper
Copy link
Contributor

Is bors not looking at reviews? @bors r+

@bors
Copy link
Contributor

bors commented Jan 17, 2020

📌 Commit f05e40e 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 Jan 17, 2020
@bors
Copy link
Contributor

bors commented Jan 17, 2020

⌛ Testing commit f05e40e with merge d8dcb63...

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
@nikomatsakis
Copy link
Contributor

I didn't read too closely, but sounds great! ❤️

@bors
Copy link
Contributor

bors commented Jan 18, 2020

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 18, 2020
@bors bors merged commit f05e40e into rust-lang:master Jan 18, 2020
@mark-i-m mark-i-m deleted the simplify-borrow_check-5 branch March 6, 2020 23:58
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.

9 participants