Skip to content

Regression when doc string invokes a macro which is defined within the same module #124535

@danielhenrymantilla

Description

@danielhenrymantilla

Code

I tried this code:

mod module { #![doc = foo!()] macro_rules! foo {() => ( "" )} }

I expected to see this happen:

Instead, this happened:

error: cannot find macro `foo` in this scope --> src/lib.rs:2:14 | 2 | #![doc = foo!()] | ^^^ consider moving the definition of `foo` before this call | note: a macro with the same name exists, but it appears later at here --> src/lib.rs:4:18 | 4 | macro_rules! foo { | ^^^ 

Remark

Note that this problem still does not occur at the top-most level.

That is, removing mod module { above makes it work:

#![doc = foo!()] macro_rules! foo {() => ( "" )}

Version it worked on

It most recently worked on: +nightly-2024-04-27

Version with regression

rustc --version --verbose:

+nightly-2024-04-28 

@rustbot modify labels: +regression-from-stable-to-nightly -regression-untriaged

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueregression-from-stable-to-betaPerformance or correctness regression from stable to beta.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions