Skip to content

Regression in decl_macro emitted item resolutions #59196

Closed
@IsaacWoods

Description

On the current nightly (2019-03-13), the following code fails (link to the playground):

#![feature(decl_macro)]

macro bar() {
    pub enum Bar {
        A,
        B,
        C
    }
}

bar!();

fn main() {
    let _ = Bar::A;
    let _ = Bar::B;
    let _ = Bar::C;
}

with the error:

error[E0433]: failed to resolve: use of undeclared type or module `Bar`
  --> src/main.rs:14:13
   |
14 |     let _ = Bar::A;
   |             ^^^ use of undeclared type or module `Bar`

error[E0433]: failed to resolve: use of undeclared type or module `Bar`
  --> src/main.rs:15:13
   |
15 |     let _ = Bar::B;
   |             ^^^ use of undeclared type or module `Bar`

error[E0433]: failed to resolve: use of undeclared type or module `Bar`
  --> src/main.rs:16:13
   |
16 |     let _ = Bar::C;
   |             ^^^ use of undeclared type or module `Bar`

This seems to be an issue with the decl_macro feature specifically - declaring the same macro with macro_rules works as intended.

Metadata

Assignees

No one assigned

    Labels

    A-macros-2.0Area: Declarative macros 2.0 (#39412)A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions