rust/compiler
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
..
rustc Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_apfloat Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_arena Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_ast Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_ast_lowering rustc_index: Add some map-like APIs to IndexVec 2021-09-22 03:11:29 +03:00
rustc_ast_passes Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_ast_pretty Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_attr Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_borrowck More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_builtin_macros derive: Do not configure or clone items unless necessary 2021-09-24 21:45:51 +03:00
rustc_codegen_cranelift Auto merge of #89092 - bjorn3:sync_cg_clif-2021-09-19, r=bjorn3 2021-09-26 23:31:01 +00:00
rustc_codegen_gcc Merge commit 'cd4810de42c57b64b74dae09c530a4c3a41f87b9' into libgccjit-codegen 2021-09-28 09:33:06 -04:00
rustc_codegen_llvm Enable new pass manager on LLVM 13 2021-09-25 11:24:23 +02:00
rustc_codegen_ssa Auto merge of #89030 - nbdd0121:box2, r=jonas-schievink 2021-09-25 11:01:13 +00:00
rustc_const_eval Report heap allocation instead of non-const fn for exchange_malloc call 2021-09-25 01:08:41 +01:00
rustc_data_structures More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_driver Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_error_codes Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_errors Rollup merge of #89046 - oli-obk:fix_oflo, r=estebank 2021-09-22 19:03:22 +02:00
rustc_expand Check for macros in built-in attributes that don't support them. 2021-09-25 09:03:15 -07:00
rustc_feature Stabilize feature(macro_attributes_in_derive_output) 2021-09-24 21:48:30 +03:00
rustc_fs_util Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_graphviz Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_hir Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank 2021-09-21 19:25:49 +00:00
rustc_hir_pretty Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_incremental Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_index rustc_index: Add some map-like APIs to IndexVec 2021-09-22 03:11:29 +03:00
rustc_infer More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_interface rustc_session: Remove lint store from Session 2021-09-28 11:56:15 +03:00
rustc_lexer Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_lint rustc_session: Remove lint store from Session 2021-09-28 11:56:15 +03:00
rustc_lint_defs Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obk 2021-09-22 06:43:33 +00:00
rustc_llvm Use correct pipeline for LTO at O0 2021-09-25 11:24:23 +02:00
rustc_macros Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_metadata Auto merge of #89016 - lcnr:non_blanket_impls, r=nikomatsakis,michaelwoerister 2021-09-23 15:44:53 +00:00
rustc_middle More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_mir_build Auto merge of #89110 - Aaron1011:adjustment-span, r=estebank 2021-09-30 01:40:30 +00:00
rustc_mir_dataflow More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_mir_transform Auto merge of #89030 - nbdd0121:box2, r=jonas-schievink 2021-09-25 11:01:13 +00:00
rustc_monomorphize Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_parse Check for macros in built-in attributes that don't support them. 2021-09-25 09:03:15 -07:00
rustc_parse_format Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_passes Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obk 2021-09-22 06:43:33 +00:00
rustc_plugin_impl Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_privacy Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank 2021-09-21 19:25:49 +00:00
rustc_query_impl Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank 2021-09-24 05:29:49 +00:00
rustc_query_system Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_resolve More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_save_analysis Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_serialize Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_session rustc_session: Remove lint store from Session 2021-09-28 11:56:15 +03:00
rustc_span Rollup merge of #89072 - bjorn3:less_symbol_as_str, r=michaelwoerister 2021-09-24 11:40:12 -07:00
rustc_symbol_mangling Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_target Add SOLID targets 2021-09-28 11:31:47 +09:00
rustc_trait_selection More tracing instrumentation 2021-09-28 12:28:22 +00:00
rustc_traits Improve cause information for NLL higher-ranked errors 2021-09-27 10:23:45 -05:00
rustc_ty_utils Auto merge of #89144 - sexxi-goose:insig_stdlib, r=nikomatsakis 2021-09-26 19:36:00 +00:00
rustc_type_ir Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_typeck Auto merge of #89331 - GuillaumeGomez:rollup-b10unye, r=GuillaumeGomez 2021-09-29 10:39:41 +00:00