rust/compiler/rustc_hir_analysis/src
Matthias Krüger ca7e27a71c
Rollup merge of #113182 - compiler-errors:rpit-stricter-captures, r=oli-obk
Error when RPITITs' hidden types capture more lifetimes than their trait definitions

This implements a stricter set of captures rules for RPITITs. They now may only capture:
1. Lifetimes from the impl header (both the self type and any trait substs -- we may want to restrict just to the self type's lifetimes, but the PR makes that easy to do, too)
2. Lifetimes mentioned by the `impl Trait` in the trait method's definition.

Namely, they may not mention lifetimes from the method (early or late) that are not mentioned in the `impl Trait`.

cc #105258 which I think was trying to do this too, though I'm not super familiar with what exactly differs from that or why that one was broken.
cc #112194 (doesn't fix this issue per se, because it's still an open question, but I think this is objectively better than the status quo, and gets us closer to resolving that issue.)

Technically is a fix for the ICE in #108580, but it turns that issue into an error now. We can decide separately whether or not nested RPITITs should capture lifetimes from their parents.

r? ``@oli-obk``
2023-07-01 13:46:01 +02:00
..
astconv Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errors 2023-07-01 01:53:10 +00:00
check Flip the order of binder instantiation for better diagnostics 2023-06-30 02:17:07 +00:00
coherence Simplify some conditions 2023-06-27 07:40:47 +00:00
collect Rollup merge of #113071 - compiler-errors:no-parent-non-lifetime-args-in-apit, r=eholk 2023-06-30 08:01:13 +02:00
impl_wf_check TypeWellFormedInEnv 2023-06-26 23:12:04 +00:00
outlives TypeWellFormedInEnv 2023-06-26 23:12:04 +00:00
structured_errors Use Option::is_some_and and Result::is_ok_and in the compiler 2023-05-24 14:20:41 +00:00
variance Properly implement variances_of for RPITIT GAT 2023-06-29 23:08:32 -03:00
autoderef.rs change snapshot tracking in fulfillment contexts 2023-06-29 10:02:26 +02:00
bounds.rs Fully fledged Clause type 2023-06-19 15:46:08 +00:00
check_unused.rs Remove last instances of HashSet in query result types. 2023-03-01 10:20:45 +01:00
collect.rs Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errors 2023-07-01 01:53:10 +00:00
constrained_generic_params.rs Migrate predicates_of and caller_bounds to Clause 2023-06-26 23:12:03 +00:00
errors.rs migrate lifetime too 2023-06-26 19:14:49 +00:00
hir_wf_check.rs s/Clause/ClauseKind 2023-06-19 14:57:42 +00:00
impl_wf_check.rs Error on unconstrained lifetime in RPITIT 2023-06-14 05:20:31 +00:00
lib.rs remove hash_drain_filter feature uses 2023-06-14 09:28:56 +02:00
structured_errors.rs