diff options
Diffstat (limited to 'crates/ra_tt')
-rw-r--r-- | crates/ra_tt/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs index e0a4cdb8b..c1f37b889 100644 --- a/crates/ra_tt/src/lib.rs +++ b/crates/ra_tt/src/lib.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | /// `tt` crate defines a `TokenTree` datastructure: this is the interface (both | 1 | /// `tt` crate defines a `TokenTree` data structure: this is the interface (both |
2 | /// input and output) of macros. It closely mirrors `proc_macro` crate's | 2 | /// input and output) of macros. It closely mirrors `proc_macro` crate's |
3 | /// `TokenTree`. | 3 | /// `TokenTree`. |
4 | 4 | ||
@@ -18,6 +18,12 @@ use std::fmt; | |||
18 | 18 | ||
19 | use smol_str::SmolStr; | 19 | use smol_str::SmolStr; |
20 | 20 | ||
21 | /// Represents identity of the token. | ||
22 | /// | ||
23 | /// For hygiene purposes, we need to track which expanded tokens originated from | ||
24 | /// which source tokens. We do it by assigning an distinct identity to each | ||
25 | /// source token and making sure that identities are preserved during macro | ||
26 | /// expansion. | ||
21 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 27 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
22 | pub struct TokenId(pub u32); | 28 | pub struct TokenId(pub u32); |
23 | 29 | ||