Skip to content

Conflicts in #[macro_use] extern crate imports are treated in ad hoc way #148025

@petrochenkov

Description

@petrochenkov

Currently, if the some name is imported by macro_use for the second time it overwrites the previous import with the same name, so the last name "wins".
(At least when the second macro_use comes from a macro such overwriting is reported as an error.)

Also there's no distinction between explicit macro_use(name) with arguments and "glob" macro_use without arguments, and a "glob" can overwrite an explicit import.

Typically, name resolution in rust doesn't behave this way.
Typically it is order-independent, explicit names shadow glob names, and glob ambiguities are reported as errors on use.

In practice, we should be able to adjust the rules for #[macro_use] extern crates to follow the usual name resolution practices without much breakage.

This is an issue to link from rust-lang/reference#2057.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.T-langRelevant to the language teamneeds-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions