Skip to content

Update HIR chapter to reflect the removal of NodeIds #759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add actual link to to_def_id
  • Loading branch information
LeSeulArtichaut committed Jun 21, 2020
commit 9b0c6bda147b9f5440c821d779666552b3ece268
4 changes: 3 additions & 1 deletion src/hir.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ sorts of identifiers in active use:
expected, because it prevents [`DefId`] from upstream crates from
being passed instead and causing bugs at compile time.
- They can still be transformed back into `DefId`s as needed by using
the [`LocalDefId::to_def_id`] method.
the [`LocalDefId::to_def_id`][to_def_id] method.
- [`HirId`], which combines the index of a particular item with an
offset within that item.
- the key point of a [`HirId`] is that it is *relative* to some item
Expand All @@ -102,6 +102,8 @@ sorts of identifiers in active use:
[`HirId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir_id/struct.HirId.html
[`BodyId`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/struct.BodyId.html

[to_def_id]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/def_id/struct.LocalDefId.html#method.to_def_id

We also have an internal map to go from `DefId` to what’s called "Def path". "Def path" is like a
module path but a bit more rich. For example, it may be `crate::foo::MyStruct` that identifies
this definition uniquely. It’s a bit different than a module path because it might include a type
Expand Down