Skip to content

Commit a83c356

Browse files
committed
expand: Do not do questionable span adjustment before eagerly expanding an expression
Maybe it made sense when it was introduced, but now it's doing something incorrect.
1 parent 96032aa commit a83c356

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

src/libsyntax/ext/base.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -908,12 +908,9 @@ impl<'a> ExtCtxt<'a> {
908908
/// compilation on error, merely emits a non-fatal error and returns `None`.
909909
pub fn expr_to_spanned_string<'a>(
910910
cx: &'a mut ExtCtxt<'_>,
911-
mut expr: P<ast::Expr>,
911+
expr: P<ast::Expr>,
912912
err_msg: &str,
913913
) -> Result<(Symbol, ast::StrStyle, Span), Option<DiagnosticBuilder<'a>>> {
914-
// Update `expr.span`'s ctxt now in case expr is an `include!` macro invocation.
915-
expr.span = expr.span.apply_mark(cx.current_expansion.id);
916-
917914
// Perform eager expansion on the expression.
918915
// We want to be able to handle e.g., `concat!("foo", "bar")`.
919916
let expr = cx.expander().fully_expand_fragment(AstFragment::Expr(expr)).make_expr();

src/test/ui/hygiene/eager-from-opaque.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Opaque macro can eagerly expand its input without breaking its resolution.
22
// Regression test for issue #63685.
33

4+
// check-pass
5+
46
macro_rules! foo {
57
() => {
68
"foo"
@@ -9,7 +11,7 @@ macro_rules! foo {
911

1012
macro_rules! bar {
1113
() => {
12-
foo!() //~ ERROR cannot find macro `foo!` in this scope
14+
foo!()
1315
};
1416
}
1517

src/test/ui/hygiene/eager-from-opaque.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)