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

Add must_use annotations to Result::is_ok and is_err #59648

Merged
merged 1 commit into from
Apr 15, 2019

Conversation

alex
Copy link
Member

@alex alex commented Apr 2, 2019

Discussed in #59610

@rust-highfive
Copy link
Collaborator

r? @kennytm

(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 Apr 2, 2019
@Centril
Copy link
Contributor

Centril commented Apr 2, 2019

r? @alexcrichton

@rust-highfive rust-highfive assigned alexcrichton and unassigned kennytm Apr 2, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of 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.
travis_time:end:33bdd66e:start=1554246474995518721,finish=1554246550537942024,duration=75542423303
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:22:48] 
[01:22:48] running 9 tests
[01:22:48] iiiiiiiii
[01:22:48] 
[01:22:48]  finished in 0.150
[01:22:48] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:23:04] 
[01:23:04] running 121 tests
[01:23:29] .iiiii...i.....i..i...i..i.i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i. 100/121
[01:23:34] i.i......iii.i.....ii
[01:23:34] 
[01:23:34]  finished in 29.946
[01:23:34] travis_fold:end:test_debuginfo

---
[01:42:57] ............................i.i.....................................iiii........ii.................. 500/998
[01:43:05] .................................................................................................... 600/998
[01:43:13] .................................................................................................... 700/998
[01:43:21] ....................iiii............................................................................ 800/998
[01:43:35] ..........................F......................................................................... 900/998
[01:43:43] failures:
[01:43:43] 
[01:43:43] ---- sync/mpsc/mod.rs - sync::mpsc::SyncSender<T>::try_send (line 989) stdout ----
[01:43:43] ---- sync/mpsc/mod.rs - sync::mpsc::SyncSender<T>::try_send (line 989) stdout ----
[01:43:43] error: unused return value of `std::result::Result::<T, E>::is_err` that must be used
[01:43:43]   --> sync/mpsc/mod.rs:1008:5
[01:43:43]    |
[01:43:43] 22 |     sync_sender2.try_send(3).is_err();
[01:43:43]    |
[01:43:43] note: lint level defined here
[01:43:43]   --> sync/mpsc/mod.rs:987:9
[01:43:43]    |
[01:43:43]    |
[01:43:43] 1  | #![deny(warnings)]
[01:43:43]    |         ^^^^^^^^
[01:43:43]    = note: #[deny(unused_must_use)] implied by #[deny(warnings)]
[01:43:43] error: aborting due to previous error
[01:43:43] 
[01:43:43] thread 'sync/mpsc/mod.rs - sync::mpsc::SyncSender<T>::try_send (line 989)' panicked at 'couldn't compile the test', src/librustdoc/test.rs:310:13
[01:43:43] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---
[01:43:43] 
[01:43:43] error: test failed, to rerun pass '--doc'
[01:43:43] 
[01:43:43] 
[01:43:43] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "panic-unwind backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "std" "--" "--quiet"
[01:43:43] 
[01:43:43] 
[01:43:43] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:43:43] Build completed unsuccessfully in 0:32:29
[01:43:43] Build completed unsuccessfully in 0:32:29
[01:43:43] Makefile:48: recipe for target 'check' failed
[01:43:43] make: *** [check] Error 1
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:195bab52
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Apr  3 00:53:03 UTC 2019

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-6.0 of 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.
travis_time:end:016dcfaf:start=1554252980999365318,finish=1554253056044412847,duration=75045047529
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:24:24] 
[01:24:24] running 9 tests
[01:24:24] iiiiiiiii
[01:24:24] 
[01:24:24]  finished in 0.162
[01:24:24] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:24:41] 
[01:24:41] running 121 tests
[01:25:07] .iiiii...i.....i..i...i..i.i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i. 100/121
[01:25:12] i.i......iii.i.....ii
[01:25:12] 
[01:25:12]  finished in 31.000
[01:25:12] travis_fold:end:test_debuginfo

---
[01:48:23] travis_fold:start:test_stage1-rustc_data_structures
travis_time:start:test_stage1-rustc_data_structures
Testing rustc_data_structures stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:48:23]    Compiling rustc_data_structures v0.0.0 (/checkout/src/librustc_data_structures)
[01:48:28] error: unused return value of `std::result::Result::<T, E>::is_ok` that must be used
[01:48:28]     --> src/librustc_data_structures/owning_ref/mod.rs:1474:13
[01:48:28]      |
[01:48:28] 1474 |             OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok();
[01:48:28]      |
[01:48:28]      = note: `-D unused-must-use` implied by `-D warnings`
[01:48:28] 
[01:48:28] 
[01:48:28] error: unused return value of `std::result::Result::<T, E>::is_err` that must be used
[01:48:28]     --> src/librustc_data_structures/owning_ref/mod.rs:1484:13
[01:48:28]      |
[01:48:28] 1484 |             OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err();
[01:48:28] 
[01:48:28] 
[01:48:28] error: unused return value of `std::result::Result::<T, E>::is_ok` that must be used
[01:48:28]     --> src/librustc_data_structures/owning_ref/mod.rs:1871:13
[01:48:28]      |
[01:48:28] 1871 |             OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_ok();
[01:48:28] 
[01:48:28] 
[01:48:28] error: unused return value of `std::result::Result::<T, E>::is_err` that must be used
[01:48:28]     --> src/librustc_data_structures/owning_ref/mod.rs:1881:13
[01:48:28]      |
[01:48:28] 1881 |             OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_err();
[01:48:28] 
[01:48:28] 
[01:48:28] error: unused return value of `std::result::Result::<T, E>::is_ok` that must be used
[01:48:28]     --> src/librustc_data_structures/owning_ref/mod.rs:1891:13
[01:48:28]      |
[01:48:28] 1891 |             OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok();
[01:48:28] 
[01:48:28] 
[01:48:28] error: unused return value of `std::result::Result::<T, E>::is_err` that must be used
[01:48:28]     --> src/librustc_data_structures/owning_ref/mod.rs:1901:13
[01:48:28]      |
[01:48:28] 1901 |             OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err();
[01:48:28] 
[01:48:28] error: aborting due to 6 previous errors
[01:48:28] 
[01:48:28] error: Could not compile `rustc_data_structures`.
[01:48:28] error: Could not compile `rustc_data_structures`.
[01:48:28] 
[01:48:28] To learn more, run the command again with --verbose.
[01:48:28] 
[01:48:28] 
[01:48:28] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "-p" "rustc_data_structures" "--" "--quiet"
[01:48:28] 
[01:48:28] 
[01:48:28] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:48:28] Build completed unsuccessfully in 0:36:15
[01:48:28] Build completed unsuccessfully in 0:36:15
[01:48:28] make: *** [check] Error 1
[01:48:28] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0ecd3c58
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Wed Apr  3 02:46:14 UTC 2019
---
travis_time:end:21cc9c05:start=1554259576147536937,finish=1554259576154532158,duration=6995221
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:1bd0e83d
$ ln -s . checkout && for CORE in obj/cores/core.*; do EXE=$(echo $CORE | sed 's|obj/cores/core\.[0-9]*\.!checkout!\(.*\)|\1|;y|!|/|'); if [ -f "$EXE" ]; then printf travis_fold":start:crashlog\n\033[31;1m%s\033[0m\n" "$CORE"; gdb --batch -q -c "$CORE" "$EXE" -iex 'set auto-load off' -iex 'dir src/' -iex 'set sysroot .' -ex bt -ex q; echo travis_fold":"end:crashlog; fi; done || true
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:1fd46d6b
travis_time:start:1fd46d6b
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:06915e62
$ dmesg | grep -i kill

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)

@alex
Copy link
Member Author

alex commented Apr 3, 2019

This seems to have caught several cases in some tests, e.g. https://github.com/rust-lang/rust/blob/master/src/librustc_data_structures/owning_ref/mod.rs#L1474

I think that's missing an assert!(), does that sound right?

@scottmcm
Copy link
Member

scottmcm commented Apr 3, 2019

If this is worth it on is_err, wouldn't it also need to be on is_some and such as well?

(Or I wonder if it would make sense to have a special lint for unused is_*?)

@alexcrichton
Copy link
Member

@alex want to fix the issues found on CI?

It seems reasonable to have similar treatment on Option, and I would prefer that we not get too overzealous and try to match all is_* functions automatically

@alex
Copy link
Member Author

alex commented Apr 5, 2019

@alexcrichton Yes, I'd like to! I could use some feedback on the question I asked WRT these tests: https://github.com/rust-lang/rust/blob/master/src/librustc_data_structures/owning_ref/mod.rs#L1467-L1485

try_map1 and try_map2 look identical to me, except one calls is_ok and the other is_err and I'm honestly unclear on what either of them is trying to assert.

@alexcrichton
Copy link
Member

I don't know myself (didn't write those tests) but it seems harmless to either throw in assert! or assert!(!...) depending on what works

@alex
Copy link
Member Author

alex commented Apr 5, 2019

👍 will update to get these tests passing this evening.

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of 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.
travis_time:end:014eb62c:start=1554568903370964474,finish=1554568979359721164,duration=75988756690
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
travis_time:start:test_assembly
Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:15:30] 
[01:15:30] running 9 tests
[01:15:30] iiiiiiiii
[01:15:30] 
[01:15:30]  finished in 0.156
[01:15:30] travis_fold:end:test_assembly

---
travis_time:start:test_debuginfo
Check compiletest suite=debuginfo mode=debuginfo-both (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:15:47] 
[01:15:47] running 121 tests
[01:16:14] .iiiii...i.....i..i...i..i.i.i..i.ii...i.....i..i....i..........iiii..........i...ii...i.......ii.i. 100/121
[01:16:18] i.i......iii.i.....ii
[01:16:18] 
[01:16:18]  finished in 31.314
[01:16:18] travis_fold:end:test_debuginfo

---
[01:40:00]     Finished release [optimized] target(s) in 17.24s
[01:40:00]      Running build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps/rustc_data_structures-f644b6b7e75576ad
[01:40:00] 
[01:40:00] running 141 tests
[01:40:00] .........................................................F..........................F.F............. 100/141
[01:40:00] failures:
[01:40:00] 
[01:40:00] ---- owning_ref::tests::owning_ref::try_map2 stdout ----
[01:40:00] ---- owning_ref::tests::owning_ref::try_map2 stdout ----
[01:40:00] thread 'owning_ref::tests::owning_ref::try_map2' panicked at 'assertion failed: OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err()', src/librustc_data_structures/owning_ref/mod.rs:1484:13
[01:40:00] 
[01:40:00] ---- owning_ref::tests::owning_ref_mut::try_map2 stdout ----
[01:40:00] ---- owning_ref::tests::owning_ref_mut::try_map2 stdout ----
[01:40:00] thread 'owning_ref::tests::owning_ref_mut::try_map2' panicked at 'assertion failed: OwningRefMut::new(y).try_map_mut(|x|
[01:40:00]                                      x.downcast_mut::<i32>().ok_or(())).is_err()', src/librustc_data_structures/owning_ref/mod.rs:1881:13
[01:40:00] ---- owning_ref::tests::owning_ref_mut::try_map4 stdout ----
[01:40:00] ---- owning_ref::tests::owning_ref_mut::try_map4 stdout ----
[01:40:00] thread 'owning_ref::tests::owning_ref_mut::try_map4' panicked at 'assertion failed: OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err()', src/librustc_data_structures/owning_ref/mod.rs:1901:13
[01:40:00] 
[01:40:00] failures:
[01:40:00]     owning_ref::tests::owning_ref::try_map2
[01:40:00]     owning_ref::tests::owning_ref_mut::try_map2
[01:40:00]     owning_ref::tests::owning_ref_mut::try_map2
[01:40:00]     owning_ref::tests::owning_ref_mut::try_map4
[01:40:00] 
[01:40:00] test result: FAILED. 138 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out
[01:40:00] 
[01:40:00] error: test failed, to rerun pass '--lib'
[01:40:00] 
[01:40:00] 
[01:40:00] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" "" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "-p" "rustc_data_structures" "--" "--quiet"
[01:40:00] 
[01:40:00] 
[01:40:00] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:40:00] Build completed unsuccessfully in 0:36:47
[01:40:00] Build completed unsuccessfully in 0:36:47
[01:40:00] make: *** [check] Error 1
[01:40:00] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:28a4aaa8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Sat Apr  6 18:23:08 UTC 2019

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)

@alexcrichton
Copy link
Member

@alex did you want to add similar treatment to is_some and is_none in this PR?

@alex
Copy link
Member Author

alex commented Apr 8, 2019

If you'd prefer it as a part of this PR, I'm happy to.

@alexcrichton
Copy link
Member

Yes since they're so similar in purpose let's go ahead and add them in this PR

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of 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.
travis_time:end:028a9697:start=1554736294062221224,finish=1554736296264206350,duration=2201985126
$ git checkout -qf FETCH_HEAD
travis_fold:end:git.checkout

Encrypted environment variables have been removed for security reasons.
See https://docs.travis-ci.com/user/pull-requests/#pull-requests-and-security-restrictions
$ export SCCACHE_BUCKET=rust-lang-ci-sccache2
$ export SCCACHE_REGION=us-west-1
$ export GCP_CACHE_BUCKET=rust-lang-ci-cache
Setting environment variables from .travis.yml
---
[01:09:26] .................................................................................................... 800/2961
[01:09:36] .................................................................................................... 900/2961
[01:09:51] .................................................................................................... 1000/2961
[01:10:05] .................................................................................................... 1100/2961
[01:10:14] ...............................................................F.................................... 1200/2961
[01:10:36] .................................................................................................... 1400/2961
[01:10:49] .................................................................................................... 1500/2961
[01:10:58] .................................................................................i.................. 1600/2961
[01:11:12] .................................................................................................... 1700/2961
---
[01:14:34] failures:
[01:14:34] 
[01:14:34] ---- [run-pass] run-pass/issues/issue-18353.rs stdout ----
[01:14:34] normalized stderr:
[01:14:34] warning: unused return value of `std::option::Option::<T>::is_some` that must be used
[01:14:34]    |
[01:14:34] LL |     str.is_some();
[01:14:34]    |     ^^^^^^^^^^^^^^
[01:14:34]    |
[01:14:34]    |
[01:14:34]    = note: #[warn(unused_must_use)] on by default
[01:14:34] 
[01:14:34] 
[01:14:34] 
[01:14:34] 
[01:14:34] The actual stderr differed from the expected stderr.
[01:14:34] Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/issues/issue-18353/issue-18353.stderr
[01:14:34] To update references, rerun the tests and pass the `--bless` flag
[01:14:34] To only update this specific test, also pass `--test-args issues/issue-18353.rs`
[01:14:34] error: 1 errors occurred comparing output.
[01:14:34] status: exit code: 0
[01:14:34] status: exit code: 0
[01:14:34] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/run-pass/issues/issue-18353.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/issues/issue-18353/a" "-Crpath" "-O" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass/issues/issue-18353/auxiliary"
[01:14:34] ------------------------------------------
[01:14:34] 
[01:14:34] ------------------------------------------
[01:14:34] stderr:
[01:14:34] stderr:
[01:14:34] ------------------------------------------
[01:14:34] {"message":"unused return value of `std::option::Option::<T>::is_some` that must be used","code":{"code":"unused_must_use","explanation":null},"level":"warning","spans":[{"file_name":"/checkout/src/test/run-pass/issues/issue-18353.rs","byte_start":234,"byte_end":248,"line_start":14,"line_end":14,"column_start":5,"column_end":19,"is_primary":true,"text":[{"text":"    str.is_some();","highlight_start":5,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"#[warn(unused_must_use)] on by default","code":null,"level":"note","spans":[],"children":[],"rendered":null}],"rendered":"warning: unused return value of `std::option::Option::<T>::is_some` that must be used\n  --> /checkout/src/test/run-pass/issues/issue-18353.rs:14:5\n   |\nLL |     str.is_some();\n   |     ^^^^^^^^^^^^^^\n   |\n   = note: #[warn(unused_must_use)] on by default\n\n"}
[01:14:34] ------------------------------------------
[01:14:34] 
[01:14:34] thread '[run-pass] run-pass/issues/issue-18353.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:3425:9
[01:14:34] note: Run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
---
[01:14:34] 
[01:14:34] thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:516:22
[01:14:34] 
[01:14:34] 
[01:14:34] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/run-pass" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-pass" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "run-pass" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:14:34] 
[01:14:34] 
[01:14:34] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:14:34] Build completed unsuccessfully in 0:11:06
[01:14:34] Build completed unsuccessfully in 0:11:06
[01:14:34] make: *** [check] Error 1
[01:14:34] Makefile:48: recipe for target 'check' failed
The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:00f03225
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
Mon Apr  8 16:26:21 UTC 2019
---
travis_time:end:1e3e21b4:start=1554740782698621896,finish=1554740782753960234,duration=55338338
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:09e11d99
$ cat ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
cat: ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers: No such file or directory
travis_fold:end:after_failure.5
travis_fold:start:after_failure.6
travis_time:start:164cc948
$ dmesg | grep -i kill

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)

@alex
Copy link
Member Author

alex commented Apr 8, 2019

Another failing test, again I'm not sure I fully understand what this one is trying to test. I think let _ = ...; is the correct fix?

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Apr 9, 2019
@alexcrichton
Copy link
Member

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Apr 9, 2019

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Apr 9, 2019
@rfcbot rfcbot added the disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. label Apr 9, 2019
@rfcbot
Copy link

rfcbot commented Apr 12, 2019

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Apr 12, 2019
@alexcrichton
Copy link
Member

@bors: r+

@bors
Copy link
Contributor

bors commented Apr 15, 2019

📌 Commit ce5d694 has been approved by alexcrichton

@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 Apr 15, 2019
@@ -178,6 +178,7 @@ impl<T> Option<T> {
/// ```
///
/// [`Some`]: #variant.Some
#[must_use]
Copy link
Member

@RalfJung RalfJung Apr 15, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be a good idea to add a message here (must_use = "msg") explaining that this function has no side-effects, or so?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed! Maybe with a pointer to unwrap or expect if people meant it to be an assertion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this ever get resolved? If not someone should open a pr for it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, there's still no message. Can you open an issue or a PR?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would but I honestly have no clue what to put for the message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@czipperz Well, inspired by https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect, here's a proposal for the text:

  • Result::is_ok: if you intended to assert that this matches Ok(_), consider .unwrap() instead
  • Result::is_err: if you intended to assert that this matches Err(_), consider .unwrap_err() instead
  • Option::is_some: if you intended to assert that this matches Some(_), consider .unwrap() instead
  • Option::is_none: if you intended to assert that this matches None, consider .or_else(|| panic!("called `Option::unwrap()` on a `None` value")) instead

(That last one makes me think of https://internals.rust-lang.org/t/adding-option-expect-none/10481?u=scottmcm...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open a PR based on those messages tonight if someone else doesn't do it first.

@bors
Copy link
Contributor

bors commented Apr 15, 2019

⌛ Testing commit ce5d694 with merge 04247b041cdc0a35151d9232d23ced24341bbb95...

Centril added a commit to Centril/rust that referenced this pull request Apr 15, 2019
Add must_use annotations to Result::is_ok and is_err

Discussed in rust-lang#59610
@Centril
Copy link
Contributor

Centril commented Apr 15, 2019

@bors retry

Yielding in favor of r0llup this is included in.

bors added a commit that referenced this pull request Apr 15, 2019
Rollup of 6 pull requests

Successful merges:

 - #59648 (Add must_use annotations to Result::is_ok and is_err)
 - #59748 (Add summary and reference to Rust trademark guide)
 - #59779 (Uplift `get_def_path` from Clippy)
 - #59955 (bump stdsimd; make intra_doc_link_resolution_failure an error again; make lints more consistent)
 - #59978 (rustdoc: Remove default keyword from re-exported trait methods)
 - #59989 (Fix links to Atomic* in RELEASES.md)

Failed merges:

r? @ghost
@bors bors merged commit ce5d694 into rust-lang:master Apr 15, 2019
@alex alex deleted the must-use-result branch April 15, 2019 19:32
@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Apr 22, 2019
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jul 5, 2019
Pkgsrc changes:
 * NetBSD/sparc64 disabling of "packed" removed ("packed" removed upstream)
 * Adapt src_libstd_build.rs patch, update sed'ing of .cargo-checksum.json

Build verified on NetBSD 8.0/amd64.

Upstream changes:

Version 1.36.0 (2019-07-04)
==========================

Language
--------
- [Non-Lexical Lifetimes are now enabled on the 2015 edition.][59114]
- [The order of traits in trait objects no longer affects the semantics of that
  object.][59445] e.g. `dyn Send + fmt::Debug` is now equivalent to
  `dyn fmt::Debug + Send`, where this was previously not the case.

Libraries
---------
- [`HashMap`'s implementation has been replaced with `hashbrown::HashMap` implem
entation.][58623]
- [`TryFromSliceError` now implements `From<Infallible>`.][60318]
- [`mem::needs_drop` is now available as a const fn.][60364]
- [`alloc::Layout::from_size_align_unchecked` is now available as a const fn.][6
0370]
- [`String` now implements `BorrowMut<str>`.][60404]
- [`io::Cursor` now implements `Default`.][60234]
- [Both `NonNull::{dangling, cast}` are now const fns.][60244]
- [The `alloc` crate is now stable.][59675] `alloc` allows you to use a subset
  of `std` (e.g. `Vec`, `Box`, `Arc`) in `#![no_std]` environments if the
  environment has access to heap memory allocation.
- [`String` now implements `From<&String>`.][59825]
- [You can now pass multiple arguments to the `dbg!` macro.][59826] `dbg!` will
  return a tuple of each argument when there is multiple arguments.
- [`Result::{is_err, is_ok}` are now `#[must_use]` and will produce a warning if
  not used.][59648]

Stabilized APIs
---------------
- [`VecDeque::rotate_left`]
- [`VecDeque::rotate_right`]
- [`Iterator::copied`]
- [`io::IoSlice`]
- [`io::IoSliceMut`]
- [`Read::read_vectored`]
- [`Write::write_vectored`]
- [`str::as_mut_ptr`]
- [`mem::MaybeUninit`]
- [`pointer::align_offset`]
- [`future::Future`]
- [`task::Context`]
- [`task::RawWaker`]
- [`task::RawWakerVTable`]
- [`task::Waker`]
- [`task::Poll`]

Cargo
-----
- [Cargo will now produce an error if you attempt to use the name of a required
dependency as a feature.][cargo/6860]
- [You can now pass the `--offline` flag to run cargo without accessing the netw
ork.][cargo/6934]

You can find further change's in [Cargo's 1.36.0 release notes][cargo-1-36-0].

Clippy
------
There have been numerous additions and fixes to clippy, see [Clippy's 1.36.0 rel
ease notes][clippy-1-36-0] for more details.

Misc
----

Compatibility Notes
-------------------
- [`std::arch::x86::_rdtsc` returns `u64` instead of `i64`][stdsimd/559]
- [`std::arch::x86_64::_mm_shuffle_ps` takes an `i32` instead of `u32` for `mask
`][stdsimd/522]
- With the stabilisation of `mem::MaybeUninit`, `mem::uninitialized` use is no
  longer recommended, and will be deprecated in 1.38.0.

[60318]: rust-lang/rust#60318
[60364]: rust-lang/rust#60364
[60370]: rust-lang/rust#60370
[60404]: rust-lang/rust#60404
[60234]: rust-lang/rust#60234
[60244]: rust-lang/rust#60244
[58623]: rust-lang/rust#58623
[59648]: rust-lang/rust#59648
[59675]: rust-lang/rust#59675
[59825]: rust-lang/rust#59825
[59826]: rust-lang/rust#59826
[59445]: rust-lang/rust#59445
[59114]: rust-lang/rust#59114
[cargo/6860]: rust-lang/cargo#6860
[cargo/6934]: rust-lang/cargo#6934
[`VecDeque::rotate_left`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.rotate_left
[`VecDeque::rotate_right`]: https://doc.rust-lang.org/std/collections/struct.VecDeque.html#method.rotate_right
[`Iterator::copied`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.copied
[`io::IoSlice`]: https://doc.rust-lang.org/std/io/struct.IoSlice.html
[`io::IoSliceMut`]: https://doc.rust-lang.org/std/io/struct.IoSliceMut.html
[`Read::read_vectored`]: https://doc.rust-lang.org/std/io/trait.Read.html#method.read_vectored
[`Write::write_vectored`]: https://doc.rust-lang.org/std/io/trait.Write.html#method.write_vectored
[`str::as_mut_ptr`]: https://doc.rust-lang.org/std/primitive.str.html#method.as_mut_ptr
[`mem::MaybeUninit`]: https://doc.rust-lang.org/std/mem/union.MaybeUninit.html
[`pointer::align_offset`]: https://doc.rust-lang.org/std/primitive.pointer.html#method.align_offset
[`future::Future`]: https://doc.rust-lang.org/std/future/trait.Future.html
[`task::Context`]: https://doc.rust-lang.org/beta/std/task/struct.Context.html
[`task::RawWaker`]: https://doc.rust-lang.org/beta/std/task/struct.RawWaker.html
[`task::RawWakerVTable`]: https://doc.rust-lang.org/beta/std/task/struct.RawWakerVTable.html
[`task::Waker`]: https://doc.rust-lang.org/beta/std/task/struct.Waker.html
[`task::Poll`]: https://doc.rust-lang.org/beta/std/task/enum.Poll.html
[clippy-1-36-0]: https://github.com/rust-lang/rust-clippy/blob/master/CHANGELOG.md#rust-136
[cargo-1-36-0]: https://github.com/rust-lang/cargo/blob/master/CHANGELOG.md#cargo-136-2019-07-04
[stdsimd/522]: rust-lang/stdarch#522
[stdsimd/559]: rust-lang/stdarch#559
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants