Skip to content

Commit 7808982

Browse files
Merge #8005
8005: Make sure ill-form macro handle propely r=edwin0cheng a=edwin0cheng Fix #7987 bors r+ Co-authored-by: Edwin Cheng <[email protected]>
2 parents f80e108 + b3b9104 commit 7808982

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

crates/mbe/src/expander/transcriber.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//! `$ident => foo`, interpolates variables in the template, to get `fn foo() {}`
33
44
use syntax::SmolStr;
5-
use tt::Delimiter;
5+
use tt::{Delimiter, Subtree};
66

77
use super::ExpandResult;
88
use crate::{
@@ -175,7 +175,10 @@ fn expand_repeat(
175175
counter += 1;
176176
if counter == limit {
177177
log::warn!("expand_tt in repeat pattern exceed limit => {:#?}\n{:#?}", template, ctx);
178-
break;
178+
return ExpandResult {
179+
value: Fragment::Tokens(Subtree::default().into()),
180+
err: Some(ExpandError::Other("Expand exceed limit".to_string())),
181+
};
179182
}
180183

181184
if e.is_some() {

0 commit comments

Comments
 (0)