summary refs log tree commit diff
path: root/compiler/rustc_middle/src/ty
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-05 06:35:12 +0000
committerbors <bors@rust-lang.org>2022-08-05 06:35:12 +0000
commitcdfd675a63090182fd1c5f2ff58d8eaa115da156 (patch)
tree85180e0a30bcc147e3bfb6378eeb8d85870fb362 /compiler/rustc_middle/src/ty
parent6bcf01afdb1c21a30cdf1fd20f9cdef7c482e753 (diff)
parent4170d7390b90b5eee001d6292b3273dec6d67651 (diff)
downloadrust-cdfd675a63090182fd1c5f2ff58d8eaa115da156.tar.gz
rust-cdfd675a63090182fd1c5f2ff58d8eaa115da156.zip
Auto merge of #99867 - spastorino:refactor-remap-lifetimes, r=nikomatsakis
Split create_def and lowering of lifetimes for opaque types and bare async fns

r? `@cjgillot`

This work is kind of half-way, but I think it could be merged anyway.
I think we should be able to remove all the vacant arms in `new_named_lifetime_with_res`, if I'm not wrong that requires visiting more nodes. We can do that as a follow up.
In follow-up PRs, besides the thing mentioned previously, I'll be trying to remove `LifetimeCaptureContext`, `captured_lifetimes` as a global data structure, global `binders_to_ignore` and all their friends :).

Also try to remap in a more general way based on def-ids.
Diffstat (limited to 'compiler/rustc_middle/src/ty')
-rw-r--r--compiler/rustc_middle/src/ty/mod.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs
index 4b081316e23..02da02568d7 100644
--- a/compiler/rustc_middle/src/ty/mod.rs
+++ b/compiler/rustc_middle/src/ty/mod.rs
@@ -177,6 +177,11 @@ pub struct ResolverAstLowering {
     pub label_res_map: NodeMap<ast::NodeId>,
     /// Resolutions for lifetimes.
     pub lifetimes_res_map: NodeMap<LifetimeRes>,
+    /// Mapping from generics `def_id`s to TAIT generics `def_id`s.
+    /// For each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic
+    /// defined on the TAIT, so we have type Foo<'a1> = ... and we establish a mapping in this
+    /// field from the original parameter 'a to the new parameter 'a1.
+    pub generics_def_id_map: Vec<FxHashMap<LocalDefId, LocalDefId>>,
     /// Lifetime parameters that lowering will have to introduce.
     pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, LifetimeRes)>>,