8005: Make sure ill-form macro handle propely r=edwin0cheng a=edwin0cheng

Fix #7987

bors r+

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
This commit is contained in:
bors[bot] 2021-03-14 03:26:32 +00:00 committed by GitHub
commit 7808982952
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,7 @@
//! `$ident => foo`, interpolates variables in the template, to get `fn foo() {}`
use syntax::SmolStr;
use tt::Delimiter;
use tt::{Delimiter, Subtree};
use super::ExpandResult;
use crate::{
@ -175,7 +175,10 @@ fn expand_repeat(
counter += 1;
if counter == limit {
log::warn!("expand_tt in repeat pattern exceed limit => {:#?}\n{:#?}", template, ctx);
break;
return ExpandResult {
value: Fragment::Tokens(Subtree::default().into()),
err: Some(ExpandError::Other("Expand exceed limit".to_string())),
};
}
if e.is_some() {