@@ -12,7 +12,8 @@ of such structures include but are not limited to
1212* ` if let `
1313 * Converted to ` match `
1414* Universal ` impl Trait `
15- * Converted to generic arguments (but with some flags, to know that the user didn't write them)
15+ * Converted to generic arguments
16+ (but with some flags, to know that the user didn't write them)
1617* Existential ` impl Trait `
1718 * Converted to a virtual ` existential type ` declaration
1819
@@ -34,14 +35,14 @@ sanity checks in `src/librustc/hir/map/hir_id_validator.rs`:
3435 which produces both a new ` NodeId ` as well as automatically lowering it
3536 for you so you also get the ` HirId ` .
3637
37- If you are creating new ` DefId ` s, since each ` DefId ` needs to have a corresponding
38- ` NodeId ` , it is adviseable to add these ` NodeId ` s to the ` AST ` so you don't have
39- to generate new ones during lowering. This has the advantage of creating a
40- way to find the ` DefId ` of something via its ` NodeId ` . If lowering needs this
41- ` DefId ` in multiple places, you can't generate a new ` NodeId ` in all those places
42- because you'd also get a new ` DefId ` then. With a ` NodeId ` from the ` AST ` this is
43- not an issue.
38+ If you are creating new ` DefId ` s, since each ` DefId ` needs to have a
39+ corresponding ` NodeId ` , it is adviseable to add these ` NodeId ` s to the
40+ ` AST ` so you don't have to generate new ones during lowering. This has
41+ the advantage of creating a way to find the ` DefId ` of something via its
42+ ` NodeId ` . If lowering needs this ` DefId ` in multiple places, you can't
43+ generate a new ` NodeId ` in all those places because you'd also get a new
44+ ` DefId ` then. With a ` NodeId ` from the ` AST ` this is not an issue.
4445
45- Having the ` NodeId ` also allows the ` DefCollector ` to generate the ` DefId ` s instead
46- of lowering having to do it on the fly. Centralizing the ` DefId ` generation in one
47- place makes it easier to refactor and reason about.
46+ Having the ` NodeId ` also allows the ` DefCollector ` to generate the ` DefId ` s
47+ instead of lowering having to do it on the fly. Centralizing the ` DefId `
48+ generation in one place makes it easier to refactor and reason about.
0 commit comments