Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up2018: current module shadows crate in `use` statement #52705
Comments
This comment has been minimized.
This comment has been minimized.
|
Sigh, single segment imports ( |
alexcrichton
added
the
A-rust-2018-preview
label
Jul 26, 2018
Mark-Simulacrum
added this to the Rust 2018 RC milestone
Jul 31, 2018
petrochenkov
referenced this issue
Aug 9, 2018
Merged
#[feature(uniform_paths)]: allow `use x::y;` to resolve through `self::x`, not just `::x`. #52923
bors
added a commit
that referenced
this issue
Aug 14, 2018
bors
added a commit
that referenced
this issue
Aug 14, 2018
bors
closed this
in
#52923
Aug 14, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
durka commentedJul 25, 2018
You can
usethe current module, even without starting the path withcrate::, and this can shadow extern crates.Cargo.toml:
src/main.rs:
src/png.rs:
This produces the error:
(Note that it did not say "can't find
png_ext". There was speculation on IRC that theusestatement shouldn't have madepng_extavailable for starting paths, onlyself::png_ext.)Further details that point to what's really going on:
self::png_ext::DecodingErrorhas no effectpngresolves the erroruseline touse crate::png as png_ext;has no effectDecodingErrorresolves the errorSo we have a module importing itself, even though it didn't use a
crate::path, and shadowing a crate. This is not one of the features we should be borrowing from the Python module system!