diff options
| author | bors <bors@rust-lang.org> | 2019-08-21 17:09:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-08-21 17:09:25 +0000 |
| commit | e44fdf97929d1315add3b76208adf99e8299252d (patch) | |
| tree | fe45714c22cfe937c213890b6995b1788eeed146 /src/libsyntax | |
| parent | 7b0085a613e69cb69fc9e4eb5d422fa4a39d5de1 (diff) | |
| parent | 1294774e94ba42702a8405c0add75bef234f550b (diff) | |
| download | rust-e44fdf97929d1315add3b76208adf99e8299252d.tar.gz rust-e44fdf97929d1315add3b76208adf99e8299252d.zip | |
Auto merge of #63790 - Centril:rollup-m4ax3r9, r=Centril
Rollup of 6 pull requests Successful merges: - #61236 (take into account the system theme) - #63717 (Fix nested eager expansions in arguments of `format_args`) - #63747 (update Miri) - #63772 (ci: move libc mirrors to the rust-lang-ci-mirrors bucket) - #63780 (Improve diagnostics: break/continue in wrong context) - #63781 (Run Clippy without json-rendered flag) Failed merges: r? @ghost
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/base.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 7 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index b0a4a6af983..075e6a80013 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -682,8 +682,9 @@ pub trait Resolver { fn resolve_imports(&mut self); - fn resolve_macro_invocation(&mut self, invoc: &Invocation, invoc_id: ExpnId, force: bool) - -> Result<Option<Lrc<SyntaxExtension>>, Indeterminate>; + fn resolve_macro_invocation( + &mut self, invoc: &Invocation, eager_expansion_root: ExpnId, force: bool + ) -> Result<Option<Lrc<SyntaxExtension>>, Indeterminate>; fn check_unused_macros(&self); @@ -908,12 +909,9 @@ impl<'a> ExtCtxt<'a> { /// compilation on error, merely emits a non-fatal error and returns `None`. pub fn expr_to_spanned_string<'a>( cx: &'a mut ExtCtxt<'_>, - mut expr: P<ast::Expr>, + expr: P<ast::Expr>, err_msg: &str, ) -> Result<(Symbol, ast::StrStyle, Span), Option<DiagnosticBuilder<'a>>> { - // Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation. - expr.span = expr.span.apply_mark(cx.current_expansion.id); - // Perform eager expansion on the expression. // We want to be able to handle e.g., `concat!("foo", "bar")`. let expr = cx.expander().fully_expand_fragment(AstFragment::Expr(expr)).make_expr(); diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index c1d52c97455..72f2c1375e7 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -305,9 +305,11 @@ impl<'a, 'b> MacroExpander<'a, 'b> { continue }; - let scope = + let eager_expansion_root = if self.monotonic { invoc.expansion_data.id } else { orig_expansion_data.id }; - let ext = match self.cx.resolver.resolve_macro_invocation(&invoc, scope, force) { + let ext = match self.cx.resolver.resolve_macro_invocation( + &invoc, eager_expansion_root, force + ) { Ok(ext) => ext, Err(Indeterminate) => { undetermined_invocations.push(invoc); @@ -318,7 +320,6 @@ impl<'a, 'b> MacroExpander<'a, 'b> { progress = true; let ExpansionData { depth, id: expn_id, .. } = invoc.expansion_data; self.cx.current_expansion = invoc.expansion_data.clone(); - self.cx.current_expansion.id = scope; // FIXME(jseyfried): Refactor out the following logic let (expanded_fragment, new_invocations) = if let Some(ext) = ext { |
