We should add the following content about IDs:
ID memo:
LocalDefId - the best variant, if you can use it for something do it. Cannot address entities in other crates and fine-grained entities like individual expressions in the current crate. Can address any items.
DefId - the second choice. Can address entities in other crates, but cannot address fine-grained entities like individual expressions.
HirId - Can address fine-grained entities like individual expressions in the current crate. Fine-grained entities from other crates can never be addressed in rustc.
NodeId - The last choice. Can address fine-grained entities like individual expressions when HirIds are not yet created.
Originally posted by @petrochenkov in rust-lang/rust#73291 (comment)
We should add the following content about IDs:
ID memo:
LocalDefId- the best variant, if you can use it for something do it. Cannot address entities in other crates and fine-grained entities like individual expressions in the current crate. Can address any items.DefId- the second choice. Can address entities in other crates, but cannot address fine-grained entities like individual expressions.HirId- Can address fine-grained entities like individual expressions in the current crate. Fine-grained entities from other crates can never be addressed in rustc.NodeId- The last choice. Can address fine-grained entities like individual expressions whenHirIds are not yet created.Originally posted by @petrochenkov in rust-lang/rust#73291 (comment)