Closed
Description
I originally reported this in #2407, but on further reflection I think it deserves its own issue. rustfmt
fails for Rust 2018 submodules that don't use mod.rs
(because of path clarity). Example:
$ mkdir foo
$ touch foo/bar.rs
$ echo 'mod bar;' > foo.rs
$ rustfmt --edition 2018 foo.rs
error[E0583]: file not found for module `bar`
--> /private/tmp/demo/foo.rs:1:5
|
1 | mod bar;
| ^^^
|
= help: name the file either bar.rs or bar/mod.rs inside the directory "/private/tmp/demo"
For clarity, the file structure is:
$ tree
.
├── foo
│ └── bar.rs
└── foo.rs
Here, foo.rs
is the Rust 2018 equivalent of Rust 2015's foo/mod.rs
.