Closed
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
use
directives can begin withsuper
orself
#32225 #32403 introduces thesuper_or_self_in_global_path
lint as warn-by-default - Make sufficiently old or low-impact compatibility lints deny-by-default #36894 makes the
super_or_self_in_global_path
lint deny-by-default - Turn sufficiently old compatibility lints into hard errors #42136 makes the
super_or_self_in_global_path
lint a hard error