Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/tt/src/buffer.rs')
| -rw-r--r-- | crates/tt/src/buffer.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/crates/tt/src/buffer.rs b/crates/tt/src/buffer.rs index 4484431124..c4b455e3f1 100644 --- a/crates/tt/src/buffer.rs +++ b/crates/tt/src/buffer.rs @@ -16,8 +16,8 @@ enum Entry<'t, Span> { // Mimicking types from proc-macro. Subtree(Option<&'t TokenTree<Span>>, &'t Subtree<Span>, EntryId), Leaf(&'t TokenTree<Span>), - // End entries contain a pointer to the entry from the containing - // token tree, or None if this is the outermost level. + /// End entries contain a pointer to the entry from the containing + /// token tree, or [`None`] if this is the outermost level. End(Option<EntryPtr>), } @@ -226,7 +226,9 @@ impl<'a, Span> Cursor<'a, Span> { /// a cursor into that subtree pub fn bump_subtree(self) -> Cursor<'a, Span> { match self.entry() { - Some(Entry::Subtree(_, _, _)) => self.subtree().unwrap(), + Some(&Entry::Subtree(_, _, entry_id)) => { + Cursor::create(self.buffer, EntryPtr(entry_id, 0)) + } _ => self.bump(), } } |