Skip to content

Commit c946cdc

Browse files
committed
Document opt_local_def_id
1 parent 966269a commit c946cdc

File tree

1 file changed

+11
-0
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+11
-0
lines changed

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
482482
start
483483
}
484484

485+
/// Given the id of some node in the AST, finds the `LocalDefId` associated with it by the name
486+
/// resolver (if any), after applying any remapping from `get_remapped_def_id`.
487+
///
488+
/// For example: for each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic
489+
/// defined on the TAIT, so we have type Foo<'a1> = ... and we establish a mapping from the
490+
/// original parameter 'a to the new parameter 'a1.
491+
///
492+
/// This method will return, given `'a` node id, `'a1` def id, going through, as a mid step,
493+
/// the def_id of `'a`.
494+
/// For cases when there are no mappings, it will just return the def_id that correspond to the
495+
/// given node_id.
485496
fn opt_local_def_id(&self, node: NodeId) -> Option<LocalDefId> {
486497
self.resolver
487498
.node_id_to_def_id

0 commit comments

Comments
 (0)