Description
Ignoring "inline" modules like mod foo { }
, modules currently come in one of two forms:
- Leaf modules: a
foo.rs
file is forced to be a leaf module. In particular, one cannot make a submodule in a file likefoo/bar.rs
. - Directory modules: a
foo/mod.rs
file is a directory module. One can create submodules in files likefoo/bar.rs
.
As part of #44660, we plan to support either of those two forms. However, the two forms should not be usable for a single module simultaneously: in other words, you can have foo.rs
or foo/mod.rs
, but not both. (One is permitted to intermingle the two forms within a single project, however.)
Because the RFC has a number of moving parts, we wanted to feature-gate semi-independent features with distinct names. Therefore, foo.rs
files that contain submodules can be gated under the feature name module_flexible_submodules
.
(Note: Please limit discussion on this issue strictly to implementation concerns relative to this particular change. Policy discussion as to whether or not to make this change -- or whether to make other changes to the module system -- belong in #44660.)