- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.
Description
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
-  Fix issue: Global paths in usedirectives can begin withsuperorself#32225 #32403 introduces thesuper_or_self_in_global_pathlint as warn-by-default
-  Make sufficiently old or low-impact compatibility lints deny-by-default #36894 makes the super_or_self_in_global_pathlint deny-by-default
-  Turn sufficiently old compatibility lints into hard errors #42136 makes the super_or_self_in_global_pathlint a hard error
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.