rust/src/test/ui/match
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 Improve error message for non-exhaustive matches on non-exhaustive enums 2021-05-12 19:25:12 +02:00
const_non_normal_zst_ref_pattern.rs References to ZSTs may be at arbitrary aligned addresses 2020-09-30 10:40:49 +02:00
expr-match-panic-fn.rs
expr-match-panic.rs
guards.rs Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-33498.rs Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-41255.rs Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-41255.stderr Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-56685.rs Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-56685.stderr Move some tests to more reasonable directories 2021-09-15 14:03:27 -03:00
issue-70972-dyn-trait.rs Deduplicate errors in const to pat conversion 2020-09-23 17:03:31 +02:00
issue-70972-dyn-trait.stderr Deduplicate errors in const to pat conversion 2020-09-23 17:03:31 +02:00
issue-72680.rs update tests 2021-03-19 19:45:42 -05:00
issue-72896.rs
issue-74050-end-span.rs
issue-74050-end-span.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
issue-82392.rs add tests for new behavior 2021-04-23 14:06:02 -04:00
issue-82392.stdout Introduce hir::ExprKind::Let - Take 2 2021-08-15 16:18:26 -03:00
issue-84434.rs add tests for new behavior 2021-04-23 14:06:02 -04:00
match-arm-resolving-to-never.rs
match-arm-resolving-to-never.stderr
match-bot-panic.rs
match-disc-bot.rs
match-fn-call.rs
match-fn-call.stderr
match-ill-type2.rs
match-ill-type2.stderr
match-incompat-type-semi.rs Add test of incompatible match arm types with multiline arm 2020-10-22 16:11:57 -07:00
match-incompat-type-semi.stderr Reduce diagram mess in 'match arms have incompatible types' error 2020-10-22 16:16:02 -07:00
match-join.rs
match-join.stderr
match-no-arms-unreachable-after.rs
match-no-arms-unreachable-after.stderr
match-pattern-field-mismatch-2.rs
match-pattern-field-mismatch-2.stderr add suggestion for unit enum variant when matched with a patern 2021-05-02 13:58:38 +02:00
match-pattern-field-mismatch.rs
match-pattern-field-mismatch.stderr Adjust spans 2021-08-25 14:40:06 -07:00
match-range-fail-2.rs
match-range-fail-2.stderr
match-range-fail.rs char not char 2020-09-26 13:34:49 +01:00
match-range-fail.stderr char not char 2020-09-26 13:34:49 +01:00
match-ref-mut-invariance.nll.stderr Add variance-related information to lifetime error messages 2021-06-06 12:37:42 -05:00
match-ref-mut-invariance.rs
match-ref-mut-invariance.stderr
match-ref-mut-let-invariance.nll.stderr Add variance-related information to lifetime error messages 2021-06-06 12:37:42 -05:00
match-ref-mut-let-invariance.rs
match-ref-mut-let-invariance.stderr
match-ref-mut-stability.rs
match-struct.rs
match-struct.stderr
match-tag-nullary.rs
match-tag-nullary.stderr
match-tag-unary.rs
match-tag-unary.stderr
match-type-err-first-arm.rs
match-type-err-first-arm.stderr
match-unresolved-one-arm.rs
match-unresolved-one-arm.stderr
match-vec-mismatch-2.rs
match-vec-mismatch-2.stderr
match-wildcards.rs
match_non_exhaustive.rs Improve error message for non-exhaustive matches on non-exhaustive enums 2021-05-12 19:25:12 +02:00
match_non_exhaustive.stderr Improve error message for non-exhaustive matches on non-exhaustive enums 2021-05-12 19:25:12 +02:00
pattern-deref-miscompile.rs Implement destructuring for all aggregates and for references 2020-09-20 13:28:18 +02:00