From 86b968ba94c30986ef7731b44af49907307c29a3 Mon Sep 17 00:00:00 2001 From: Florian Diebold Date: Mon, 7 Feb 2022 18:19:00 +0100 Subject: [PATCH] Add a check --- crates/mbe/src/syntax_bridge.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/mbe/src/syntax_bridge.rs b/crates/mbe/src/syntax_bridge.rs index d5639cadc4..d3ba28f3bc 100644 --- a/crates/mbe/src/syntax_bridge.rs +++ b/crates/mbe/src/syntax_bridge.rs @@ -1,7 +1,7 @@ //! Conversions between [`SyntaxNode`] and [`tt::TokenTree`]. use rustc_hash::{FxHashMap, FxHashSet}; -use stdx::non_empty_vec::NonEmptyVec; +use stdx::{non_empty_vec::NonEmptyVec, always}; use syntax::{ ast::{self, make::tokens::doc_comment}, AstToken, Parse, PreorderWithTokens, SmolStr, SyntaxElement, SyntaxKind, @@ -30,6 +30,8 @@ pub fn syntax_node_to_token_tree_censored( let mut c = Convertor::new(node, global_offset, replace, append); let subtree = convert_tokens(&mut c); c.id_alloc.map.shrink_to_fit(); + always!(c.replace.is_empty()); + always!(c.append.is_empty()); (subtree, c.id_alloc.map) }