rust/compiler
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
..
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 Check that TAIT generics are fully generic in mir typeck instead of wf-check, as wf-check can by definition only check TAIT in return position and not account for TAITs defined in the body of the function 2021-09-23 13:35:16 +00:00
rustc_builtin_macros Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkov 2021-09-24 11:54:29 +00:00
rustc_codegen_cranelift Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_codegen_llvm Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank 2021-09-24 05:29:49 +00:00
rustc_codegen_ssa Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank 2021-09-24 05:29:49 +00:00
rustc_const_eval Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_data_structures Auto merge of #89158 - the8472:rollup-3e4ijth, r=the8472 2021-09-21 22:07:32 +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 Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_feature Support #[track_caller] on closures and generators 2021-09-22 15:19:33 -05: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 Auto merge of #89211 - workingjubilee:rollup-fj4eduk, r=workingjubilee 2021-09-24 01:48:02 +00:00
rustc_interface Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_lexer Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_lint Auto merge of #88865 - guswynn:must_not_suspend, r=oli-obk 2021-09-22 06:43:33 +00: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 Rollup merge of #89041 - sticnarf:sticnarf/fat-lto-dwarf, r=nagisa 2021-09-22 19:03:21 +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 Auto merge of #89120 - In-line:remove_unneded_visible_parents_map, r=estebank 2021-09-24 05:29:49 +00:00
rustc_mir_build Use larger span for adjustments on method calls 2021-09-25 10:00:41 -05:00
rustc_mir_dataflow Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_mir_transform Support #[track_caller] on closures and generators 2021-09-22 15:19:33 -05:00
rustc_monomorphize Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_parse Auto merge of #88835 - FabianWolff:issue-88770, r=petrochenkov 2021-09-24 11:54:29 +00: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 resolve: Refactor obtaining Module from its DefId 2021-09-24 18:57:15 +03: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 Rollup merge of #89133 - FabianWolff:issue-79546, r=michaelwoerister 2021-09-22 19:03:24 +02:00
rustc_span Auto merge of #87064 - Aaron1011:new-closure-track-caller, r=estebank 2021-09-23 12:26:51 +00:00
rustc_symbol_mangling Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_target Rollup merge of #89170 - rusticstuff:aarch64_macos_disable_leak_sanitizer, r=petrochenkov 2021-09-22 19:03:27 +02:00
rustc_trait_selection Auto merge of #88804 - Mark-Simulacrum:never-algo-v2, r=nikomatsakis,jackh726 2021-09-23 22:45:22 +00:00
rustc_traits Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_ty_utils Auto merge of #89103 - Mark-Simulacrum:migrate-2021, r=estebank 2021-09-21 19:25:49 +00:00
rustc_type_ir Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_typeck Auto merge of #89211 - workingjubilee:rollup-fj4eduk, r=workingjubilee 2021-09-24 01:48:02 +00:00