1
Fork 0

Remap impl-trait lifetimes on HIR instead of AST lowering.

This commit is contained in:
Camille GILLOT 2024-08-20 00:48:43 +00:00
parent 298c7462c3
commit b6e1214ac0
35 changed files with 508 additions and 597 deletions

View file

@ -1781,6 +1781,23 @@ rustc_queries! {
-> &'tcx SortedMap<ItemLocalId, Vec<ty::BoundVariableKind>> {
desc { |tcx| "looking up late bound vars inside `{}`", tcx.def_path_str(owner_id) }
}
/// For an opaque type, return the list of (captured lifetime, inner generic param).
/// ```ignore (illustrative)
/// fn foo<'a: 'a, 'b, T>(&'b u8) -> impl Into<Self> + 'b { ... }
/// ```
///
/// We would return `[('a, '_a), ('b, '_b)]`, with `'a` early-bound and `'b` late-bound.
///
/// After hir_ty_lowering, we get:
/// ```ignore (pseudo-code)
/// opaque foo::<'a>::opaque<'_a, '_b>: Into<Foo<'_a>> + '_b;
/// ^^^^^^^^ inner generic params
/// fn foo<'a>: for<'b> fn(&'b u8) -> foo::<'a>::opaque::<'a, 'b>
/// ^^^^^^ captured lifetimes
/// ```
query opaque_captured_lifetimes(def_id: LocalDefId) -> &'tcx [(ResolvedArg, LocalDefId)] {
desc { |tcx| "listing captured lifetimes for opaque `{}`", tcx.def_path_str(def_id) }
}
/// Computes the visibility of the provided `def_id`.
///