diff options
| author | bors <bors@rust-lang.org> | 2016-09-07 19:02:51 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-07 19:02:51 -0700 |
| commit | 4a262862167899ae33e65af19fa4e34f787e4b8c (patch) | |
| tree | 35f5dcf5927b8e1f7bf3a4b978f632469c28a62c /src/libsyntax/ext/source_util.rs | |
| parent | a7b2232d20320dc3b4044a2aec1d51a129e7e17d (diff) | |
| parent | 9ac91fa48b3eb479cccb5695395faed8f59ece8e (diff) | |
| download | rust-4a262862167899ae33e65af19fa4e34f787e4b8c.tar.gz rust-4a262862167899ae33e65af19fa4e34f787e4b8c.zip | |
Auto merge of #36214 - jseyfried:stackless_expansion, r=nrc
macros: stackless expansion After this PR, macro expansion cannot overflow the stack unless the expanded crate is too deep to fold. Everything but the stackless placeholder expansion commit is also groundwork for macro modularization. r? @nrc or @eddyb
Diffstat (limited to 'src/libsyntax/ext/source_util.rs')
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index 97cb09991ec..105b2261117 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -74,11 +74,9 @@ pub fn expand_stringify(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTre pub fn expand_mod(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree]) -> Box<base::MacResult+'static> { base::check_zero_tts(cx, sp, tts, "module_path!"); - let string = cx.mod_path() - .iter() - .map(|x| x.to_string()) - .collect::<Vec<String>>() - .join("::"); + let paths = cx.syntax_env.paths(); + let string = paths.mod_path.iter().map(|x| x.to_string()).collect::<Vec<String>>().join("::"); + base::MacEager::expr(cx.expr_str( sp, token::intern_and_get_ident(&string[..]))) |
