From 235a87fbd3ab5a7e9d0225fef55dafeb60e76dd6 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Wed, 9 Mar 2022 14:37:45 +1100 Subject: [PATCH] Make next_items a `SmallVec`. For consistency, and to make the code slightly nicer. --- compiler/rustc_expand/src/mbe/macro_parser.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_expand/src/mbe/macro_parser.rs b/compiler/rustc_expand/src/mbe/macro_parser.rs index d986c5b078d4..a8cf8b7c14b1 100644 --- a/compiler/rustc_expand/src/mbe/macro_parser.rs +++ b/compiler/rustc_expand/src/mbe/macro_parser.rs @@ -491,7 +491,7 @@ fn parse_tt_inner<'root, 'tt>( sess: &ParseSess, ms: &[TokenTree], cur_items: &mut SmallVec<[MatcherPosHandle<'root, 'tt>; 1]>, - next_items: &mut Vec>, + next_items: &mut SmallVec<[MatcherPosHandle<'root, 'tt>; 1]>, bb_items: &mut SmallVec<[MatcherPosHandle<'root, 'tt>; 1]>, token: &Token, ) -> Option { @@ -708,10 +708,9 @@ pub(super) fn parse_tt( // there are frequently *no* others! -- are allocated on the heap. let mut initial = MatcherPos::new(ms); let mut cur_items = smallvec![MatcherPosHandle::Ref(&mut initial)]; - let mut next_items = Vec::new(); loop { - assert!(next_items.is_empty()); + let mut next_items = SmallVec::new(); // Matcher positions black-box parsed by parser.rs (`parser`) let mut bb_items = SmallVec::new();