Closed
Description
Compiler: rustc 1.31.0-nightly (14f42a7 2018-10-14)
I'm trying to figure out how module system should work in edition 2018 without mod.rs
to support it in IntelliJ Rust
I have the following project structure: https://gist.github.com/Undin/eaef0a4765f5a991f6e62f8d07b878db.
And rustc can't compile this code in edition 2015 and 2018 with the following error
error[E0583]: file not found for module `qqq`
--> src/foo.rs:5:13
|
5 | pub mod qqq;
| ^^^
|
= help: name the file either foo/qqq.rs or foo/qqq/mod.rs inside the directory "src/baz"
error: aborting due to previous error
For more information about this error, try `rustc --explain E0583`.
But if I move qqq.rs
into src/baz/foo
folder rustc will compile it in both editions.
Problems:
- This code souldn't be compilable in edition 2015.
At least, rustc 1.29.2 shows the following error
error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660)
--> src/foo.rs:5:13
|
5 | pub mod qqq;
| ^^^
|
= help: on stable builds, rename this file to foo/mod.rs
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
src/baz/foo/qqq.rs
is rather unexpected becausebaz
is child module offoo
. I thinkqqq.rs
should be located insrc/foo/baz
or insrc/baz
folder but I'm not sure.
It would be great to understand how it should work to implement the corresponding support in the plugin