diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-14 03:26:32 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-14 03:26:32 +0000 |
commit | 7808982952999ed8499b70c77ceaec265e0c1807 (patch) | |
tree | ef95ec777d024b5b09c5196854fc97e434f3f85f /crates/mbe/src | |
parent | f80e1080d3457a7932995d770658827a4dbc1f47 (diff) | |
parent | b3b91046dd62fee7a0975f2962732e71027f1c6c (diff) |
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]>
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() { |