diff options
author | Aleksey Kladov <[email protected]> | 2019-02-11 18:31:54 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-02-11 18:31:54 +0000 |
commit | ae312680d6d7bb0cc00d2b8d9799249d36e0136e (patch) | |
tree | 6547cd1d0e5b7494ac6b9ec9b446ba0db4c149ad /crates/ra_tt/src | |
parent | 0d34a256de5d33565e9a62d53bf149cf59510937 (diff) |
docs
Diffstat (limited to 'crates/ra_tt/src')
-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 | ||