Skip to content

Tracking issue for super_or_self_in_global_path compatibility lint #36888

Closed
@petrochenkov

Description

@petrochenkov

What is this lint about

Paths starting with self or super are relative by definition, "global" prefix :: used to indicate absolute paths doesn't make sense on them.
However, older versions of the compiler sometimes (e.g. in imports) accepted and ignored such prefixes:

mod m {
    struct S;

    use ::self::S as Z; // <- was accepted, the path was still interpreted as relative despite `::`
}

#32403 fixed this oversight.

How to fix this warning/error

Remove :: from the path starting with ::self or ::super.

Current status

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.B-unstableBlocker: Implemented in the nightly compiler and unstable.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions