Skip to content

example for leading :: syntax for paths is broken on 2018 #746

@cdepillabout

Description

@cdepillabout

There is an example for using a leading :: to reference the crate root:

https://doc.rust-lang.org/reference/paths.html#path-qualifiers

mod a {
    pub fn foo() {}
}
mod b {
    pub fn foo() {
        ::a::foo(); // call a's foo function
    }
}

However, this no longer works on the 2018 edition.

It would be nice to have a comment explaining that this no longer is expected to work in the 2018 edition.

There is a note that says, "Beginning with the 2018 Edition, paths starting with :: can only reference crates", so maybe this example could be changed to reference something in a crate, like ::std or something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions