As part of #44660, we plan to support absolute paths that begin with crate. The RFC was actually a bit vague about how crate::foo paths work outside of use items. I'm going to go with the interpretation described by @rpjohnst, that one would write ::crate::foo to reference the item foo from outside of a use statement.
This means we want to support use statements like this:
use crate::foo::bar; // equivalent to `use foo::bar` today.
and "absolute" code references like this:
fn baz() {
::crate::foo::bar() // equivalent to `::foo::bar` today
}
This version also avoids a parsing ambiguity around tuple structs and the crate visibility modifier:
struct Foo(crate ::crate::Bar)
As part of #44660, we plan to support absolute paths that begin with
crate. The RFC was actually a bit vague about howcrate::foopaths work outside ofuseitems. I'm going to go with the interpretation described by @rpjohnst, that one would write::crate::footo reference the itemfoofrom outside of ausestatement.This means we want to support
usestatements like this:and "absolute" code references like this:
This version also avoids a parsing ambiguity around tuple structs and the
cratevisibility modifier: