rust/compiler
bors bf62436bce Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obk
Map RPIT duplicated lifetimes back to fn captured lifetimes

Use the [`lifetime_mapping`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.OpaqueTy.html#structfield.lifetime_mapping) to map an RPIT's captured lifetimes back to the early- or late-bound lifetimes from its parent function. We may be going thru several layers of mapping, since opaques can be nested, so we introduce `TyCtxt::map_rpit_lifetime_to_fn_lifetime` to loop through several opaques worth of mapping, and handle turning it into a `ty::Region` as well.

We can then use this instead of the identity substs for RPITs in `check_opaque_meets_bounds` to address #114285.

We can then also use `map_rpit_lifetime_to_fn_lifetime` to properly install bidirectional-outlives predicates for both RPITs and RPITITs. This addresses #114601.

I based this on #114574, but I don't actually know how much of that PR we still need, so some code may be redundant now... 🤷

---

Fixes #114597
Fixes #114579
Fixes #114285

Also fixes #114601, since it turns out we had other bugs with RPITITs and their duplicated lifetime params 😅.

Supersedes #114574

r? `@oli-obk`
2023-08-08 13:03:10 +00:00
..
rustc inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
rustc_abi Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_arena Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_ast Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
rustc_ast_lowering Unconditionally record lifetime mapping 2023-08-08 03:16:04 +00:00
rustc_ast_passes inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
rustc_ast_pretty Improve spans for indexing expressions 2023-08-04 13:17:39 +02:00
rustc_attr [rustc_attr][nit] Replace filter + is_some with map_or. 2023-08-01 12:39:32 -07:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_builtin_macros Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
rustc_codegen_cranelift Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot 2023-08-07 05:29:12 +02:00
rustc_codegen_gcc Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot 2023-08-07 05:29:12 +02:00
rustc_codegen_llvm Update powerpc data layouts 2023-08-07 20:35:55 +02:00
rustc_codegen_ssa Rollup merge of #114500 - taiki-e:arm-crypto, r=Amanieu 2023-08-08 03:30:55 +02:00
rustc_const_eval Auto merge of #114520 - RalfJung:unsized-valtrees, r=oli-obk 2023-08-08 07:48:01 +00:00
rustc_data_structures Auto merge of #114339 - ttsugriy:unsafe-utf8, r=davidtwco 2023-08-08 10:25:37 +00:00
rustc_driver
rustc_driver_impl rustc_interface: Dismantle register_plugins query 2023-08-07 19:33:23 +08:00
rustc_error_codes Auto merge of #109348 - cjgillot:issue-109146, r=petrochenkov 2023-08-05 11:52:07 +00:00
rustc_error_messages Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_errors Auto merge of #114104 - oli-obk:syn2, r=compiler-errors 2023-08-04 18:46:19 +00:00
rustc_expand Auto merge of #114104 - oli-obk:syn2, r=compiler-errors 2023-08-04 18:46:19 +00:00
rustc_feature Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk 2023-08-07 16:47:57 +02:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obk 2023-08-08 13:03:10 +00:00
rustc_hir_analysis Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obk 2023-08-08 13:03:10 +00:00
rustc_hir_pretty Improve spans for indexing expressions 2023-08-04 13:17:39 +02:00
rustc_hir_typeck Rollup merge of #114594 - compiler-errors:new-solver-resolve-aliases, r=lcnr 2023-08-08 03:30:56 +02:00
rustc_incremental Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_index Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_infer Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_interface rustc_interface: Dismantle register_plugins query 2023-08-07 19:33:23 +08:00
rustc_lexer Update lexer emoji diagnostics to Unicode 15.0 2023-07-29 08:47:21 +08:00
rustc_lint Rollup merge of #114486 - Urgau:const-context-nan-suggestion-114471, r=compiler-errors 2023-08-06 03:56:09 +02:00
rustc_lint_defs Auto merge of #114414 - cjgillot:early-unnameable-test, r=petrochenkov 2023-08-04 14:13:11 +00:00
rustc_llvm Fix LLVM version check for ThinLTO import/export lists 2023-08-07 20:36:14 +02:00
rustc_log inline format!() args up to and including rustc_middle 2023-07-30 13:18:33 +02:00
rustc_macros Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_metadata Auto merge of #114578 - petrochenkov:noplugin, r=cjgillot 2023-08-08 05:10:11 +00:00
rustc_middle Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obk 2023-08-08 13:03:10 +00:00
rustc_mir_build Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_mir_dataflow Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJung 2023-08-06 17:26:29 +02:00
rustc_mir_transform Auto merge of #113902 - Enselic:lint-recursive-drop, r=oli-obk 2023-08-07 13:39:28 +00:00
rustc_monomorphize Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
rustc_parse Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31 2023-08-04 21:31:57 +02:00
rustc_parse_format
rustc_passes Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_plugin_impl
rustc_privacy Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
rustc_query_impl Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_query_system Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_resolve Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_serialize
rustc_session Auto merge of #114104 - oli-obk:syn2, r=compiler-errors 2023-08-04 18:46:19 +00:00
rustc_smir Add TraitDef::trait_decl method 2023-08-07 10:24:12 -03:00
rustc_span Rollup merge of #114549 - chenyukang:yukang-review-resolve-part, r=petrochenkov 2023-08-07 05:29:13 +02:00
rustc_symbol_mangling avoid 'miri' when refering to the shared interpreter 2023-08-02 16:52:03 +02:00
rustc_target Rollup merge of #114497 - taiki-e:revert-riscv-atomic, r=Amanieu 2023-08-08 03:30:55 +02:00
rustc_trait_selection Rollup merge of #114594 - compiler-errors:new-solver-resolve-aliases, r=lcnr 2023-08-08 03:30:56 +02:00
rustc_traits
rustc_transmute Don't attempt to compute layout of type referencing error 2023-07-27 18:24:08 +00:00
rustc_ty_utils Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obk 2023-08-08 13:03:10 +00:00
rustc_type_ir Rollup merge of #114355 - compiler-errors:resolve_vars_early, r=lcnr 2023-08-04 09:18:59 +02:00