Skip to content

Macro expansions replace parent modules #3444

@powerboat9

Description

@powerboat9

Summary

It seems like ExpandVisitor will, rather than expand macro invocations within a module, expand modules to the result of a contained macro invocation.

Reproducer

I tried this code:

mod foo {
    macro_rules! bar {
        () => ()
    }

    bar! ();

    pub struct S;
}

pub fn buzz(_: foo::S) {
}

Does the code make use of any (1.49) nightly feature ?

  • Nightly

Godbolt link

here

Actual behavior

The current behavior is...

<source>:11:16: error: 789 reverse lookup failure
   11 | pub fn buzz(_: foo::S) {
      |

Expected behavior

I expected to see...

No error

GCC Version

c638b4f

Metadata

Metadata

Assignees

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions