Skip to content

use some::module::self; and use some::module; not semantically equivalent #60941

Closed
@jrobsonchase

Description

@jrobsonchase

In instances where a path can represent both a module and a function or macro, the self import will only import the module and not the function/macro, whereas everything will be imported if the use statement ends with just the module/macro/function name.

This causes issues with rustfmt's merge_imports option: rust-lang/rustfmt#3362

If rustc is "working as intended," the behavior is such that merge_imports will never be able to safely create self imports.

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions