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

stabilize #[must_use] for functions and must-use comparison operators (RFC 1940) #48925

Merged
merged 2 commits into from
May 1, 2018

Conversation

zackmdavis
Copy link
Member

@nikomatsakis
Copy link
Contributor

@nikomatsakis nikomatsakis added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 12, 2018
@bors
Copy link
Contributor

bors commented Mar 15, 2018

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

@pietroalbini pietroalbini added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Mar 26, 2018
@shepmaster shepmaster added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Apr 7, 2018
@nikomatsakis nikomatsakis added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Apr 23, 2018
@nikomatsakis
Copy link
Contributor

No longer blocked. Needs rebase though, ping @zackmdavis =)

@nikomatsakis nikomatsakis 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 Apr 23, 2018
@zackmdavis
Copy link
Member Author

Wednesday

@zackmdavis
Copy link
Member Author

(rebased on unmerged PR #50149, which this would collide with conditional on #50149 being approved)

@zackmdavis
Copy link
Member Author

(also left a comment on the tracking issue re whether to error on incorrect attribute placement)

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
[00:05:11]    Compiling backtrace v0.3.6
[00:05:12]    Compiling syntax_pos v0.0.0 (file:///checkout/src/libsyntax_pos)
[00:05:12]    Compiling arena v0.0.0 (file:///checkout/src/libarena)
[00:05:15]    Compiling rustc_errors v0.0.0 (file:///checkout/src/librustc_errors)
[00:05:27] error[E0609]: no field `fn_must_use` on type `&feature_gate::Features`
[00:05:27]     --> libsyntax/feature_gate.rs:1342:39
[00:05:27]      |
[00:05:27] 1342 |               gate_feature!(cx.context, $feature, span, $explain, $level)
[00:05:27] ...
[00:05:27] ...
[00:05:27] 1549 | /                     gate_feature_post!(&self, fn_must_use, attr.span,
[00:05:27] 1550 | |                                        "`#[must_use]` on functions is experimental",
[00:05:27] 1551 | |                                        GateStrength::Soft);
[00:05:27]      | |___________________________________________________________- in this macro invocation
[00:05:27] 
[00:05:27] error[E0609]: no field `fn_must_use` on type `&feature_gate::Features`
[00:05:27]     --> libsyntax/feature_gate.rs:1342:39
[00:05:27] 1342 

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-3.9 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.
[00:21:21]    Compiling rustc_tsan v0.0.0 (file:///checkout/src/librustc_tsan)
[00:21:21]    Compiling rustc_lsan v0.0.0 (file:///checkout/src/librustc_lsan)
[00:21:22]    Compiling rustc_asan v0.0.0 (file:///checkout/src/librustc_asan)
[00:21:22]    Compiling rustc_msan v0.0.0 (file:///checkout/src/librustc_msan)
[00:22:00] error: this feature has been stable since 1.27.0. Attribute no longer needed
[00:22:00]    |
[00:22:00]    |
[00:22:00] 79 | #![feature(fn_must_use)]
[00:22:00]    |
[00:22:00]    |
[00:22:00]    = note: `-D stable-features` implied by `-D warnings`
[00:22:03] error: aborting due to previous error
[00:22:03] 
[00:22:03] error: Could not compile `core`.
[00:22:03] 
[00:22:03] 
[00:22:03] Caused by:
[00:22:03]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name core libcore/lib.rs --color always --error-format json --crate-type lib --emit=dep-info,link -C opt-level=2 -C metadata=64878136ec7adadb -C extra-filename=-64878136ec7adadb --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-std/release/deps` (exit code: 101)
[00:22:03] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "--message-format" "json"
[00:22:03] expected success, got: exit code: 101
[00:22:03] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:22:03] travis_fold:end:stage1-std

[00:22:03] travis_time:end:stage1-std:start=1524723582418145126,finish=1524723637263463266,duration=54845318140

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)

@estebank
Copy link
Contributor

(rebased on unmerged PR #50149, which this would collide with conditional on #50149 being approved)

Just approved that PR so soon you should be able to rebase against master again.

@bors
Copy link
Contributor

bors commented Apr 27, 2018

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

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-3.9 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.
[00:50:38] ............................................................................ii......................
[00:51:25] ........................................i....................................................i.ii...
[00:51:35] ........................test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:52:06] ............................................................................
[00:52:26] .iiiiiii............................................................................................
[00:53:05] ....................................................................................................
[00:53:22] .........................................................................
[00:53:22] test result: ok. 2954 passed; 0 failed; 19 ignored; 0 measured; 0 filtered out
[00:53:22] 
---
[01:06:21] 
[01:06:21] To learn more, run the command again with --verbose.
[01:06:21] 
[01:06:21] 
[01:06:21] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "test" "--target" "x86_64-unknown-linux-gnu" "--release" "--locked" "--color" "always" "--features" "panic-unwind jemalloc backtrace" "--manifest-path" "/checkout/src/libstd/Cargo.toml" "-p" "alloc" "--" "--quiet"
[01:06:21] 
[01:06:21] 
[01:06:21] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:06:21] Build completed unsuccessfully in 0:26:23
[01:06:21] Build completed unsuccessfully in 0:26:23
[01:06:21] Makefile:58: recipe for target 'check' failed
[01:06:21] make: *** [check] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:11912cd8
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

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-3.9 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.
[00:56:38] ............................................................................ii......................
[00:57:33] ........................................i....................................................i.ii...
[00:57:35] ....test [run-pass] run-pass/saturating-float-casts.rs has been running for over 60 seconds
[00:58:16] ................................................................................................
[00:58:35] .iiiiiii............................................................................................
[00:59:17] ....................................................................................................
[00:59:36] .........................................................................
[00:59:36] test result: ok. 2954 passed; 0 failed; 19 ignored; 0 measured; 0 filtered out
[00:59:36] 
---
[01:22:43] travis_fold:start:test_stage1-std
travis_time:start:test_stage1-std
Testing std stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:22:43]    Compiling std v0.0.0 (file:///checkout/src/libstd)
[01:23:13] error: unused return value of `core::clone::Clone::clone` which must be used: cloning is often expensive and is not expected to have side effects
[01:23:13]     |
[01:23:13]     |
[01:23:13] 529 |             tx1.clone();
[01:23:13]     |
[01:23:13]     |
[01:23:13]     = note: `-D unused-must-use` implied by `-D warnings`
[01:23:13] 
[01:23:13] error: unused return value of `core::clone::Clone::clone` which must be used: cloning is often expensive and is not expected to have side effects
[01:23:13]     |
[01:23:13]     |
[01:23:13] 551 |             tx1.clone();
[01:23:13] 
[01:23:13] 
-1wl4zjaz72e5d/s-f0jwusi57h-1w5ffv6-6gvofocobazn
112820 ./obj/build/x86_64-unknown-linux-gnu/test/mir-opt
111312 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu
111308 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release
107424 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps
107424 ./obj/build/x86_64-unknown-linux-gnu/stage0-tools/x86_64-unknown-linux-gnu/release/deps
102820 ./obj/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends
102808 ./obj/build/bootstrap/debug/incremental/bootstrap-2wettvttcntnm
102804 ./obj/build/bootstrap/debug/incremental/bootstrap-2wettvttcntnm/s-f0jy1sr9no-o2vsb4-v7hez0f2m5v0
90644 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz
90644 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz
90640 ./obj/build/x86_64-unknown-linux-gnu/stage1-std/x86_64-unknown-linux-gnu/release/incremental/core-31lccp6wy7orz/s-f0jxz7e8k9-1pa4mnj-t8uzx7gi46ua
89756 ./obj/build/x86_64-unknown-linux-gnu/stage1/lib
89704 ./src/llvm/test/CodeGen
86660 ./obj/build/x86_64-unknown-linux-gnu/doc/core
84436 ./obj/build/x86_64-unknown-linux-gnu/stage1-rustc/x86_64-unknown-linux-gnu/release/deps

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)

The must-use lint needs the DefId of called functions and method
receivers in order to look for a `#[must_use]` attribute, but this would
ICE (!) if a called function was actually a closure (with a non-unit
return value). Instead, let's be specific that we want a `Def::Fn`,
rather than blithely assuming that we can get the DefId of a qpath.

Supporting must-use closures doesn't seem like a priority, but could
conceivably be added in the future if desired (conditional on the
statement and expression attributes (rust-lang#15701) story being amicable).
This is in the matter of RFC 1940 and tracking issue rust-lang#43302.
@zackmdavis
Copy link
Member Author

@nikomatsakis ready

@nikomatsakis
Copy link
Contributor

cc @rust-lang/docs -- this PR contains changed that will need to be documented in stable docs.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Apr 30, 2018

📌 Commit 3dbdccc has been approved by nikomatsakis

@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 Apr 30, 2018
@nikomatsakis nikomatsakis added the relnotes Marks issues that should be documented in the release notes of the next release. label Apr 30, 2018
@GuillaumeGomez
Copy link
Member

@nikomatsakis: Why not adding it in this PR directly?

@bors
Copy link
Contributor

bors commented Apr 30, 2018

⌛ Testing commit 3dbdccc with merge 357bf00...

bors added a commit that referenced this pull request Apr 30, 2018
stabilize `#[must_use]` for functions and must-use comparison operators (RFC 1940)

r? @nikomatsakis
@bors
Copy link
Contributor

bors commented May 1, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 357bf00 to master...

@bors bors merged commit 3dbdccc into rust-lang:master May 1, 2018
@zackmdavis zackmdavis deleted the fn_must_stabilize branch June 24, 2018 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. 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.

8 participants