rust/src/test/ui/dropck
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 Remove licenses 2018-12-25 21:08:33 -07:00
drop-on-non-struct.rs clarify that Drop can be implemented for enums and unions too 2020-01-03 17:57:24 -05:00
drop-on-non-struct.stderr clarify that Drop can be implemented for enums and unions too 2020-01-03 17:57:24 -05:00
drop-with-active-borrows-1.rs Remove licenses 2018-12-25 21:08:33 -07:00
drop-with-active-borrows-1.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
drop-with-active-borrows-2.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
drop-with-active-borrows-2.stderr Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
dropck-eyepatch-extern-crate.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck-eyepatch-extern-crate.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
dropck-eyepatch-implies-unsafe-impl.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck-eyepatch-implies-unsafe-impl.stderr Update tests 2019-03-11 23:10:26 +03:00
dropck-eyepatch-reorder.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck-eyepatch-reorder.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck-eyepatch.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck-eyepatch.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
dropck-union.rs stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union' 2020-10-16 11:33:33 +02:00
dropck-union.stderr stabilize union with 'ManuallyDrop' fields and 'impl Drop for Union' 2020-10-16 11:33:33 +02:00
dropck_fn_type.rs Add regression tests 2019-12-05 12:28:29 -05:00
dropck_no_diverge_on_nonregular_1.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck_no_diverge_on_nonregular_1.stderr standardize limit comparisons with Limit type 2020-05-28 10:33:07 +01:00
dropck_no_diverge_on_nonregular_2.rs Remove licenses 2018-12-25 21:08:33 -07:00
dropck_no_diverge_on_nonregular_2.stderr standardize limit comparisons with Limit type 2020-05-28 10:33:07 +01:00
dropck_no_diverge_on_nonregular_3.rs pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
dropck_no_diverge_on_nonregular_3.stderr pretty: trim paths of unique symbols 2020-09-02 22:26:37 +03:00
dropck_trait_cycle_checked.rs Remove compile-fail test suite 2020-12-29 23:39:56 +03:00
dropck_trait_cycle_checked.stderr rustc_mir: use the right type for associated const literals. 2019-08-16 15:20:27 +03:00
dropck_traits.rs Add regression tests 2019-12-05 12:28:29 -05:00
issue-28498-ugeh-with-lifetime-param.rs Move some tests to more reasonable directories - 2 2021-01-16 19:46:54 -03:00
issue-28498-ugeh-with-trait-bound.rs Move some tests to more reasonable directories - 2 2021-01-16 19:46:54 -03:00
issue-29844.rs Move some tests to more reasonable directories - 2 2021-01-16 19:46:54 -03:00
issue-38868.rs move dropck tests from ui -> ui/dropck 2020-11-12 15:31:52 +01:00
issue-38868.stderr move dropck tests from ui -> ui/dropck 2020-11-12 15:31:52 +01:00
reject-specialized-drops-8142.rs update tests 2020-12-26 18:24:10 +01:00
reject-specialized-drops-8142.stderr update tests 2020-12-26 18:24:10 +01:00