Skip to content

[NLL] Fix various unused mut errors #51964

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

Merged
merged 1 commit into from
Jul 5, 2018

Conversation

matthewjasper
Copy link
Contributor

Closes #51801
Closes #50897
Closes #51830
Closes #51904
cc #51918 - keeping this one open in case there are any more issues

This PR contains multiple changes. List of changes with examples of what they fix:

  • Change mir generation so that the parameter variable doesn't get a name when a ref pattern is used as an argument
fn f(ref y: i32) {} // doesn't trigger lint
  • Change mir generation so that by-move closure captures don't get first moved into a temporary.
let mut x = 0; // doesn't trigger lint
move || {
    x = 1;
};
  • Treat generator upvars the same as closure upvars
let mut x = 0; // This mut is now necessary and is not linted against.
move || {
    x = 1;
    yield;
};

r? @nikomatsakis

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 1, 2018
Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

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

Left a few nits and a question but basically 💯

// used as mut. This is OK here because the upvar
// expressions have no side effects and act on
// disjoint places.
Some(Category::Place) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

to make sure I am remembering correctly — this occurs on copy/move variables, whereas a by-ref binding would use as_operand?

Copy link
Contributor

Choose a reason for hiding this comment

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

this might be worth noting in a comment

name = Some(ident.name);
if let hir::PatKind::Binding(binding_annotation, _, ident, _) = pat.node {
if binding_annotation == hir::BindingAnnotation::Unannotated
|| binding_annotation == hir::BindingAnnotation::Mutable
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't quite understand this part — does this not affect debuginfo in negative ways or something?

Also, a nit: maybe we should use a match here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I presume this corresponds to

Change mir generation so that the parameter variable doesn't get a name when a ref pattern is used as an argument

?

In that case, I would want to see some comments to that effect...

@matthewjasper matthewjasper force-pushed the unused-mut-mir-generation branch from 81d5037 to 56c17dc Compare July 2, 2018 20:12
@rust-highfive
Copy link
Contributor

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:07:51]    Compiling proc_macro v0.0.0 (file:///checkout/src/libproc_macro)
[00:08:06]    Compiling syntax_ext v0.0.0 (file:///checkout/src/libsyntax_ext)
[00:13:35]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:13:35]    Compiling rustc_typeck v0.0.0 (file:///checkout/src/librustc_typeck)
[00:13:35] error: this file contains an un-closed delimiter
[00:13:35]    --> librustc_mir/build/mod.rs:804:12
[00:13:35]     |
[00:13:35] 804 | mod scope;
[00:13:35]     |
[00:13:35] help: did you mean to close this delimiter?
[00:13:35]    --> librustc_mir/build/mod.rs:605:46
[00:13:35]     |
[00:13:35]     |
[00:13:35] 605 | impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
[00:13:35] 
[00:13:35] 
[00:13:35] error: expected one of `::` or `:`, found `)`
[00:13:35]    --> librustc_mir/build/mod.rs:757:31
[00:13:35]     |
[00:13:35] 757 |     fn get_unit_temp(&mut self) -> Place<'tcx> {
[00:13:35]     |                               ^ expected one of `::` or `:` here
[00:13:35] 
[00:13:35] error: expected one of `::` or `:`, found `)`
[00:13:35]    --> librustc_mir/build/mod.rs:770:30
[00:13:35]     |
[00:13:35] 770 |     fn return_block(&mut self) -> BasicBlock {
[00:13:35]     |                              ^ expected one of `::` or `:` here
[00:13:35] 
[00:13:35] error: expected one of `::` or `:`, found `)`
[00:13:35]    --> librustc_mir/build/mod.rs:781:35
[00:13:35]     |
[00:13:35] 781 |     fn unreachable_block(&mut self) -> BasicBlock {
[00:13:35]     |                                   ^ expected one of `::` or `:` here
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:798:1
[00:13:35] 791 | }
[00:13:35] 791 | }
[00:13:35]     |  - expected one of 9 possible tokens here
[00:13:35] ...
[00:13:35] 798 | mod block;
[00:13:35]     | ^^^ unexpected token
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:799:1
[00:13:35]     |
[00:13:35] 798 | mod block;
[00:13:35]     |           - expected one of 9 possible tokens here
[00:13:35] 799 | mod cfg;
[00:13:35]     | ^^^ unexpected token
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:800:1
[00:13:35]     |
[00:13:35] 799 | mod cfg;
[00:13:35]     |         - expected one of 9 possible tokens here
[00:13:35] 800 | mod expr;
[00:13:35]     | ^^^ unexpected token
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:801:1
[00:13:35]     |
[00:13:35] 800 | mod expr;
[00:13:35]     |          - expected one of 9 possible tokens here
[00:13:35] 801 | mod into;
[00:13:35]     | ^^^ unexpected token
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:802:1
[00:13:35]     |
[00:13:35] 801 | mod into;
[00:13:35]     |          - expected one of 9 possible tokens here
[00:13:35] 802 | mod matches;
[00:13:35]     | ^^^ unexpected token
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:803:1
[00:13:35]     |
[00:13:35] 802 | mod matches;
[00:13:35]     |             - expected one of 9 possible tokens here
[00:13:35] 803 | mod misc;
[00:13:35]     | ^^^ unexpected token
[00:13:35] 
[00:13:35] error: expected one of `const`, `crate`, `default`, `extern`, `fn`, `pub`, `type`, `unsafe`, or `}`, found `mod`
[00:13:35]    --> librustc_mir/build/mod.rs:804:1
[00:13:35]     |
[00:13:35] 803 | mod misc;
[00:13:35]     |          - expected one of 9 possible tokens here
[00:13:35] 804 | mod scope;
[00:13:35]     | ^^^ unexpected token
[00:13:37] error[E0433]: failed to resolve. Use of undeclared type or module `scope`
[00:13:37]    --> librustc_mir/build/mod.rs:260:17
[00:13:37]     |
[00:13:37]     |
[00:13:37] 260 |     scopes: Vec<scope::Scope<'tcx>>,
[00:13:37]     |                 ^^^^^ Use of undeclared type or module `scope`
[00:13:37] error[E0433]: failed to resolve. Use of undeclared type or module `scope`
[00:13:37]    --> librustc_mir/build/mod.rs:271:27
[00:13:37]     |
[00:13:37]     |
[00:13:37] 271 |     breakable_scopes: Vec<scope::BreakableScope<'tcx>>,
[00:13:37]     |                           ^^^^^ Use of undeclared type or module `scope`
[00:13:37] error[E0433]: failed to resolve. Use of undeclared type or module `matches`
[00:13:37]    --> librustc_mir/build/mod.rs:735:55
[00:13:37]     |
[00:13:37]     |
[00:13:37] 735 |                                                       matches::ArmHasGuard(false),
[00:13:37]     |                                                       ^^^^^^^ Use of undeclared type or module `matches`
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:758:15
[00:13:37]     |
[00:13:37] 758 |         match self.unit_temp {
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:761:26
[00:13:37]     |
[00:13:37] 761 |                 let ty = self.hir.unit_ty();
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:762:31
[00:13:37]     |
[00:13:37] 762 |                 let fn_span = self.fn_span;
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:763:27
[00:13:37]     |
[00:13:37] 763 |                 let tmp = self.temp(ty, fn_span);
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:764:17
[00:13:37]     |
[00:13:37] 764 |                 self.unit_temp = Some(tmp.clone());
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:771:15
[00:13:37]     |
[00:13:37] 771 |         match self.cached_return_block {
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:774:26
[00:13:37]     |
[00:13:37] 774 |                 let rb = self.cfg.start_new_block();
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:775:17
[00:13:37]     |
[00:13:37] 775 |                 self.cached_return_block = Some(rb);
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:782:15
[00:13:37]     |
[00:13:37] 782 |         match self.cached_unreachable_block {
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:785:26
[00:13:37]     |
[00:13:37] 785 |                 let ub = self.cfg.start_new_block();
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:37] error[E0434]: can't capture dynamic environment in a fn item
[00:13:37]    --> librustc_mir/build/mod.rs:786:17
[00:13:37]     |
[00:13:37] 786 |                 self.cached_unreachable_block = Some(ub);
[00:13:37]     |
[00:13:37]     |
[00:13:37]     = help: use the `|| { ... }` closure form instead
[00:13:37] 
[00:13:38] error[E0261]: use of undeclared lifetime name `'tcx`
[00:13:38]    --> librustc_mir/build/mod.rs:757:42
[00:13:38]     |
[00:13:38] 757 |     fn get_unit_temp(&mut self) -> Place<'tcx> {
[00:13:38]     |                                          ^^^^ undeclared lifetime
[00:13:38] error: aborting due to 26 previous errors
[00:13:38] 
[00:13:38] Some errors occurred: E0261, E0433, E0434.
[00:13:38] For more information about an error, try `rustc --explain E0261`.
[00:13:38] For more information about an error, try `rustc --explain E0261`.
[00:13:38] error: Could not compile `rustc_mir`.
[00:13:38] 
[00:13:38] Caused by:
[00:13:38]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=8fc603afb8ea9b13 -C extra-filename=-8fc603afb8ea9b13 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-d45628fe21047b42.so --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-d8b3f1986e621085.rlib --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-09e9dbd1ef48ffa5.rlib --extern either=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libeither-b51deb005c05dd3b.rlib --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-6020508f01da724d.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-023d781fbd65d983.rlib --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-9c861d36e123bec8.rlib --extern polonius_engine=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-2e546cbdf217aece.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-1dddb0fa9d8a512f.so --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-be9737b074a8dae0.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-25582ce13d3618ea.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-e036f8f5b9204e52.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-066098b54e835a1f.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-05774896829b5d87.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-05774896829b5d87.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-a1b02e0d020520ac.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-f36f6cb494d373be.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-a59a4023b81a89b2/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-ea5907e223517cf2/out` (exit code: 101)
[00:15:13] error: build failed
[00:15:13] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:15:13] expected success, got: exit code: 101
[00:15:13] expected success, got: exit code: 101
[00:15:13] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:15:13] travis_fold:end:stage0-rustc

[00:15:13] travis_time:end:stage0-rustc:start=1530562869979106655,finish=1530563435511843621,duration=565532736966


[00:15:13] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:15:13] Build completed unsuccessfully in 0:09:36
[00:15:13] Makefile:28: recipe for target 'all' failed
[00:15:13] make: *** [all] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0083fad6
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)
---
travis_time:end:17bfccc2:start=1530563436130972155,finish=1530563436139496370,duration=8524215
travis_fold:end:after_failure.3
travis_fold:start:after_failure.4
travis_time:start:0529960a
$ head -30 ./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers || true
head: cannot open ‘./obj/build/x86_64-unknown-linux-gnu/native/asan/build/lib/asan/clang_rt.asan-dynamic-i386.vers’ for reading: No such file or directory
travis_fold:end:after_failure.4
travis_fold:start:after_failure.5
travis_time:start:060c6871
$ 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)

@matthewjasper matthewjasper force-pushed the unused-mut-mir-generation branch from 56c17dc to 85dbe63 Compare July 2, 2018 20:32
@rust-highfive
Copy link
Contributor

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:12:11]    Compiling rustc_mir v0.0.0 (file:///checkout/src/librustc_mir)
[00:12:16] error[E0308]: mismatched types
[00:12:16]    --> librustc_mir/build/mod.rs:681:22
[00:12:16]     |
[00:12:16] 681 |                 Some(hir::PatKind::Binding(hir::BindingAnnotation::Unannotated, _, ident, _))
[00:12:16]     |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `rustc::hir::Pat`, found enum `rustc::hir::PatKind`
[00:12:16]     = note: expected type `rustc::hir::Pat`
[00:12:16]                found type `rustc::hir::PatKind`
[00:12:16] 
[00:12:16] error[E0308]: mismatched types
[00:12:16] error[E0308]: mismatched types
[00:12:16]    --> librustc_mir/build/mod.rs:682:24
[00:12:16]     |
[00:12:16] 682 |                 | Some(hir::PatKind::Binding(hir::BindingAnnotation::Mutable, _, ident, _)) => {
[00:12:16]     |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `rustc::hir::Pat`, found enum `rustc::hir::PatKind`
[00:12:16]     = note: expected type `rustc::hir::Pat`
[00:12:16]                found type `rustc::hir::PatKind`
[00:12:16] 
[00:12:22] error: aborting due to 2 previous errors
[00:12:22] error: aborting due to 2 previous errors
[00:12:22] 
[00:12:22] For more information about this error, try `rustc --explain E0308`.
[00:12:22] error: Could not compile `rustc_mir`.
[00:12:22] 
[00:12:22] Caused by:
[00:12:22]   process didn't exit successfully: `/checkout/obj/build/bootstrap/debug/rustc --crate-name rustc_mir librustc_mir/lib.rs --color always --error-format json --crate-type dylib --emit=dep-info,link -C prefer-dynamic -C opt-level=2 -C metadata=8fc603afb8ea9b13 -C extra-filename=-8fc603afb8ea9b13 --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps --target x86_64-unknown-linux-gnu -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps -L dependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/release/deps --extern arena=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libarena-d45628fe21047b42.so --extern bitflags=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbitflags-d8b3f1986e621085.rlib --extern byteorder=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libbyteorder-09e9dbd1ef48ffa5.rlib --extern either=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libeither-b51deb005c05dd3b.rlib --extern graphviz=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libgraphviz-6020508f01da724d.so --extern log=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog-023d781fbd65d983.rlib --extern log_settings=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/liblog_settings-9c861d36e123bec8.rlib --extern polonius_engine=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libpolonius_engine-2e546cbdf217aece.rlib --extern rustc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc-1dddb0fa9d8a512f.so --extern rustc_apfloat=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_apfloat-be9737b074a8dae0.rlib --extern rustc_data_structures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_data_structures-25582ce13d3618ea.so --extern rustc_errors=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_errors-e036f8f5b9204e52.so --extern rustc_target=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/librustc_target-066098b54e835a1f.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-05774896829b5d87.so --extern serialize=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libserialize-05774896829b5d87.rlib --extern syntax=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax-a1b02e0d020520ac.so --extern syntax_pos=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/deps/libsyntax_pos-f36f6cb494d373be.so -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/backtrace-sys-a59a4023b81a89b2/out -L native=/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-rustc/x86_64-unknown-linux-gnu/release/build/miniz-sys-ea5907e223517cf2/out` (exit code: 101)
[00:13:48] error: build failed
[00:13:48] command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-j" "4" "--release" "--locked" "--color" "always" "--features" " jemalloc" "--manifest-path" "/checkout/src/rustc/Cargo.toml" "--message-format" "json"
[00:13:48] expected success, got: exit code: 101
[00:13:48] expected success, got: exit code: 101
[00:13:48] thread 'main' panicked at 'cargo must succeed', bootstrap/compile.rs:1091:9
[00:13:48] travis_fold:end:stage0-rustc

[00:13:48] travis_time:end:stage0-rustc:start=1530563969129547492,finish=1530564519970986936,duration=550841439444


[00:13:48] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap build
[00:13:48] Build completed unsuccessfully in 0:09:21
[00:13:48] Makefile:28: recipe for target 'all' failed
[00:13:48] make: *** [all] Error 1

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:0a8d6cc8
$ 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)

@matthewjasper matthewjasper force-pushed the unused-mut-mir-generation branch from 85dbe63 to 3fe3ea0 Compare July 2, 2018 21:04
@matthewjasper matthewjasper force-pushed the unused-mut-mir-generation branch from 3fe3ea0 to 125c9d9 Compare July 3, 2018 19:12
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 4, 2018

📌 Commit 125c9d9 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 4, 2018
@bors
Copy link
Collaborator

bors commented Jul 5, 2018

⌛ Testing commit 125c9d9 with merge b51ca20...

bors added a commit that referenced this pull request Jul 5, 2018
…omatsakis

[NLL] Fix various unused mut errors

Closes #51801
Closes #50897
Closes #51830
Closes #51904
cc #51918 - keeping this one open in case there are any more issues

This PR contains multiple changes. List of changes with examples of what they fix:

* Change mir generation so that the parameter variable doesn't get a name when a `ref` pattern is used as an argument
```rust
fn f(ref y: i32) {} // doesn't trigger lint
```
* Change mir generation so that by-move closure captures don't get first moved into a temporary.
```rust
let mut x = 0; // doesn't trigger lint
move || {
    x = 1;
};
```
* Treat generator upvars the same as closure upvars
```rust
let mut x = 0; // This mut is now necessary and is not linted against.
move || {
    x = 1;
    yield;
};
```

r? @nikomatsakis
@bors
Copy link
Collaborator

bors commented Jul 5, 2018

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

@bors bors merged commit 125c9d9 into rust-lang:master Jul 5, 2018
@matthewjasper matthewjasper deleted the unused-mut-mir-generation branch September 3, 2018 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
4 participants