Modules loaded using #[path]
are seemingly treated like mod.rs
files even when they're not
#104705
Labels
C-bug
Category: This is a bug.
needs-rfc
This change is large or controversial enough that it should have an RFC accepted before doing it.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Assume the following file structure:
where
bar.rs
has amod baz;
in it.When doing
in
main.rs
, everything works like expected. Thebar
module is loaded frombar.rs
and itsbaz
module gets loaded frombar/baz.rs
. Smooth sailing.Now try adding
to
bin/foo.rs
. What I expected was that this would behave exactly identical tomod bar
inmain.rs
; after all, I've just changed the implicit location ofbar.rs
to an explicit one.Instead, this happens:
Why is it looking for
src\bin\..\baz.rs
? It should be looking forsrc\bin\..\bar\baz.rs
, sincebar.rs
is not a root module likelib.rs
ormain.rs
, nor is it amod.rs
file.If this behavior is expected, it's not very well documented, I certainly couldn't find anything explaining this behavior in the documentation.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: