Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
cdepillabout opened this issue Feb 8, 2020 · 0 comments · Fixed by #752
Closed

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

cdepillabout opened this issue Feb 8, 2020 · 0 comments · Fixed by #752

Comments

@cdepillabout
Copy link

cdepillabout commented Feb 8, 2020

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant