From 63e74aba813d2e24ffa094d05c2545b5e882229f Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 24 Jul 2022 20:36:22 -0700 Subject: [PATCH] Expose size_hint() for TokenStream's iterator --- library/proc_macro/src/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 08b45ac11a1..8e478cd7bc8 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -382,6 +382,14 @@ pub mod token_stream { bridge::TokenTree::Literal(tt) => TokenTree::Literal(Literal(tt)), }) } + + fn size_hint(&self) -> (usize, Option) { + self.0.size_hint() + } + + fn count(self) -> usize { + self.0.count() + } } #[stable(feature = "proc_macro_lib2", since = "1.29.0")]