rust/src/test/ui/methods
Aaron Hill 4d66986e09
Use larger span for adjustments on method calls
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

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-25 10:00:41 -05:00
..
auxiliary
assign-to-method.rs
assign-to-method.stderr
method-ambig-one-trait-unknown-int-type.rs
method-ambig-one-trait-unknown-int-type.stderr Use smaller spans for some structured suggestions 2021-08-12 09:52:38 +00:00
method-ambig-two-traits-cross-crate.rs
method-ambig-two-traits-cross-crate.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-ambig-two-traits-from-bounds.rs
method-ambig-two-traits-from-bounds.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-ambig-two-traits-from-impls.rs
method-ambig-two-traits-from-impls.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-ambig-two-traits-from-impls2.rs
method-ambig-two-traits-from-impls2.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-ambig-two-traits-with-default-method.rs
method-ambig-two-traits-with-default-method.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-argument-inference-associated-type.rs
method-call-err-msg.rs Avoid describing a method as 'not found' when bounds are unsatisfied 2021-01-26 23:59:50 -05:00
method-call-err-msg.stderr Avoid describing a method as 'not found' when bounds are unsatisfied 2021-01-26 23:59:50 -05:00
method-call-lifetime-args-fail.rs improve diagnosts for GATs 2021-05-11 14:09:46 +02:00
method-call-lifetime-args-fail.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-call-lifetime-args-lint-fail.rs
method-call-lifetime-args-lint-fail.stderr
method-call-lifetime-args-lint.rs
method-call-lifetime-args-lint.stderr
method-call-lifetime-args-subst-index.rs
method-call-lifetime-args-unresolved.rs Fix tests and AstConv -> dyn AstConv 2021-03-31 10:16:37 -04:00
method-call-lifetime-args-unresolved.stderr Fix tests and AstConv -> dyn AstConv 2021-03-31 10:16:37 -04:00
method-call-lifetime-args.rs
method-call-lifetime-args.stderr
method-call-type-binding.rs
method-call-type-binding.stderr
method-deref-to-same-trait-object-with-separate-params.rs Make tidy happy 2020-10-27 14:45:34 -03:00
method-deref-to-same-trait-object-with-separate-params.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-early-bound-lifetimes-on-self.rs
method-lookup-order.rs Test exploring the interactions between all of the different kinds of method collisions I could imagine. 2021-02-01 17:08:37 -05:00
method-macro-backtrace.rs
method-macro-backtrace.stderr
method-missing-call.rs
method-missing-call.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-mut-self-modifies-mut-slice-lvalue.rs
method-normalize-bounds-issue-20604.rs
method-not-found-generic-arg-elision.rs change from review and show full type if it can be deref 2021-05-22 12:38:48 +02:00
method-not-found-generic-arg-elision.stderr show list of candidates 2021-05-25 16:55:30 +02:00
method-on-ambiguous-numeric-type.rs
method-on-ambiguous-numeric-type.stderr Modify structured suggestion output 2021-08-11 09:46:24 +00:00
method-path-in-pattern.rs
method-path-in-pattern.stderr
method-probe-no-guessing-dyn-trait.rs
method-projection.rs
method-recursive-blanket-impl.rs
method-resolvable-path-in-pattern.rs
method-resolvable-path-in-pattern.stderr
method-self-arg-1.rs
method-self-arg-1.stderr
method-self-arg-2.rs
method-self-arg-2.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
method-self-arg-aux1.rs
method-self-arg-aux2.rs
method-self-arg-trait.rs
method-self-arg.rs
method-trait-object-with-hrtb.rs
method-two-trait-defer-resolution-1.rs
method-two-trait-defer-resolution-2.rs
method-two-traits-distinguished-via-where-clause.rs
method-where-clause.rs