Change:
<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: The problem seems to be this: But it looks like rustc already gets the span wrong: !
<!-- Include a backtrace in the code block by setting in your environment. E.g. . --<details<summary<strongBacktrace</strong</summary<p<!-- Include a backtrace in the code block by setting in your environment. E.g. RU &lt;!-- Include a backtrace in the code block by setting in your environment. E.g. . --&lt;details&lt;summary&lt;strongBacktrace&lt;/strong&lt;/summary&lt;p&lt;/p&lt;/detailsSTBACKTRACE=1 cargo build. --<details<summary<strongBacktrace</strong</summary<p</p</details</p</details
This appears to stem from the span for the delimited block being changed . I will work on a fix now and submit it.

Discussion:
target_sp.open = source_sp.open.with_ctxt(ctxt); target_sp.close = source_sp.close.with_ctxt(ctxt); } <ins> ( TokenTree::Delimited(target_sp, ..), mbe::TokenTree::MetaVar(source_sp, ..), ) => { target_sp.open = source_sp.with_ctxt(ctxt); target_sp.close = source_sp.with_ctxt(ctxt).shrink_to_hi(); } </ins> _ => { let sp = rhs_tt.span().with_ctxt(ctxt); tt.set_span(sp);

<ins> // compile-flags: --crate-type lib -O -C debug-assertions=yes // Regression test for issue 118786 macro_rules! make_macro { ($macro_name:tt) => { macro_rules! $macro_name { //~^ ERROR macros that expand to items must be delimited with braces or followed by a semicolon //~| ERROR macro expansion ignores token `{` and any following //~| ERROR cannot find macro `macro_rules` in this scope () => {} } } } make_macro!((meow)); </ins>

<ins> error: macros that expand to items must be delimited with braces or followed by a semicolon --> $DIR/issue-118786.rs:7:22 | LL |         macro_rules! $macro_name { |                      ^^^^^^^^^^^ | help: change the delimiters to curly braces | LL |         macro_rules! {} { |                      ~          + help: add a semicolon | LL |         macro_rules! $macro_name; { |                                 + error: macro expansion ignores token `{` and any following --> $DIR/issue-118786.rs:7:34 | LL |         macro_rules! $macro_name { |                                  ^ ... LL | make_macro!((meow)); | ------------------- caused by the macro expansion here | = note: the usage of `make_macro!` is likely invalid in item context error: cannot find macro `macro_rules` in this scope --> $DIR/issue-118786.rs:7:9 | LL |         macro_rules! $macro_name { |         ^^^^^^^^^^^ ... LL | make_macro!((meow)); | ------------------- in this macro invocation | note: maybe you have forgotten to define a name for this `macro_rules!` --> $DIR/issue-118786.rs:7:9 | LL |         macro_rules! $macro_name { |         ^^^^^^^^^^^ ... LL | make_macro!((meow)); | ------------------- in this macro invocation = note: this error originates in the macro `make_macro` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors </ins>