Skip to content

Commit

Permalink
expand: Do not do questionable span adjustment before eagerly expandi…
Browse files Browse the repository at this point in the history
…ng an expression

Maybe it made sense when it was introduced, but now it's doing something incorrect.
  • Loading branch information
petrochenkov committed Aug 21, 2019
1 parent 96032aa commit a83c356
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/libsyntax/ext/base.rs
Expand Up @@ -908,12 +908,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();
Expand Down
4 changes: 3 additions & 1 deletion src/test/ui/hygiene/eager-from-opaque.rs
@@ -1,6 +1,8 @@
// Opaque macro can eagerly expand its input without breaking its resolution.
// Regression test for issue #63685.

// check-pass

macro_rules! foo {
() => {
"foo"
Expand All @@ -9,7 +11,7 @@ macro_rules! foo {

macro_rules! bar {
() => {
foo!() //~ ERROR cannot find macro `foo!` in this scope
foo!()
};
}

Expand Down
11 changes: 0 additions & 11 deletions src/test/ui/hygiene/eager-from-opaque.stderr

This file was deleted.

0 comments on commit a83c356

Please sign in to comment.