Skip to content

[RFC 2126] permit foo.rs or foo/mod.rs to support submodules like foo/bar.rs #45385

Closed
@nikomatsakis

Description

@nikomatsakis

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 like foo/bar.rs.
  • Directory modules: a foo/mod.rs file is a directory module. One can create submodules in files like foo/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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions