rust/src/test/ui/span
bors 4aa7879b55 Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank
Use larger span for adjustment THIR expressions

Currently, we use a relatively 'small' span for THIR
expressions generated by an 'adjustment' (e.g. an autoderef,
autoborrow, unsizing). As a result, if a borrow generated
by an adustment ends up causing a borrowcheck error, for example:

```rust
let mut my_var = String::new();
let my_ref = &my_var
my_var.push('a');
my_ref;
```

then the span for the mutable borrow may end up referring
to only the base expression (e.g. `my_var`), rather than
the method call which triggered the mutable borrow
(e.g. `my_var.push('a')`)

Due to a quirk of the MIR borrowck implementation,
this doesn't always get exposed in migration mode,
but it does in many cases.

This commit makes THIR building consistently use 'larger'
spans for adjustment expressions. These spans are recoded
when we first create the adjustment during typecheck. For
example, an autoref adjustment triggered by a method call
will record the span of the entire method call.

The intent of this change it make it clearer to users
when it's the specific way in which a variable is
used (for example, in a method call) that produdes
a borrowcheck error. For example, an error message
claiming that a 'mutable borrow occurs here' might
be confusing if it just points at a usage of a variable
(e.g. `my_var`), when no `&mut` is in sight. Pointing
at the entire expression should help to emphasize
that the method call itself is responsible for
the mutable borrow.

In several cases, this makes the `#![feature(nll)]` diagnostic
output match up exactly with the default (migration mode) output.
As a result, several `.nll.stderr` files end up getting removed
entirely.
2021-09-30 01:40:30 +00:00
..
auxiliary Properly handle Spans that reference imported SourceFiles 2020-03-18 23:56:42 -04:00
borrowck-borrow-overloaded-auto-deref-mut.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-borrow-overloaded-auto-deref-mut.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
borrowck-borrow-overloaded-deref-mut.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-borrow-overloaded-deref-mut.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-call-is-borrow-issue-12224.rs Update tests for changes to cannot move errors 2019-06-03 14:55:29 +01:00
borrowck-call-is-borrow-issue-12224.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
borrowck-call-method-from-mut-aliasable.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-call-method-from-mut-aliasable.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
borrowck-fn-in-const-b.rs Remove licenses 2018-12-25 21:08:33 -07:00
borrowck-fn-in-const-b.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
borrowck-let-suggestion-suffixes.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-let-suggestion-suffixes.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
borrowck-object-mutability.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
borrowck-object-mutability.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
borrowck-ref-into-rvalue.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
borrowck-ref-into-rvalue.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
coerce-suggestions.rs Remove box syntax from most places in src/test outside of the issues dir 2021-09-26 04:07:44 +02:00
coerce-suggestions.stderr Remove box syntax from most places in src/test outside of the issues dir 2021-09-26 04:07:44 +02:00
destructor-restrictions.rs Remove licenses 2018-12-25 21:08:33 -07:00
destructor-restrictions.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
dropck-object-cycle.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
dropck-object-cycle.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
dropck_arr_cycle_checked.rs Remove compile-fail test suite 2020-12-29 23:39:56 +03:00
dropck_arr_cycle_checked.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_direct_cycle_with_drop.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck_direct_cycle_with_drop.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_misc_variants.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck_misc_variants.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck_vec_cycle_checked.rs Remove compile-fail test suite 2020-12-29 23:39:56 +03:00
dropck_vec_cycle_checked.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
E0046.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0046.stderr Remove licenses 2018-12-25 21:08:33 -07:00
E0057.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0057.stderr On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
E0072.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0072.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
E0204.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0204.stderr Show macro name in 'this error originates in macro' message 2021-05-12 19:03:06 -04:00
E0493.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0493.stderr update tests 2020-06-20 20:38:57 +00:00
E0535.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0535.stderr Update tests 2019-03-11 23:10:26 +03:00
E0536.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0536.stderr Update tests 2019-03-11 23:10:26 +03:00
E0537.rs Remove licenses 2018-12-25 21:08:33 -07:00
E0537.stderr Update tests 2019-03-11 23:10:26 +03:00
gated-features-attr-spans.rs Make sure feature gate errors are recoverable (take 2) 2019-01-06 14:58:17 +03:00
gated-features-attr-spans.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
impl-wrong-item-for-trait.rs Remove licenses 2018-12-25 21:08:33 -07:00
impl-wrong-item-for-trait.stderr path trimming: ignore type aliases 2021-02-06 12:03:48 +02:00
import-ty-params.rs Point only at generic arguments when they are unexpected 2021-01-26 15:59:43 -08:00
import-ty-params.stderr Point only at generic arguments when they are unexpected 2021-01-26 15:59:43 -08:00
issue-7575.rs Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
issue-7575.stderr Fix incorrect disambiguation suggestion for associated items 2021-09-25 21:47:33 +02:00
issue-11925.rs Remove box syntax from most places in src/test outside of the issues dir 2021-09-26 04:07:44 +02:00
issue-11925.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-15480.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-15480.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-23338-locals-die-before-temps-of-body.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-23338-locals-die-before-temps-of-body.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
issue-23729.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-23729.stderr Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
issue-23827.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-23827.stderr Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
issue-24356.rs Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
issue-24356.stderr Suggest missing item from trait in impl 2019-11-06 10:00:59 -08:00
issue-24690.rs Use check-pass in ui tests where appropriate 2019-11-04 16:03:46 +01:00
issue-24690.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
issue-24805-dropck-child-has-items-via-parent.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-24805-dropck-child-has-items-via-parent.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-24805-dropck-trait-has-items.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-24805-dropck-trait-has-items.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-24895-copy-clone-dropck.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-24895-copy-clone-dropck.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-25199.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-25199.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-26656.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
issue-26656.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue-27522.rs Refer to "self type" instead of "receiver type" 2019-09-02 19:07:04 -07:00
issue-27522.stderr Refer to "self type" instead of "receiver type" 2019-09-02 19:07:04 -07:00
issue-29106.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-29106.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
issue-29595.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-29595.stderr Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
issue-33884.rs Drop support for cloudabi targets 2020-11-22 17:11:41 -05:00
issue-33884.stderr Show macro name in 'this error originates in macro' message 2021-05-12 19:03:06 -04:00
issue-34264.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-34264.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
issue-35987.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-35987.stderr reword "possible candidate" import suggestion 2020-05-07 00:33:25 -04:00
issue-36530.rs resolve: Centralize some error reporting for unexpected macro resolutions 2020-11-19 19:25:20 +03:00
issue-36530.stderr resolve: Centralize some error reporting for unexpected macro resolutions 2020-11-19 19:25:20 +03:00
issue-36537.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-36537.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
issue-37767.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-37767.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
issue-39018.rs Update tests 2019-12-12 20:56:14 +01:00
issue-39018.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
issue-39698.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-39698.stderr resolve: Sort E0408 errors by Symbol str 2020-06-04 16:00:31 +01:00
issue-40157.rs Remove licenses 2018-12-25 21:08:33 -07:00
issue-40157.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
issue-42234-unknown-receiver-type.full.stderr Actually infer args in visitors 2021-07-26 21:15:18 +00:00
issue-42234-unknown-receiver-type.generic_arg.stderr Actually infer args in visitors 2021-07-26 21:15:18 +00:00
issue-42234-unknown-receiver-type.rs Actually infer args in visitors 2021-07-26 21:15:18 +00:00
issue-43927-non-ADT-derive.rs expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
issue-43927-non-ADT-derive.stderr expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
issue-81800.rs Fix SourceMap::start_point 2021-02-07 23:23:09 +03:00
issue-81800.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
issue28498-reject-ex1.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue28498-reject-ex1.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
issue28498-reject-lifetime-param.rs Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-lifetime-param.stderr Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-passed-to-fn.rs Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-passed-to-fn.stderr Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-trait-bound.rs Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
issue28498-reject-trait-bound.stderr Remove feature gate dropck_parametricity completely 2019-07-11 18:44:56 +00:00
lint-unused-unsafe.mir.stderr Test THIR unsafeck for unsafe ops in closures 2021-05-27 21:04:44 +02:00
lint-unused-unsafe.rs Test THIR unsafeck for unsafe ops in closures 2021-05-27 21:04:44 +02:00
lint-unused-unsafe.thir.stderr Test THIR unsafeck for unsafe ops in closures 2021-05-27 21:04:44 +02:00
macro-span-replacement.rs Moving more build-pass tests to check-pass 2020-04-23 20:21:38 -07:00
macro-span-replacement.stderr Show macro name in 'this error originates in macro' message 2021-05-12 19:03:06 -04:00
macro-ty-params.rs expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
macro-ty-params.stderr expand/resolve: Turn #[derive] into a regular macro attribute 2021-02-07 20:08:45 +03:00
method-and-field-eager-resolution.rs Remove licenses 2018-12-25 21:08:33 -07:00
method-and-field-eager-resolution.stderr Remove licenses 2018-12-25 21:08:33 -07:00
missing-unit-argument.rs Specify if struct/enum in arg mismatch error 2021-06-20 13:48:37 -04:00
missing-unit-argument.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
move-closure.rs Remove licenses 2018-12-25 21:08:33 -07:00
move-closure.stderr Point at type in let assignment on type errors 2019-11-21 19:24:31 -08:00
multiline-span-E0072.rs Remove licenses 2018-12-25 21:08:33 -07:00
multiline-span-E0072.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
multiline-span-simple.rs Remove licenses 2018-12-25 21:08:33 -07:00
multiline-span-simple.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
multispan-import-lint.rs Moving more build-pass tests to check-pass 2020-04-23 20:21:38 -07:00
multispan-import-lint.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
mut-arg-hint.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
mut-arg-hint.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
mut-ptr-cant-outlive-ref.rs Remove licenses 2018-12-25 21:08:33 -07:00
mut-ptr-cant-outlive-ref.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
non-existing-module-import.rs Remove licenses 2018-12-25 21:08:33 -07:00
non-existing-module-import.stderr Update tests 2019-03-11 23:10:26 +03:00
pub-struct-field.rs Remove licenses 2018-12-25 21:08:33 -07:00
pub-struct-field.stderr Update tests 2019-03-11 23:10:26 +03:00
range-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
range-2.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
recursive-type-field.rs Remove licenses 2018-12-25 21:08:33 -07:00
recursive-type-field.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
regionck-unboxed-closure-lifetimes.rs Remove licenses 2018-12-25 21:08:33 -07:00
regionck-unboxed-closure-lifetimes.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
regions-close-over-borrowed-ref-in-obj.rs Remove box syntax from most places in src/test outside of the issues dir 2021-09-26 04:07:44 +02:00
regions-close-over-borrowed-ref-in-obj.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
regions-close-over-type-parameter-2.rs Remove box syntax from most places in src/test outside of the issues dir 2021-09-26 04:07:44 +02:00
regions-close-over-type-parameter-2.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-escape-loop-via-variable.rs Remove licenses 2018-12-25 21:08:33 -07:00
regions-escape-loop-via-variable.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-escape-loop-via-vec.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
regions-escape-loop-via-vec.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
regions-infer-borrow-scope-within-loop.rs Remove licenses 2018-12-25 21:08:33 -07:00
regions-infer-borrow-scope-within-loop.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
send-is-not-static-ensures-scoping.rs Update ui test suite to use dyn 2019-05-29 00:57:31 -04:00
send-is-not-static-ensures-scoping.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
send-is-not-static-std-sync-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
send-is-not-static-std-sync-2.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
send-is-not-static-std-sync.rs Remove licenses 2018-12-25 21:08:33 -07:00
send-is-not-static-std-sync.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
slice-borrow.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
slice-borrow.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
suggestion-non-ascii.rs Remove double trailing newlines 2019-04-22 16:57:01 +01:00
suggestion-non-ascii.stderr Update tests 2019-03-11 23:10:26 +03:00
transitive-dep-span.rs fix rebase fallout 2020-03-24 06:28:56 +01:00
transitive-dep-span.stderr Remove trailing whitespace from error messages 2021-08-04 10:48:30 +02:00
type-annotations-needed-expr.rs Point at method call on missing annotation error 2019-08-25 13:39:11 -07:00
type-annotations-needed-expr.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
type-binding.rs Remove licenses 2018-12-25 21:08:33 -07:00
type-binding.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
typo-suggestion.rs Remove licenses 2018-12-25 21:08:33 -07:00
typo-suggestion.stderr Update tests 2019-03-11 23:10:26 +03:00
unused-warning-point-at-identifier.rs Use ident instead of def_span in dead-code pass 2019-10-26 21:42:52 -04:00
unused-warning-point-at-identifier.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
vec-must-not-hide-type-from-dropck.rs Remove licenses 2018-12-25 21:08:33 -07:00
vec-must-not-hide-type-from-dropck.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
vec_refs_data_with_early_death.rs Remove licenses 2018-12-25 21:08:33 -07:00
vec_refs_data_with_early_death.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
visibility-ty-params.rs Do not abort compilation if expansion produces errors 2018-12-27 15:51:36 +03:00
visibility-ty-params.stderr Point only at generic arguments when they are unexpected 2021-01-26 15:59:43 -08:00
wf-method-late-bound-regions.rs Remove licenses 2018-12-25 21:08:33 -07:00
wf-method-late-bound-regions.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00