diff options
author | Edwin Cheng <[email protected]> | 2021-03-14 03:22:10 +0000 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2021-03-14 03:24:55 +0000 |
commit | b3b91046dd62fee7a0975f2962732e71027f1c6c (patch) | |
tree | ef95ec777d024b5b09c5196854fc97e434f3f85f /crates/mbe/src | |
parent | f80e1080d3457a7932995d770658827a4dbc1f47 (diff) |
Make sure ill-form macro handle propely
Diffstat (limited to 'crates/mbe/src')
-rw-r--r-- | crates/mbe/src/expander/transcriber.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/mbe/src/expander/transcriber.rs b/crates/mbe/src/expander/transcriber.rs index c679e5e5d..dd7fa97d7 100644 --- a/crates/mbe/src/expander/transcriber.rs +++ b/crates/mbe/src/expander/transcriber.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! `$ident => foo`, interpolates variables in the template, to get `fn foo() {}` | 2 | //! `$ident => foo`, interpolates variables in the template, to get `fn foo() {}` |
3 | 3 | ||
4 | use syntax::SmolStr; | 4 | use syntax::SmolStr; |
5 | use tt::Delimiter; | 5 | use tt::{Delimiter, Subtree}; |
6 | 6 | ||
7 | use super::ExpandResult; | 7 | use super::ExpandResult; |
8 | use crate::{ | 8 | use crate::{ |
@@ -175,7 +175,10 @@ fn expand_repeat( | |||
175 | counter += 1; | 175 | counter += 1; |
176 | if counter == limit { | 176 | if counter == limit { |
177 | log::warn!("expand_tt in repeat pattern exceed limit => {:#?}\n{:#?}", template, ctx); | 177 | 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 | }; | ||
179 | } | 182 | } |
180 | 183 | ||
181 | if e.is_some() { | 184 | if e.is_some() { |