rust/compiler
Esteban Küber 9f730e92f2 Suggest setting lifetime in borrowck error involving types with elided lifetimes
```
error: lifetime may not live long enough
  --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:7:5
   |
LL | fn foo(mut x: Ref, y: Ref) {
   |        -----       - has type `Ref<'_, '1>`
   |        |
   |        has type `Ref<'_, '2>`
LL |     x.b = y.b;
   |     ^^^^^^^^^ assignment requires that `'1` must outlive `'2`
   |
help: consider introducing a named lifetime parameter
   |
LL | fn foo<'a>(mut x: Ref<'a, 'a>, y: Ref<'a, 'a>) {
   |       ++++           ++++++++        ++++++++
```

As can be seen above, it currently doesn't try to compare the `ty::Ty` lifetimes that diverged vs the `hir::Ty` to correctly suggest the following

```
help: consider introducing a named lifetime parameter
   |
LL | fn foo<'a>(mut x: Ref<'_, 'a>, y: Ref<'_, 'a>) {
   |       ++++           ++++++++        ++++++++
```

but I believe this to still be an improvement over the status quo.

CC #40990.
2024-05-17 20:31:13 +00:00
..
rustc
rustc_abi
rustc_arena
rustc_ast delegation: Implement list delegation 2024-05-15 02:32:59 +03:00
rustc_ast_ir
rustc_ast_lowering delegation: Implement list delegation 2024-05-15 02:32:59 +03:00
rustc_ast_passes
rustc_ast_pretty delegation: Implement list delegation 2024-05-15 02:32:59 +03:00
rustc_attr
rustc_baked_icu_data
rustc_borrowck Uplift Goal to rustc_type_ir 2024-05-16 14:24:22 -04:00
rustc_builtin_macros
rustc_codegen_cranelift
rustc_codegen_gcc
rustc_codegen_llvm coverage: CoverageIdsInfo::mcdc_bitmap_bytes is never needed 2024-05-14 16:41:04 +10:00
rustc_codegen_ssa Fix assertion when attempting to convert f16 and f128 with as 2024-05-16 04:07:02 -05:00
rustc_const_eval
rustc_data_structures
rustc_driver
rustc_driver_impl
rustc_error_codes
rustc_error_messages
rustc_errors Uplift FnSig 2024-05-16 09:52:01 -04:00
rustc_expand Rollup merge of #123694 - Xiretza:expand-diagnostics, r=compiler-errors 2024-05-17 07:20:56 +02:00
rustc_feature
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Uplift FnSig 2024-05-16 09:52:01 -04:00
rustc_hir_analysis to_opt_poly_X_pred -> as_X_clause 2024-05-17 12:58:33 -04:00
rustc_hir_pretty
rustc_hir_typeck to_opt_poly_X_pred -> as_X_clause 2024-05-17 12:58:33 -04:00
rustc_incremental
rustc_index
rustc_index_macros
rustc_infer Suggest setting lifetime in borrowck error involving types with elided lifetimes 2024-05-17 20:31:13 +00:00
rustc_interface
rustc_lexer
rustc_lint Remove trivial Binder::dummy calls 2024-05-16 14:24:23 -04:00
rustc_lint_defs Add `on_unimplemented" typo suggestions 2024-05-15 00:49:33 +02:00
rustc_llvm
rustc_log
rustc_macros
rustc_metadata
rustc_middle to_opt_poly_X_pred -> as_X_clause 2024-05-17 12:58:33 -04:00
rustc_mir_build
rustc_mir_dataflow
rustc_mir_transform coverage: CoverageIdsInfo::mcdc_bitmap_bytes is never needed 2024-05-14 16:41:04 +10:00
rustc_monomorphize
rustc_next_trait_solver
rustc_parse delegation: Implement list delegation 2024-05-15 02:32:59 +03:00
rustc_parse_format
rustc_passes delegation: Implement list delegation 2024-05-15 02:32:59 +03:00
rustc_pattern_analysis
rustc_privacy split out AliasTy -> AliasTerm 2024-05-13 11:59:42 -04:00
rustc_query_impl
rustc_query_system
rustc_resolve Auto merge of #123413 - petrochenkov:delegmulti2, r=fmease 2024-05-15 10:35:31 +00:00
rustc_sanitizers
rustc_serialize
rustc_session
rustc_smir Apply nits 2024-05-13 16:55:58 -04:00
rustc_span
rustc_symbol_mangling Add v0 symbol mangling for f16 and f128 2024-05-14 06:11:25 -04:00
rustc_target enable rust-lld on x86_64-unknown-linux-gnu when requested 2024-05-16 16:08:06 +00:00
rustc_trait_selection to_opt_poly_X_pred -> as_X_clause 2024-05-17 12:58:33 -04:00
rustc_traits split out AliasTy -> AliasTerm 2024-05-13 11:59:42 -04:00
rustc_transmute
rustc_ty_utils Rename ToPredicate for Upcast 2024-05-16 14:23:47 -04:00
rustc_type_ir Uplift Goal to rustc_type_ir 2024-05-16 14:24:22 -04:00
rustc_type_ir_macros
stable_mir split out AliasTy -> AliasTerm 2024-05-13 11:59:42 -04:00