Skip to content

Commit 966269a

Browse files
committed
Document generics_def_id_map field and record/get methods on it
1 parent 7858509 commit 966269a

File tree

2 files changed

+8
-1
lines changed
  • compiler

2 files changed

+8
-1
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ trait ResolverAstLoweringExt {
135135
fn get_lifetime_res(&self, id: NodeId) -> Option<LifetimeRes>;
136136
fn take_extra_lifetime_params(&mut self, id: NodeId) -> Vec<(Ident, NodeId, LifetimeRes)>;
137137
fn decl_macro_kind(&self, def_id: LocalDefId) -> MacroKind;
138+
/// Record the map from `from` local def id to `to` local def id, on `generics_def_id_map`
139+
/// field.
138140
fn record_def_id_remap(&mut self, from: LocalDefId, to: LocalDefId);
141+
/// Get the previously recorded `to` local def id given the `from` local def id, obtained using
142+
/// `generics_def_id_map` field.
139143
fn get_remapped_def_id(&self, local_def_id: LocalDefId) -> LocalDefId;
140144
}
141145

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ pub struct ResolverAstLowering {
177177
pub label_res_map: NodeMap<ast::NodeId>,
178178
/// Resolutions for lifetimes.
179179
pub lifetimes_res_map: NodeMap<LifetimeRes>,
180-
/// Mapping from generics def-id to RPIT copied generic def-id
180+
/// Mapping from generics `def_id`s to TAIT generics `def_id`s.
181+
/// For each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic
182+
/// defined on the TAIT, so we have type Foo<'a1> = ... and we establish a mapping in this
183+
/// field from the original parameter 'a to the new parameter 'a1.
181184
pub generics_def_id_map: Vec<FxHashMap<LocalDefId, LocalDefId>>,
182185
/// Lifetime parameters that lowering will have to introduce.
183186
pub extra_lifetime_params_map: NodeMap<Vec<(Ident, ast::NodeId, LifetimeRes)>>,

0 commit comments

Comments
 (0)