diff options
| author | bors <bors@rust-lang.org> | 2017-03-02 17:44:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-03-02 17:44:17 +0000 |
| commit | 5907ed63d329daefcd1680813d57e5ca00cd2fc2 (patch) | |
| tree | 2c1a0e1a6870cd6ab873b0a6432ca5f4f5b1ba2c /src/libsyntax | |
| parent | 8ae411e1b342bb1756f620b0c97bfa9e4eef4e47 (diff) | |
| parent | 6e259dc77870d278a37bbc42bcbc5fad64b75930 (diff) | |
| download | rust-5907ed63d329daefcd1680813d57e5ca00cd2fc2.tar.gz rust-5907ed63d329daefcd1680813d57e5ca00cd2fc2.zip | |
Auto merge of #39655 - durka:recursion-limit-suggestion, r=nikomatsakis
suggest doubling recursion limit in more situations Fixes #38852. r? @bluss
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 666e2205b4a..c7d2f0cd31d 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -14,7 +14,7 @@ use ast::{self, Attribute, Name, PatKind, MetaItem}; use attr::HasAttrs; use codemap::{self, CodeMap, ExpnInfo, Spanned, respan}; use syntax_pos::{Span, ExpnId, NO_EXPANSION}; -use errors::DiagnosticBuilder; +use errors::{DiagnosticBuilder, FatalError}; use ext::expand::{self, Expansion}; use ext::hygiene::Mark; use fold::{self, Folder}; @@ -695,9 +695,15 @@ impl<'a> ExtCtxt<'a> { pub fn bt_push(&mut self, ei: ExpnInfo) { if self.current_expansion.depth > self.ecfg.recursion_limit { - self.span_fatal(ei.call_site, - &format!("recursion limit reached while expanding the macro `{}`", - ei.callee.name())); + let suggested_limit = self.ecfg.recursion_limit * 2; + let mut err = self.struct_span_fatal(ei.call_site, + &format!("recursion limit reached while expanding the macro `{}`", + ei.callee.name())); + err.help(&format!( + "consider adding a `#![recursion_limit=\"{}\"]` attribute to your crate", + suggested_limit)); + err.emit(); + panic!(FatalError); } let mut call_site = ei.call_site; |
