Skip to content

import #[macro_export] from crate root help uses 2015 use syntax #99694

Open

Description

Given the following code: [playground]

mod m {
    #[macro_export]
    macro_rules! nu {
        {} => {};
    }

    pub use self::nu;
}

The current output is:

error[[E0432]](https://doc.rust-lang.org/nightly/error-index.html#E0432): unresolved import `self::nu`
 --> src/lib.rs:7:13
  |
7 |     pub use self::nu;
  |             ^^^^^^^^ no `nu` in `m`
  |
  = note: this could be because a macro annotated with `#[macro_export]` will be exported at the root of the crate instead of the module where it is defined
help: a macro with this name exists at the root of the crate
  |
7 |     pub use ::nu;
  |             ~~~~

For more information about this error, try `rustc --explain E0432`.

This is using the edition2015 syntax to import from the crate root, rather than the edition2018+ required crate::nu.

Related: #99695

@rustbot label +D-edition +D-invalid-suggestion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsD-editionDiagnostics: An error or lint that should account for edition differences.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions