rust/src/test/ui/borrowck
bors f9157f5b86 Auto merge of #51242 - ytausky:mut-ref, r=estebank
Suggest not mutably borrowing a mutable reference

This PR would (hopefully) solve #45392. I deviated a bit from @estebank's instructions since the error span only included the borrowed expression (e.g. the `b` in `&mut b`). I also didn't check the mutability of the local binding, since this whole case is concerned with an immutable local.

I can see two outstanding questions:
1. `note_immutability_blame` is called in two places, but I only have one test case. I think it covers the call in `report_bckerror`, but I'm not sure how to trigger the call from `report_aliasability_violation`.
2. There is one failing test, where the local binding is `self: &mut Self`. I'm not entirely sure what the correct output should be, but I think the new message should also apply. Unfortunately, since this parameter is parsed differently, its `let_span` covers both the pattern and the type, leading to a wrong suggestion text. I'm not sure how to correctly identify this case.
2018-06-05 01:47:13 +00:00
..
borrowck-box-insensitivity.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-box-insensitivity.rs Be ambiguous when type cannot be properly mentioned 2018-01-02 19:49:38 -08:00
borrowck-box-insensitivity.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-closures-two-mut.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
borrowck-closures-two-mut.stderr remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
borrowck-escaping-closure-error-1.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-escaping-closure-error-1.rs Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
borrowck-escaping-closure-error-1.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-escaping-closure-error-2.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-escaping-closure-error-2.rs Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
borrowck-escaping-closure-error-2.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-in-static.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-in-static.rs Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
borrowck-in-static.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-move-error-with-note.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-move-error-with-note.rs Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
borrowck-move-error-with-note.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-move-out-of-vec-tail.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-move-out-of-vec-tail.rs Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
borrowck-move-out-of-vec-tail.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-reinit.rs Update tests for -Zborrowck-mir -> -Zborrowck=mode migration 2017-11-26 16:39:15 +01:00
borrowck-reinit.stderr update tests 2018-03-14 00:53:24 +01:00
borrowck-report-with-custom-diagnostic.nll.stderr rust-lang/rust#51025: improve test robustness so that they work under NLL too. 2018-05-25 13:00:51 +02:00
borrowck-report-with-custom-diagnostic.rs rust-lang/rust#51025: improve test robustness so that they work under NLL too. 2018-05-25 13:00:51 +02:00
borrowck-report-with-custom-diagnostic.stderr rust-lang/rust#51025: improve test robustness so that they work under NLL too. 2018-05-25 13:00:51 +02:00
borrowck-vec-pattern-nesting.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
borrowck-vec-pattern-nesting.rs Stabilize slice patterns without .. 2018-03-20 02:27:40 +03:00
borrowck-vec-pattern-nesting.stderr Stabilize slice patterns without .. 2018-03-20 02:27:40 +03:00
immutable-arg.rs Modify message to match label 2018-01-10 11:41:12 -08:00
immutable-arg.stderr update tests 2018-03-14 00:53:24 +01:00
issue-7573.nll.stderr Trivial updates to .nll.stderr files post-rebase, reflecting s/-Znll/nll/ in messages. 2018-04-18 15:37:23 +02:00
issue-7573.rs Tweak wording and spans of closure lifetime errors 2018-01-19 13:28:43 -08:00
issue-7573.stderr Update UI tests 2018-02-26 20:24:42 +03:00
issue-41962.rs rust-lang/rust#41962 has a new error with my new code. Incorporate that into my code. 2018-05-29 23:02:40 +02:00
issue-41962.stderr rust-lang/rust#41962 has a new error with my new code. Incorporate that into my code. 2018-05-29 23:02:40 +02:00
issue-45983.nll.stderr Trivial updates to .nll.stderr files post-rebase, reflecting s/-Znll/nll/ in messages. 2018-04-18 15:37:23 +02:00
issue-45983.rs Move diagnostic logic to its own module 2018-01-15 11:12:25 -08:00
issue-45983.stderr Update UI tests 2018-02-26 20:24:02 +03:00
issue-51117.nll.stderr change PointerKind::Implicit to a note 2018-05-31 10:17:51 -04:00
issue-51117.rs change PointerKind::Implicit to a note 2018-05-31 10:17:51 -04:00
issue-51117.stderr change PointerKind::Implicit to a note 2018-05-31 10:17:51 -04:00
mut-borrow-in-loop.nll.stderr rework causal tracking to explore outlives relationships 2018-05-09 23:21:24 -03:00
mut-borrow-in-loop.rs Merge cfail and ui tests into ui tests 2017-11-24 11:32:35 +01:00
mut-borrow-in-loop.stderr update tests 2018-03-14 00:53:24 +01:00
mut-borrow-of-mut-ref.nll.stderr Suggest not mutably borrowing a mutable reference 2018-06-01 23:17:10 +02:00
mut-borrow-of-mut-ref.rs Suggest not mutably borrowing a mutable reference 2018-06-01 23:17:10 +02:00
mut-borrow-of-mut-ref.stderr Suggest not mutably borrowing a mutable reference 2018-06-01 23:17:10 +02:00
mut-borrow-outside-loop.nll.stderr rust-lang/rust#51025: improve test robustness so that they work under NLL too. 2018-05-25 13:00:51 +02:00
mut-borrow-outside-loop.rs rust-lang/rust#51025: improve test robustness so that they work under NLL too. 2018-05-25 13:00:51 +02:00
mut-borrow-outside-loop.stderr rust-lang/rust#51025: improve test robustness so that they work under NLL too. 2018-05-25 13:00:51 +02:00
promote-ref-mut-in-let-issue-46557.nll.stderr also check let arms and nested patterns for mutable borrows 2018-06-01 10:06:02 -04:00
promote-ref-mut-in-let-issue-46557.rs also check let arms and nested patterns for mutable borrows 2018-06-01 10:06:02 -04:00
promote-ref-mut-in-let-issue-46557.stderr also check let arms and nested patterns for mutable borrows 2018-06-01 10:06:02 -04:00
regions-bound-missing-bound-in-impl.rs For named lifetimes point only at method signature 2018-01-28 12:07:03 -08:00
regions-bound-missing-bound-in-impl.stderr update tests 2018-03-14 00:53:24 +01:00
regions-escape-bound-fn-2.nll.stderr Trivial updates to .nll.stderr files post-rebase, reflecting s/-Znll/nll/ in messages. 2018-04-18 15:37:23 +02:00
regions-escape-bound-fn-2.rs Move diagnostic logic to its own module 2018-01-15 11:12:25 -08:00
regions-escape-bound-fn-2.stderr Update UI tests 2018-02-26 20:24:02 +03:00
regions-escape-bound-fn.nll.stderr Trivial updates to .nll.stderr files post-rebase, reflecting s/-Znll/nll/ in messages. 2018-04-18 15:37:23 +02:00
regions-escape-bound-fn.rs Move diagnostic logic to its own module 2018-01-15 11:12:25 -08:00
regions-escape-bound-fn.stderr Update UI tests 2018-02-26 20:24:02 +03:00
regions-escape-unboxed-closure.nll.stderr Trivial updates to .nll.stderr files post-rebase, reflecting s/-Znll/nll/ in messages. 2018-04-18 15:37:23 +02:00
regions-escape-unboxed-closure.rs Move diagnostic logic to its own module 2018-01-15 11:12:25 -08:00
regions-escape-unboxed-closure.stderr Update UI tests 2018-02-26 20:24:02 +03:00
two-phase-method-receivers.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
two-phase-multi-mut.rs Add test from #49736 2018-04-06 15:00:45 -04:00
two-phase-multi-mut.stderr Add test from #49736 2018-04-06 15:00:45 -04:00
two-phase-multiple-activations.rs remove -Znll -- borrowck=mir implies nll now 2018-04-15 07:13:42 -04:00
unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr Checkpoint the current status of NLL on ui tests via compare-mode=nll. 2018-04-11 00:38:35 +02:00
unboxed-closures-move-upvar-from-non-once-ref-closure.rs Remove NOTE/HELP annotations from UI tests 2017-12-14 23:26:39 +03:00
unboxed-closures-move-upvar-from-non-once-ref-closure.stderr update tests 2018-03-14 00:53:24 +01:00