rust/src/test/ui/nll
bors b51ca20ce5 Auto merge of #51964 - matthewjasper:unused-mut-mir-generation, r=nikomatsakis
[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
2018-07-05 00:22:14 +00:00
..
closure-requirements Updated affected tests after rebase. 2018-07-01 16:14:26 +01:00
ty-outlives Ensure that changed errors are lower case. 2018-07-01 16:14:25 +01:00
borrow-use-issue-46875.rs Make killing of out-of-scope borrows a pre-statement effect 2017-12-24 14:56:52 +02:00
borrowed-local-error.rs Remove nll-dump-cause flag and always track causes 2018-03-06 10:34:46 -03:00
borrowed-local-error.stderr update tests 2018-03-14 00:53:24 +01:00
borrowed-match-issue-45045.rs rustc_mir: insert a dummy access to places being matched on, when building MIR. 2018-02-09 23:25:10 +02:00
borrowed-match-issue-45045.stderr update tests 2018-03-14 00:53:24 +01:00
borrowed-referent-issue-38899.rs remove unnecessary compile-flags comments 2018-01-12 10:38:28 -05:00
borrowed-referent-issue-38899.stderr update tests 2018-03-14 00:53:24 +01:00
borrowed-temporary-error.rs Remove nll-dump-cause flag and always track causes 2018-03-06 10:34:46 -03:00
borrowed-temporary-error.stderr update tests 2018-03-14 00:53:24 +01:00
borrowed-universal-error-2.rs Remove nll-dump-cause flag and always track causes 2018-03-06 10:34:46 -03:00
borrowed-universal-error-2.stderr Also point to free named region on lifetime errors 2018-06-28 11:12:44 -07:00
borrowed-universal-error.rs Remove nll-dump-cause flag and always track causes 2018-03-06 10:34:46 -03:00
borrowed-universal-error.stderr Also point to free named region on lifetime errors 2018-06-28 11:12:44 -07:00
capture-mut-ref.rs Fix various nll unused mut errors 2018-07-03 20:12:09 +01:00
capture-mut-ref.stderr Fix various nll unused mut errors 2018-07-03 20:12:09 +01:00
capture-ref-in-struct.rs Remove nll-dump-cause flag and always track causes 2018-03-06 10:34:46 -03:00
capture-ref-in-struct.stderr update tests 2018-03-14 00:53:24 +01:00
constant.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
decl-macro-illegal-copy.rs Regression test for #46314 2018-04-04 11:36:38 +03:00
decl-macro-illegal-copy.stderr Regression test for #46314 2018-04-04 11:36:38 +03:00
drop-may-dangle.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
drop-no-may-dangle.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
drop-no-may-dangle.stderr Stabilize attributes on generic parameters 2018-04-05 02:19:56 +03:00
extra-unused-mut.rs Fix various nll unused mut errors 2018-07-03 20:12:09 +01:00
generator-distinct-lifetime.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
generator-upvar-mutability.rs Fix various nll unused mut errors 2018-07-03 20:12:09 +01:00
generator-upvar-mutability.stderr Fix various nll unused mut errors 2018-07-03 20:12:09 +01:00
get_default.nll.stderr fix nll reference harder 2018-05-10 12:41:24 -03:00
get_default.rs ignore the point where the outlives requirement was added 2018-05-09 23:21:24 -03:00
get_default.stderr ignore the point where the outlives requirement was added 2018-05-09 23:21:24 -03:00
guarantor-issue-46974.rs Updated other tests affected by change. 2018-01-10 19:12:57 +00:00
guarantor-issue-46974.stderr update tests 2018-03-14 00:53:24 +01:00
issue-16223.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
issue-31567.rs add regression tests for various MIR bugs that get fixed 2018-03-13 11:22:07 -04:00
issue-31567.stderr Also point to free named region on lifetime errors 2018-06-28 11:12:44 -07:00
issue-43058.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
issue-47022.rs Rename must-compile-successfully into compile-pass 2018-04-13 23:28:03 +02:00
issue-47388.rs fix ui test 2018-04-06 23:03:20 +05:30
issue-47388.stderr NLL: Updates to diagnostic output in test/ui. 2018-06-19 19:38:37 +02:00
issue-47470.rs add regression tests for various MIR bugs that get fixed 2018-03-13 11:22:07 -04:00
issue-47470.stderr Extend support to get_generics for all NodeItems 2018-06-28 11:12:43 -07:00
issue-48070.rs Move 48070 test to ui 2018-03-13 14:52:11 -04:00
issue-48238.rs add test for issue-48238 2018-03-23 18:01:05 +08:00
issue-48238.stderr add test for issue-48238 2018-03-23 18:01:05 +08:00
issue-50716-1.rs Fix the error of selecting obligation by not running the borrow checker. 2018-06-27 18:14:00 +02:00
issue-50716.rs Updated affected tests after rebase. 2018-07-01 16:14:26 +01:00
issue-50716.stderr Updated affected tests after rebase. 2018-07-01 16:14:26 +01:00
issue-51268.rs Fix variable name in E0502 double borrow error 2018-06-20 09:04:52 -03:00
issue-51268.stderr Fix variable name in E0502 double borrow error 2018-06-20 09:04:52 -03:00
issue-51512.rs Fix erroneous error note when using field after move 2018-06-22 18:23:33 -03:00
issue-51512.stderr Fix erroneous error note when using field after move 2018-06-22 18:23:33 -03:00
maybe-initialized-drop-implicit-fragment-drop.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
maybe-initialized-drop-implicit-fragment-drop.stderr update tests 2018-03-14 00:53:24 +01:00
maybe-initialized-drop-uninitialized.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
maybe-initialized-drop-with-fragment.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
maybe-initialized-drop-with-fragment.stderr update tests 2018-03-14 00:53:24 +01:00
maybe-initialized-drop-with-uninitialized-fragments.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
maybe-initialized-drop-with-uninitialized-fragments.stderr update tests 2018-03-14 00:53:24 +01:00
maybe-initialized-drop.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
maybe-initialized-drop.stderr update tests 2018-03-14 00:53:24 +01:00
move-errors.rs Update tests for grouped nll move errors 2018-06-27 22:46:58 +01:00
move-errors.stderr Update tests for grouped nll move errors 2018-06-27 22:46:58 +01:00
normalization-bounds-error.rs Register outlives predicates from queries the right way around. 2018-05-31 20:40:25 +01:00
normalization-bounds-error.stderr Point to lifetime in fn definition on lifetime error note 2018-06-28 11:12:42 -07:00
normalization-bounds.rs Register outlives predicates from queries the right way around. 2018-05-31 20:40:25 +01:00
projection-return.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
return-ref-mut-issue-46557.rs remove unnecessary compile-flags comments 2018-01-12 10:38:28 -05:00
return-ref-mut-issue-46557.stderr update tests 2018-03-14 00:53:24 +01:00
trait-associated-constant.rs mir: Fix DefiningTy::Const 2018-02-06 23:42:05 -05:00
trait-associated-constant.stderr Extend support to get_generics for all NodeItems 2018-06-28 11:12:43 -07:00