-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC 2126] permit foo.rs
or foo/mod.rs
to support submodules like foo/bar.rs
#45385
Comments
Mentoring instructionsCurrently, when we encounter a The only place where Definition: we currently consider a This notion of ownership isn't quite what we want for Once we have this new notion of directory ownership, we can use it when finding the default path where a (In the case of our example of The only other change that should be needed is to add a feature-gate somewhere. Ordinarily, I believe the feature-gate information is not available until after parsing -- but we can presumably remember somewhere that we encountered a submodule that would previous have been illegal (e.g., (To add a new feature-gate, you can follow the directions at the end of the "So You Want To Implement a Feature" page in the forge).) |
Hi, I'm going to try to work on this. |
@slo1 great! Let me know how it goes. =) A word of warning, I do try to keep up with GH comments, but faster responses can be had by sending a ping on gitter. |
@slo1 just checking in -- everything ok? |
I'm working on this. |
Implement non-mod.rs mod statements Fixes #45385, cc #44660 This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?
Implement non-mod.rs mod statements Fixes #45385, cc #44660 This will fail tidy right now because it doesn't recognize my UI tests as feature-gate tests. However, I'm not sure if compile-fail will work out either because compile-fail usually requires there to be error patterns in the top-level file, which isn't possible with this feature. What's the recommended way to handle this?
Ignoring "inline" modules like
mod foo { }
, modules currently come in one of two forms:foo.rs
file is forced to be a leaf module. In particular, one cannot make a submodule in a file likefoo/bar.rs
.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
orfoo/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 namemodule_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.)
The text was updated successfully, but these errors were encountered: