rust/src/test/ui/borrowck
Pietro Albini 14546cd501
Rollup merge of #52907 - pnkfelix:issue-52877-original-source-should-precede-suggestions, r=petrochenkov
NLL: On "cannot move out of type" error, print original before rewrite

NLL: On "cannot move out of type" error, print original source before rewrite.

 * Arguably this change is sometimes injecting noise into the output  (namely in the cases where the suggested rewrite is inline with the   suggestion and we end up highlighting the original source code).   I would not be opposed to something more aggressive/dynamic, like   revising the suggestion code to automatically print the original  source when necessary (e.g. when the error does not have a span   that includes the span of the suggestion).

 * Also, as another note on this change: The doc comment for `Diagnostic::span_suggestion`  says:
```rust
    /// The message
    ///
    /// * should not end in any punctuation (a `:` is added automatically)
    /// * should not be a question
    /// * should not contain any parts like "the following", "as shown"
```
  *  but the `:` is *not* added when the emitted line appears  out-of-line relative to the suggestion. I find that to be an  unfortunate UI experience.

----

As a drive-by fix, also changed code to combine multiple suggestions for a pattern into a single multipart suggestion (which vastly improves user experience IMO).

----

Includes the updates to expected NLL diagnostics.

Fix #52877
2018-08-01 10:13:06 +02:00
..
borrowck-box-insensitivity.nll.stderr Fix erroneous error note when using field after move 2018-06-22 18:23:33 -03:00
borrowck-box-insensitivity.rs
borrowck-box-insensitivity.stderr
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 Don't match on region kinds when reporting NLL errors 2018-07-23 20:54:09 +01:00
borrowck-escaping-closure-error-1.rs
borrowck-escaping-closure-error-1.stderr
borrowck-escaping-closure-error-2.nll.stderr Don't match on region kinds when reporting NLL errors 2018-07-23 20:54:09 +01:00
borrowck-escaping-closure-error-2.rs
borrowck-escaping-closure-error-2.stderr
borrowck-feature-nll-overrides-migrate.edition.stderr Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
borrowck-feature-nll-overrides-migrate.rs Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
borrowck-feature-nll-overrides-migrate.zflag.stderr Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
borrowck-in-static.nll.stderr Add specific message when moving from upvars in a non-FnOnce closure 2018-07-21 18:40:46 +01:00
borrowck-in-static.rs
borrowck-in-static.stderr
borrowck-migrate-to-nll.edition.stderr Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
borrowck-migrate-to-nll.rs Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
borrowck-migrate-to-nll.zflag.stderr Incorporate edition flag testing into tests of -Z borrowck=migrate. 2018-07-26 14:59:00 +02:00
borrowck-move-error-with-note.nll.stderr NLL: On "cannot move out of type" error, print original source before rewrite. 2018-07-31 17:27:29 +02:00
borrowck-move-error-with-note.rs
borrowck-move-error-with-note.stderr
borrowck-move-out-of-vec-tail.nll.stderr NLL: On "cannot move out of type" error, print original source before rewrite. 2018-07-31 17:27:29 +02:00
borrowck-move-out-of-vec-tail.rs
borrowck-move-out-of-vec-tail.stderr
borrowck-reinit.rs
borrowck-reinit.stderr
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-slice-pattern-element-loan.rs fix for issue #8636 2018-07-05 11:34:10 +01:00
borrowck-slice-pattern-element-loan.stderr fix for issue #8636 2018-07-05 11:34:10 +01:00
borrowck-vec-pattern-nesting.nll.stderr NLL: On "cannot move out of type" error, print original source before rewrite. 2018-07-31 17:27:29 +02:00
borrowck-vec-pattern-nesting.rs Drive-by: Make assignment conflict tests in borrowck-vec-pattern-nesting.rs robust for NLL. 2018-06-06 22:42:27 +02:00
borrowck-vec-pattern-nesting.stderr Update the expected error output to reflect changes in this PR. 2018-06-06 22:42:27 +02:00
immutable-arg.rs
immutable-arg.stderr Update the existing UI tests to reflect diagnostic changes in NLL. 2018-06-19 19:41:48 +02:00
issue-7573.nll.stderr Fallback to general error handling in ICE cases. 2018-07-22 12:53:55 +01:00
issue-7573.rs
issue-7573.stderr
issue-41962.rs Fix erroneous error note when using field after move 2018-06-22 18:23:33 -03:00
issue-41962.stderr Update tests that use -Z borrowck=compare or #[feature(nll)] to accmmodate diagnostic change. 2018-07-31 14:36:50 +02:00
issue-45983.nll.stderr Improved closure errors. 2018-07-22 12:49:35 +01:00
issue-45983.rs
issue-45983.stderr
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
issue-51348-multi-ref-mut-in-guard.rs Regression test for the bug. 2018-07-26 15:15:19 +02:00
issue-51415.nll.stderr NLL: On "cannot move out of type" error, print original source before rewrite. 2018-07-31 17:27:29 +02:00
issue-51415.rs use pat_ty_adjusted from expr_use_visitor to type of arguments 2018-06-21 14:32:52 -04:00
issue-51415.stderr use pat_ty_adjusted from expr_use_visitor to type of arguments 2018-06-21 14:32:52 -04:00
mut-borrow-in-loop.nll.stderr consolidate and use find_sub_region_live_at for everything 2018-07-25 06:38:21 +03:00
mut-borrow-in-loop.rs
mut-borrow-in-loop.stderr
mut-borrow-of-mut-ref.nll.stderr Update tests for new NLL mutability errors 2018-07-20 20:01:15 +01: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
mutability-errors.nll.stderr Update tests for new NLL mutability errors 2018-07-20 20:01:15 +01:00
mutability-errors.rs Update tests for new NLL mutability errors 2018-07-20 20:01:15 +01:00
mutability-errors.stderr Update tests for new NLL mutability errors 2018-07-20 20:01:15 +01: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 Also point to free named region on lifetime errors 2018-06-28 11:12:44 -07:00
regions-bound-missing-bound-in-impl.stderr Also point to free named region on lifetime errors 2018-06-28 11:12:44 -07:00
regions-escape-bound-fn-2.nll.stderr Improved closure errors. 2018-07-22 12:49:35 +01:00
regions-escape-bound-fn-2.rs
regions-escape-bound-fn-2.stderr
regions-escape-bound-fn.nll.stderr Improved closure errors. 2018-07-22 12:49:35 +01:00
regions-escape-bound-fn.rs
regions-escape-bound-fn.stderr
regions-escape-unboxed-closure.nll.stderr Improved closure errors. 2018-07-22 12:49:35 +01:00
regions-escape-unboxed-closure.rs
regions-escape-unboxed-closure.stderr
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 Update tests that use -Z borrowck=compare or #[feature(nll)] to accmmodate diagnostic change. 2018-07-31 14:36:50 +02: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 Add specific message when moving from upvars in a non-FnOnce closure 2018-07-21 18:40:46 +01:00
unboxed-closures-move-upvar-from-non-once-ref-closure.rs
unboxed-closures-move-upvar-from-non-once-ref-closure.stderr