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

Rename `bool::then_*` to `bool::to_option_*` and use where appropriate #65195

Merged
merged 8 commits into from Dec 6, 2019

Conversation

@varkor
Copy link
Member

varkor commented Oct 8, 2019

Name change following rust-lang/rfcs#2757. Also try it out throughout the compiler in places I think makes the code more readable.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Oct 8, 2019

r? @zackmdavis

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

@rust-highfive

This comment was marked as outdated.

Copy link
Collaborator

rust-highfive commented Oct 8, 2019

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-10-08T00:17:02.8186437Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-08T00:17:02.8408647Z ##[command]git config gc.auto 0
2019-10-08T00:17:02.8469118Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-08T00:17:02.8516589Z ##[command]git config --get-all http.proxy
2019-10-08T00:17:02.8659794Z ##[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/65195/merge:refs/remotes/pull/65195/merge
---
2019-10-08T00:48:36.1045781Z    Compiling rustc_msan v0.0.0 (/checkout/src/librustc_msan)
2019-10-08T00:48:36.6162532Z    Compiling rustc_lsan v0.0.0 (/checkout/src/librustc_lsan)
2019-10-08T00:48:37.1313275Z    Compiling rustc_tsan v0.0.0 (/checkout/src/librustc_tsan)
2019-10-08T00:48:37.6555244Z    Compiling rustc_asan v0.0.0 (/checkout/src/librustc_asan)
2019-10-08T00:48:43.6852367Z error: internal compiler error: src/librustc/session/mod.rs:812: trying to get session directory from `IncrCompSession`: NotInitialized
2019-10-08T00:48:43.6862727Z thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:917:9
2019-10-08T00:48:43.6868224Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-08T00:48:43.6871326Z 
2019-10-08T00:48:43.6876412Z note: the compiler unexpectedly panicked. this is a bug.
2019-10-08T00:48:43.6876412Z note: the compiler unexpectedly panicked. this is a bug.
2019-10-08T00:48:43.6881338Z 
2019-10-08T00:48:43.6886631Z note: we would appreciate a bug report: ***/blob/master/CONTRIBUTING.md#bug-reports
2019-10-08T00:48:43.6895043Z note: rustc 1.40.0-dev running on x86_64-unknown-linux-gnu
2019-10-08T00:48:43.6898234Z 
2019-10-08T00:48:43.6898234Z 
2019-10-08T00:48:43.6903558Z note: compiler flags: -Z external-macro-backtrace -Z binary-dep-depinfo -Z force-unstable-if-unmarked -C opt-level=2 -C codegen-units=1 -C debuginfo=0 -C link-args=-Wl,-rpath,$ORIGIN/../lib -C prefer-dynamic -C debug-assertions=n --crate-type lib
2019-10-08T00:48:43.6904352Z note: some of the compiler flags provided by cargo are hidden
2019-10-08T00:48:43.6904482Z 
2019-10-08T00:48:43.9262446Z error: aborting due to previous error
2019-10-08T00:48:43.9268064Z 
---
2019-10-08T00:48:45.0498152Z == clock drift check ==
2019-10-08T00:48:45.0498221Z   local time: Tue Oct  8 00:48:44 UTC 2019
2019-10-08T00:48:45.0498271Z   network time: Tue, 08 Oct 2019 00:48:44 GMT
2019-10-08T00:48:45.0498318Z == end clock drift check ==
2019-10-08T00:48:46.2078540Z ##[error]Bash exited with code '1'.
2019-10-08T00:48:46.2127476Z ##[section]Starting: Checkout
2019-10-08T00:48:46.2129482Z ==============================================================================
2019-10-08T00:48:46.2129537Z Task         : Get sources
2019-10-08T00:48:46.2129600Z 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)

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Oct 8, 2019

I think in some places you use .to_option where .to_option_with should be used instead (e.g. in allocating or side-effecting situations).

@rust-highfive

This comment was marked as resolved.

Copy link
Collaborator

rust-highfive commented Oct 8, 2019

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-10-08T22:11:21.6302307Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-08T22:11:21.6516655Z ##[command]git config gc.auto 0
2019-10-08T22:11:21.6608751Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-08T22:11:22.5077054Z ##[command]git config --get-all http.proxy
2019-10-08T22:11:22.5084072Z ##[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/65195/merge:refs/remotes/pull/65195/merge
---
2019-10-08T23:15:49.1532476Z .................................................................................................... 1600/9127
2019-10-08T23:15:57.2519716Z .................................................................................................... 1700/9127
2019-10-08T23:16:08.5088780Z ................i...............i................................................................... 1800/9127
2019-10-08T23:16:16.0442876Z .................................................................................................... 1900/9127
2019-10-08T23:16:33.2801646Z .......iiiii........................................................................................ 2000/9127
2019-10-08T23:16:43.5866964Z .................................................................................................... 2200/9127
2019-10-08T23:16:46.4215841Z .................................................................................................... 2300/9127
2019-10-08T23:16:52.5126877Z .................................................................................................... 2400/9127
2019-10-08T23:16:58.9539209Z .................................................................................................... 2500/9127
---
2019-10-08T23:19:59.3070616Z ................................................................................................i... 4700/9127
2019-10-08T23:20:06.9240692Z ............i....................................................................................... 4800/9127
2019-10-08T23:20:18.5805515Z .................................................................................................... 4900/9127
2019-10-08T23:20:24.4264228Z .................................................................................................... 5000/9127
2019-10-08T23:20:36.7631379Z ..........................................................................................ii.ii..... 5100/9127
2019-10-08T23:20:47.0053280Z .................................................................................................... 5300/9127
2019-10-08T23:20:57.0347302Z .................................................................................................... 5400/9127
2019-10-08T23:21:04.4873504Z ........................................................i........................................... 5500/9127
2019-10-08T23:21:11.7870194Z .................................................................................................... 5600/9127
2019-10-08T23:21:11.7870194Z .................................................................................................... 5600/9127
2019-10-08T23:21:20.4164575Z .................................................................................................... 5700/9127
2019-10-08T23:21:31.9161294Z .....................................................ii...i..ii...........i......................... 5800/9127
2019-10-08T23:21:58.4860193Z .................................................................................................... 6000/9127
2019-10-08T23:22:08.2569956Z .................................................................................................... 6100/9127
2019-10-08T23:22:08.2569956Z .................................................................................................... 6100/9127
2019-10-08T23:22:18.5142677Z ...........................................................i..ii.................................... 6200/9127
2019-10-08T23:22:47.7579371Z .................................................................................................... 6400/9127
2019-10-08T23:22:49.9956574Z ...................i................................................................................ 6500/9127
2019-10-08T23:22:52.3587508Z ............................................................................................i....... 6600/9127
2019-10-08T23:22:55.3602005Z .................................................................................................... 6700/9127
---
2019-10-08T23:27:44.8527736Z  finished in 5.712
2019-10-08T23:27:44.8528397Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:27:44.8528487Z 
2019-10-08T23:27:44.8528538Z running 150 tests
2019-10-08T23:27:48.8433048Z i....iii......iii..iiii....i.............................i..i..................i....i.........ii.i.i 100/150
2019-10-08T23:27:50.2232344Z ..iiii..............i.........iii.i.......ii......
2019-10-08T23:27:50.2232872Z 
2019-10-08T23:27:50.2236352Z  finished in 5.785
2019-10-08T23:27:50.2444740Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:27:50.4263934Z 
---
2019-10-08T23:27:52.6187064Z  finished in 2.374
2019-10-08T23:27:52.6384306Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:27:52.7996888Z 
2019-10-08T23:27:52.7997140Z running 9 tests
2019-10-08T23:27:52.8001512Z iiiiiiiii
2019-10-08T23:27:52.8002131Z 
2019-10-08T23:27:52.8005933Z  finished in 0.161
2019-10-08T23:27:52.8209908Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:27:53.0015041Z 
---
2019-10-08T23:28:11.9186560Z  finished in 19.097
2019-10-08T23:28:11.9396673Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:28:12.1073599Z 
2019-10-08T23:28:12.1073883Z running 123 tests
2019-10-08T23:28:38.2090828Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-10-08T23:28:43.3383563Z i.i.i......iii.i.....ii
2019-10-08T23:28:43.3384069Z 
2019-10-08T23:28:43.3388331Z  finished in 31.399
2019-10-08T23:28:43.3399853Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:28:43.3400312Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-10-08T23:41:27.9608390Z 
2019-10-08T23:41:27.9680961Z  finished in 135.192
2019-10-08T23:41:27.9697970Z Testing core stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-08T23:41:28.1446167Z    Compiling core v0.0.0 (/checkout/src/libcore)
2019-10-08T23:41:32.1674838Z error[E0599]: no method named `then` found for type `bool` in the current scope
2019-10-08T23:41:32.1677536Z  --> src/libcore/../libcore/tests/bool.rs:3:22
2019-10-08T23:41:32.1678260Z   |
2019-10-08T23:41:32.1678803Z 3 |     assert_eq!(false.then(0), None);
2019-10-08T23:41:32.1679388Z   |                      ^^^^ method not found in `bool`
2019-10-08T23:41:32.1679618Z 
2019-10-08T23:41:32.1696197Z error[E0599]: no method named `then` found for type `bool` in the current scope
2019-10-08T23:41:32.1696938Z  --> src/libcore/../libcore/tests/bool.rs:4:21
2019-10-08T23:41:32.1697432Z   |
2019-10-08T23:41:32.1697985Z 4 |     assert_eq!(true.then(0), Some(0));
2019-10-08T23:41:32.1698598Z   |                     ^^^^ method not found in `bool`
2019-10-08T23:41:32.1712156Z error[E0599]: no method named `then_with` found for type `bool` in the current scope
2019-10-08T23:41:32.1712895Z  --> src/libcore/../libcore/tests/bool.rs:5:22
2019-10-08T23:41:32.1713387Z   |
2019-10-08T23:41:32.1713387Z   |
2019-10-08T23:41:32.1713946Z 5 |     assert_eq!(false.then_with(|| 0), None);
2019-10-08T23:41:32.1714529Z   |                      ^^^^^^^^^ method not found in `bool`
2019-10-08T23:41:32.1730064Z error[E0599]: no method named `then_with` found for type `bool` in the current scope
2019-10-08T23:41:32.1730831Z  --> src/libcore/../libcore/tests/bool.rs:6:21
2019-10-08T23:41:32.1731327Z   |
2019-10-08T23:41:32.1731327Z   |
2019-10-08T23:41:32.1731921Z 6 |     assert_eq!(true.then_with(|| 0), Some(0));
2019-10-08T23:41:32.1732499Z   |                     ^^^^^^^^^ method not found in `bool`
2019-10-08T23:41:40.5642690Z error: aborting due to 4 previous errors
2019-10-08T23:41:40.5643805Z 
2019-10-08T23:41:40.5644492Z For more information about this error, try `rustc --explain E0599`.
2019-10-08T23:41:40.7027885Z error: could not compile `core`.
2019-10-08T23:41:40.7027885Z error: could not compile `core`.
2019-10-08T23:41:40.7028607Z 
2019-10-08T23:41:40.7029143Z To learn more, run the command again with --verbose.
2019-10-08T23:41:40.7041067Z 
2019-10-08T23:41:40.7041230Z 
2019-10-08T23:41:40.7042238Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "-Zconfig-profile" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "2" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace compiler-builtins-c" "--manifest-path" "/checkout/src/libtest/Cargo.toml" "-p" "core" "--" "--quiet"
2019-10-08T23:41:40.7042883Z 
2019-10-08T23:41:40.7043468Z 
2019-10-08T23:41:40.7055391Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-08T23:41:40.7055714Z Build completed unsuccessfully in 1:22:57
2019-10-08T23:41:40.7055714Z Build completed unsuccessfully in 1:22:57
2019-10-08T23:41:40.7116242Z == clock drift check ==
2019-10-08T23:41:40.7135083Z   local time: Tue Oct  8 23:41:40 UTC 2019
2019-10-08T23:41:40.8688500Z   network time: Tue, 08 Oct 2019 23:41:40 GMT
2019-10-08T23:41:40.8688960Z == end clock drift check ==
2019-10-08T23:41:41.4713275Z ##[error]Bash exited with code '1'.
2019-10-08T23:41:41.4764108Z ##[section]Starting: Checkout
2019-10-08T23:41:41.4766261Z ==============================================================================
2019-10-08T23:41:41.4766340Z Task         : Get sources
2019-10-08T23:41:41.4766393Z 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

This comment was marked as outdated.

Copy link
Contributor

bors commented Oct 9, 2019

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

@varkor varkor force-pushed the varkor:to_option branch from ebb3e8a to 673eef7 Oct 9, 2019
src/librustc/mir/mod.rs Outdated Show resolved Hide resolved
src/librustc/session/mod.rs Outdated Show resolved Hide resolved
@bors

This comment was marked as outdated.

Copy link
Contributor

bors commented Oct 15, 2019

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

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Oct 20, 2019

@zackmdavis seems busy. r? @Centril

@rust-highfive rust-highfive assigned Centril and unassigned zackmdavis Oct 20, 2019
src/libtest/lib.rs Outdated Show resolved Hide resolved
src/libtest/lib.rs Outdated Show resolved Hide resolved
src/librustc_typeck/check/upvar.rs Outdated Show resolved Hide resolved
} else {
None
}
valid_unit.to_option(Uniform { unit, total: arg.layout.size })

This comment has been minimized.

Copy link
@Centril

Centril Oct 20, 2019

Member

I've seen the same logic (up to RegKind::Vector =>) 4 times now so it might be worth de-duplicating that with a function somewhere.

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Oct 20, 2019

Let's just make sure perf doesn't regress anywhere.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Oct 20, 2019

Awaiting bors try build completion

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 20, 2019

⌛️ Trying commit 429435c with merge d998a73...

bors added a commit that referenced this pull request Oct 20, 2019
Rename `bool::then_*` to `bool::to_option_*` and use where appropriate

Name change following rust-lang/rfcs#2757. Also try it out throughout the compiler in places I think makes the code more readable.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 20, 2019

☀️ Try build successful - checks-azure
Build commit: d998a73 (d998a738b8b303e27c108bc939c3765df487a753)

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Oct 20, 2019

Queued d998a73 with parent 857a55b, future comparison URL.

@rust-timer

This comment has been minimized.

Copy link

rust-timer commented Oct 21, 2019

Finished benchmarking try commit d998a73, comparison URL.

@varkor

This comment has been minimized.

Copy link
Member Author

varkor commented Oct 21, 2019

This is blocked on the discussion in rust-lang/rfcs#2757.

@Centril

This comment has been minimized.

Copy link
Member

Centril commented Dec 3, 2019

@varkor Can you please implement @dtolnay's comment in rust-lang/rfcs#2757 (comment)?

@varkor varkor force-pushed the varkor:to_option branch from 27f7eeb to f1db60c Dec 6, 2019
@Centril

This comment has been minimized.

Copy link
Member

Centril commented Dec 6, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 6, 2019

📌 Commit f1db60c has been approved by Centril

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 6, 2019

⌛️ Testing commit f1db60c with merge ae1b871...

bors added a commit that referenced this pull request Dec 6, 2019
Rename `bool::then_*` to `bool::to_option_*` and use where appropriate

Name change following rust-lang/rfcs#2757. Also try it out throughout the compiler in places I think makes the code more readable.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Dec 6, 2019

☀️ Test successful - checks-azure
Approved by: Centril
Pushing ae1b871 to master...

@bors bors added the merged-by-bors label Dec 6, 2019
@bors bors merged commit f1db60c into rust-lang:master Dec 6, 2019
5 checks passed
5 checks passed
homu Test successful
Details
pr #20191206.20 succeeded
Details
pr (Linux mingw-check) Linux mingw-check succeeded
Details
pr (Linux x86_64-gnu-llvm-7) Linux x86_64-gnu-llvm-7 succeeded
Details
pr (Linux x86_64-gnu-tools) Linux x86_64-gnu-tools succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.