@@ -489,14 +489,16 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
489
489
/// Given the id of some node in the AST, finds the `LocalDefId` associated with it by the name
490
490
/// resolver (if any), after applying any remapping from `get_remapped_def_id`.
491
491
///
492
- /// For example: for each captured lifetime (e.g., 'a), we create a new lifetime parameter that is a generic
493
- /// defined on the TAIT, so we have type Foo<'a1> = ... and we establish a mapping from the
494
- /// original parameter 'a to the new parameter 'a1.
492
+ /// For example, in a function like `fn foo<'a>(x: &'a u32)`,
493
+ /// invoking with the id from the `ast::Lifetime` node found inside
494
+ /// the `&'a u32` type would return the `LocalDefId` of the
495
+ /// `'a` parameter declared on `foo`.
495
496
///
496
- /// This method will return, given `'a` node id, `'a1` def id, going through, as a mid step,
497
- /// the def_id of `'a`.
498
- /// For cases when there are no mappings, it will just return the def_id that correspond to the
499
- /// given node_id.
497
+ /// This function also applies remapping from `get_remapped_def_id`.
498
+ /// These are used when synthesizing opaque types from `-> impl Trait` return types and so forth.
499
+ /// For example, in a function like `fn foo<'a>() -> impl Debug + 'a`,
500
+ /// we would create an opaque type `type FooReturn<'a1> = impl Debug + 'a1`.
501
+ /// When lowering the `Debug + 'a` bounds, we add a remapping to map `'a` to `'a1`.
500
502
fn opt_local_def_id ( & self , node : NodeId ) -> Option < LocalDefId > {
501
503
self . resolver
502
504
. node_id_to_def_id
0 commit comments