rust/compiler
bors da1d099f91 Auto merge of #112945 - compiler-errors:tighten-span-of-adjustment-error, r=oli-obk
(re-)tighten sourceinfo span of adjustments in MIR

Diagnostics rely on the spans of MIR statements being (approximately) correct in order to give suggestions relative to that span (i.e. `shrink_to_hi` and `shrink_to_lo`).

I discovered that we're *intentionally* lowering THIR exprs with their parent expr's span if they come from adjustments that are due to a parent expression. While I understand why that may be desirable to demonstrate the relationship of an adjustment and the expression that requires it, it leads to

1. very verbose borrowck output
2. incorrect spans for suggestions

Some diagnostics get around that by giving suggestions relative to other spans we've collected during MIR lowering, such as the span of the method's identifier (e.g. `name` in `.name()`), but this doesn't work too well when things come from desugaring.

I assume it also has lead to numerous tweaks and complications to diagnostics code down the road, which this PR doesn't necessarily aim to fix but may open the gates to fixing later... The last three commits are simplifications due to the fact that we can assume that the move span actually points to what is being moved (and a test).

This regressed in #89110, which was debated somewhat in #90286. cc `@Aaron1011` who originally made this change.

r? diagnostics

Fixes #113547
Fixes #111016
2023-07-12 12:11:09 +00:00
..
rustc
rustc_abi clean up struct layout code 2023-07-06 13:04:13 +00:00
rustc_apfloat
rustc_arena Extend unused_must_use to cover block exprs 2023-06-15 17:59:13 +08:00
rustc_ast Auto merge of #113270 - the8472:opt-macro-tts, r=nnethercote 2023-07-07 08:04:48 +00:00
rustc_ast_lowering include host_effect_index in Generics 2023-07-04 17:21:52 +00:00
rustc_ast_passes Lint against misplaced where-clauses on assoc tys in traits 2023-07-11 01:19:11 +02:00
rustc_ast_pretty Syntatically accept become expressions 2023-06-19 12:54:34 +00:00
rustc_attr Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_baked_icu_data
rustc_borrowck Auto merge of #112945 - compiler-errors:tighten-span-of-adjustment-error, r=oli-obk 2023-07-12 12:11:09 +00:00
rustc_builtin_macros fix typo 2023-06-28 10:52:48 +08:00
rustc_codegen_cranelift Rename adjustment::PointerCast and variants using it to PointerCoercion 2023-07-07 18:17:16 +02:00
rustc_codegen_gcc Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
rustc_codegen_llvm Reuse LLVMConstInBoundsGEP2 2023-07-10 00:20:56 -07:00
rustc_codegen_ssa Use constants from object crate 2023-07-11 23:48:18 +00:00
rustc_const_eval fix handling of alignment for dyn-sized places 2023-07-11 21:59:01 +02:00
rustc_data_structures Upgrade to indexmap 2.0.0 2023-07-03 13:51:54 -07:00
rustc_driver Update rustix 2023-07-03 07:20:51 +00:00
rustc_driver_impl Dynamically size sigaltstk in rustc 2023-07-10 12:05:16 -07:00
rustc_error_codes Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
rustc_error_messages Require TAITs to be mentioned in the signatures of functions that register hidden types for them 2023-07-07 13:13:18 +00:00
rustc_errors Add a simple markdown parser for formatting rustc --explain 2023-07-03 16:04:18 -04:00
rustc_expand perform TokenStream replacement in-place when possible in expand_macro 2023-07-03 13:29:15 +02:00
rustc_feature Add feature and attribute definition 2023-07-04 11:47:45 +00:00
rustc_fluent_macro Fix diagnostics with errors 2023-05-26 10:44:18 +00:00
rustc_fs_util
rustc_graphviz
rustc_hir Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_hir_analysis Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_hir_pretty hir: Add Become expression kind 2023-06-26 08:56:32 +00:00
rustc_hir_typeck Auto merge of #113573 - lcnr:typeck-results, r=compiler-errors 2023-07-12 07:50:40 +00:00
rustc_incremental Applied nits 2023-06-11 22:45:04 -04:00
rustc_index Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth 2023-05-25 00:33:43 +00:00
rustc_infer Rollup merge of #113567 - chenyukang:yukang-fix-113354-while-let, r=cjgillot 2023-07-11 21:00:28 -07:00
rustc_interface Remove chalk from the compiler 2023-07-03 21:40:04 +00:00
rustc_lexer Revert the lexing of c_str_literals 2023-07-05 13:11:17 +02:00
rustc_lint Auto merge of #111717 - Urgau:uplift_fn_null_check, r=oli-obk 2023-07-11 09:34:48 +00:00
rustc_lint_defs Lint against misplaced where-clauses on assoc tys in traits 2023-07-11 01:19:11 +02:00
rustc_llvm Reuse LLVMConstInBoundsGEP2 2023-07-10 00:20:56 -07:00
rustc_log Downgrade tracing and syn 2023-07-02 21:02:31 +02:00
rustc_macros Downgrade tracing and syn 2023-07-02 21:02:31 +02:00
rustc_metadata Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_middle Auto merge of #113569 - RalfJung:miri, r=oli-obk 2023-07-12 10:19:42 +00:00
rustc_mir_build Do not set up wrong span for adjustments 2023-07-10 20:09:26 +00:00
rustc_mir_dataflow Auto merge of #113316 - DrMeepster:underefer_perf, r=oli-obk 2023-07-11 06:52:53 +00:00
rustc_mir_transform miri: protect Move() function arguments during the call 2023-07-11 21:59:01 +02:00
rustc_monomorphize Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_parse Fix the issue of wrong diagnosis for extern pub fn 2023-07-05 16:25:46 +08:00
rustc_parse_format
rustc_passes Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_plugin_impl
rustc_privacy Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_query_impl Avoid calling queries during query stack printing 2023-06-27 16:12:07 +02:00
rustc_query_system Show which type was not specialized on query cycle misuse 2023-07-05 07:30:28 +00:00
rustc_resolve Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errors 2023-07-10 19:01:30 +00:00
rustc_serialize Upgrade to indexmap 2.0.0 2023-07-03 13:51:54 -07:00
rustc_session Auto merge of #112988 - spastorino:new-rpitit-24, r=compiler-errors 2023-07-10 19:01:30 +00:00
rustc_smir Implement a few more rvalue translation to smir 2023-07-10 11:47:48 -07:00
rustc_span Auto merge of #111717 - Urgau:uplift_fn_null_check, r=oli-obk 2023-07-11 09:34:48 +00:00
rustc_symbol_mangling Move TyCtxt::mk_x to Ty::new_x where applicable 2023-07-05 20:27:07 +01:00
rustc_target Add support for NetBSD/riscv64 aka. riscv64gc-unknown-netbsd. 2023-07-05 13:49:01 +00:00
rustc_trait_selection Auto merge of #113470 - compiler-errors:new-solver-structurally-resolve-pat, r=lcnr 2023-07-11 15:29:47 +00:00
rustc_traits get rid of a bit more calls to poly_select 2023-07-06 16:50:12 +00:00
rustc_transmute Put LayoutError behind reference to shrink result 2023-07-01 21:16:25 +02:00
rustc_ty_utils Replace RPITIT current impl with new strategy that lowers as a GAT 2023-07-08 18:21:34 -03:00
rustc_type_ir Add a new trait to Debug things with an infcx available 2023-07-06 11:36:39 +01:00