Leading-crate has this property as well- both use crate::foo and use std::foo start from the same root level, and this was why the RFC wound up with that design to begin with.
I am not a fan of leading-::, or really the concept of 1path in general, for similar reasons to @withoutboats’s point against idiomatic nested use. use statements are different from expressions in practice: the vast majority of the time they pull from dependencies and across the module hierarchy within a crate, not from submodules or anything else in scope. Thus:
- Forcing extra syntax to import from the root is extra noise for the common case, without solving the problem that kicked off this discussion to begin with- confusion around where
use paths start, caused by extern crates being in-scope in the root module. This is solved in the RFC by moving dependencies up one level in the hierarchy, implying they’re not relative as in the common case, but leading-:: primarily seems to imply that they are relative and that you’re opting out of that.
- I like the
super::/self:: syntax to explicitly call out when something different is going on. Previous discussion even proposed other ways to specify reexports, though I think self:: + nested use might be enough there. This is both a) a little extra syntax for the uncommon case, and b) familiar from other languages like Python or Haskell that keep an explicit list of reexports.
- Further, 1path is not a very common property in other languages. The few that have it only have it by virtue of shadowing-style scoping across namespaces, not by forcing imports to use the syntax from expressions. Those that don’t do this (i.e. most of the ones I looked at) require an import statement to reference anything at all. It’s also notable that Python intentionally removed the ability to do relative imports without their equivalent of
self/super.
To me, the smaller churn of leading-crate is justified because it directly and more thoroughly solves the “path confusion” problem, puts use more in line with other languages that people may be familiar with, and avoids introducing any more line noise into the language.
I’ll also say again that it feels to me like a step back from the RFC to re-introduce a bunch of alternatives after all the discussion it took to eliminate them.
I’m not sure what the difference would be between the proposals, here. In all of them you’d replace the extern crate in the module with a use, and add a crate::/::crate::/[crate]::/[]:: before references to the module. Before doing so, all of them would give you a deprecation warning on use backtrace:: because it refers to a top-level item without going through crate::. I suppose the flag day/fallback variants might additionally require an extern crate backtrace as something_else (or the equivalent Cargo.toml change)?