Skip to content

Commit 307cc88

Browse files
committed
Add reference link for HIR ID validator
1 parent f6cc6f6 commit 307cc88

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hir/lowering.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ of such structures include but are not limited to
1616
* Converted to a virtual `existential type` declaration
1717

1818
Lowering needs to uphold several invariants in order to not trigger the
19-
sanity checks in `compiler/rustc_passes/src/hir_id_validator.rs`:
19+
sanity checks in [`compiler/rustc_passes/src/hir_id_validator.rs`][hir_id_validator]:
2020

2121
1. A `HirId` must be used if created. So if you use the `lower_node_id`,
2222
you *must* use the resulting `NodeId` or `HirId` (either is fine, since
@@ -33,6 +33,8 @@ sanity checks in `compiler/rustc_passes/src/hir_id_validator.rs`:
3333
which produces both a new `NodeId` as well as automatically lowering it
3434
for you so you also get the `HirId`.
3535

36+
[hir_id_validator]: https://github.com/rust-lang/rust/blob/HEAD/compiler/rustc_passes/src/hir_id_validator.rs
37+
3638
If you are creating new `DefId`s, since each `DefId` needs to have a
3739
corresponding `NodeId`, it is advisable to add these `NodeId`s to the
3840
`AST` so you don't have to generate new ones during lowering. This has

0 commit comments

Comments
 (0)