You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(Modules) Tracking issue for the mod.rs changes #53125
B-RFC-approvedBlocker: Approved by a merged RFC.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-langRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.
Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
@joshtriplett: gave your post a thumbs down for the record, because you didn’t support your statement that it’s uncontroversial, while I can think of a few questions around this.
So both foo/mod.rs and foo.rs are going to be supported? I wouldn’t look forward to that. From a teachability perspective, the possibility of two ways to do the same thing even if one way is perhaps more straightforward is not an improvement. The newer, easier way will perhaps not be reflected in the ecosystem for some time to come so new programmers will not necessarily be inclined to use the newer, easier way.
Common submodules and module configuration
What is clearer:
A (now)
foo/mod.rs
foo/tests.rs
B (possibility after this change)
foo.rs
foo/tests.rs
A possible limitation here is that directories and files are often sorted separately in IDEs (e.g., IntelliJ IDEA) and filesystem explorers (e.g., Gnome Files) so there may be a large visual gap between foo.rs and its related foo/.
Non-code resources and module configuration
include_bytes! and include_str! look up resources relative to the current module’s directory. This means a mod.rs-like config would perhaps be clearer, similar to example B in my previous point.
@sanmai-NL I didn't intend to suggest that there was unanimity, just that unlike some of the other module changes, there hasn't been widespread objection or disagreement, such as in the various edition feedback threads. Addressing your points specifically:
The intention is to primarily point people to foo.rs. We want to keep foo/mod.rs for compatibility, so this change doesn't break existing projects. And we can provide appropriate lints (for people who want to write idiomatic Rust 2018 code) that encourage renaming the files accordingly, to help migrate the ecosystem. So I wouldn't expect this to bifurcate the ecosystem.
Common submodules and module configuration
Today, foo::bar could map to either foo/bar/mod.rs or foo/bar.rs depending on whether it has submodules. Similarly, foo::bar::baz maps to foo/bar/baz.rs or foo/bar/baz/mod.rs. That inconsistency makes it more difficult to look at a path in code and map it to the filesystem. So, I'd suggest that it's clearer to look at foo::bar and always know that you just mentally map each :: to / and append .rs.
Non-code resources and module configuration
Depends on your interpretation of where the module lives. While some other languages do have facilities similar to mod.rs, most tend to put code associated with a module named "foo" in a file foo.ext, and when that file includes something it would do so relative to the directory containing that file. This is a subjective difference.
More importantly, because of the inconsistency in the previous point, with today's system if you want to add a submodule to an existing module, you'd have to move the module to mod.rs, which would then change the location that include_bytes! and similar start from. With this change, you don't have to move the file to add submodules, so those paths always consistently start from the same place.
I just want to report some experience trying this out. On a relatively small (4 relevant sub-modules) new crate for futures I used the new form exclusively. As a CLI only programmer I found the interference with tab completion to really break my workflow, enough so that I eventually gave up and reverted to the old form.
@Centril, @joshtriplett: thanks, your explanations answer my question. Note that I didn’t claim parts of the process have been bypassed, I just observed how quickly things seemed to go when you do not know the process that it seems to have went through. @joshtriplett: In hindsight you entering the thread stating this ‘seems uncontroversial’ and ‘ready to commit to’, suggested this is not just about implementing what has been firmly decided.
@sanmai-NL Fair enough. In hindsight, I could have laid out some of the history more explicitly; in fact, I think it makes sense to edit in the explanations of that history near the top of the thread.
By "ready to commit to", I meant "ready to get on a path to stabilization as part of the edition".
So, as discussed, this is ready for stabilization. This is a great candidate for first PRs! The stabilization guide page on forge gives instructions on how to proceed.
B-RFC-approvedBlocker: Approved by a merged RFC.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCE-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.T-langRelevant to the language teamdisposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.
Activity
joshtriplett commentedon Aug 6, 2018
Of the various module changes, this one seems quite clear, uncontroversial, and ready to commit to.
@rfcbot fcp merge
rfcbot commentedon Aug 6, 2018
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged teams:
No concerns currently listed.
Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!
See this document for info about what commands tagged team members can give me.
sanmai-NL commentedon Aug 7, 2018
@joshtriplett: gave your post a thumbs down for the record, because you didn’t support your statement that it’s uncontroversial, while I can think of a few questions around this.
Multiple equivalent module configuration mechanisms
So both
foo/mod.rsandfoo.rsare going to be supported? I wouldn’t look forward to that. From a teachability perspective, the possibility of two ways to do the same thing even if one way is perhaps more straightforward is not an improvement. The newer, easier way will perhaps not be reflected in the ecosystem for some time to come so new programmers will not necessarily be inclined to use the newer, easier way.Common submodules and module configuration
What is clearer:
A (now)
B (possibility after this change)
A possible limitation here is that directories and files are often sorted separately in IDEs (e.g., IntelliJ IDEA) and filesystem explorers (e.g., Gnome Files) so there may be a large visual gap between
foo.rsand its relatedfoo/.Non-code resources and module configuration
include_bytes!andinclude_str!look up resources relative to the current module’s directory. This means amod.rs-like config would perhaps be clearer, similar to example B in my previous point.joshtriplett commentedon Aug 7, 2018
@sanmai-NL I didn't intend to suggest that there was unanimity, just that unlike some of the other module changes, there hasn't been widespread objection or disagreement, such as in the various edition feedback threads. Addressing your points specifically:
The intention is to primarily point people to
foo.rs. We want to keepfoo/mod.rsfor compatibility, so this change doesn't break existing projects. And we can provide appropriate lints (for people who want to write idiomatic Rust 2018 code) that encourage renaming the files accordingly, to help migrate the ecosystem. So I wouldn't expect this to bifurcate the ecosystem.Today,
foo::barcould map to eitherfoo/bar/mod.rsorfoo/bar.rsdepending on whether it has submodules. Similarly,foo::bar::bazmaps tofoo/bar/baz.rsorfoo/bar/baz/mod.rs. That inconsistency makes it more difficult to look at a path in code and map it to the filesystem. So, I'd suggest that it's clearer to look atfoo::barand always know that you just mentally map each::to/and append.rs.Depends on your interpretation of where the module lives. While some other languages do have facilities similar to
mod.rs, most tend to put code associated with a module named "foo" in a filefoo.ext, and when that file includes something it would do so relative to the directory containing that file. This is a subjective difference.More importantly, because of the inconsistency in the previous point, with today's system if you want to add a submodule to an existing module, you'd have to move the module to
mod.rs, which would then change the location thatinclude_bytes!and similar start from. With this change, you don't have to move the file to add submodules, so those paths always consistently start from the same place.rfcbot commentedon Aug 10, 2018
🔔 This is now entering its final comment period, as per the review above. 🔔
Nemo157 commentedon Aug 15, 2018
I just want to report some experience trying this out. On a relatively small (4 relevant sub-modules) new crate for futures I used the new form exclusively. As a CLI only programmer I found the interference with tab completion to really break my workflow, enough so that I eventually gave up and reverted to the old form.
Centril commentedon Aug 15, 2018
@Nemo157 Could you elaborate a bit on the problems you experienced with tab completion?
24 remaining items
sanmai-NL commentedon Aug 23, 2018
@Centril, @joshtriplett: thanks, your explanations answer my question. Note that I didn’t claim parts of the process have been bypassed, I just observed how quickly things seemed to go when you do not know the process that it seems to have went through. @joshtriplett: In hindsight you entering the thread stating this ‘seems uncontroversial’ and ‘ready to commit to’, suggested this is not just about implementing what has been firmly decided.
joshtriplett commentedon Aug 23, 2018
@sanmai-NL Fair enough. In hindsight, I could have laid out some of the history more explicitly; in fact, I think it makes sense to edit in the explanations of that history near the top of the thread.
By "ready to commit to", I meant "ready to get on a path to stabilization as part of the edition".
nikomatsakis commentedon Sep 1, 2018
So, as discussed, this is ready for stabilization. This is a great candidate for first PRs! The stabilization guide page on forge gives instructions on how to proceed.
nikomatsakis commentedon Sep 1, 2018
Also, we should touch base with the @rust-lang/docs team: what is needed around documentation here?
GuillaumeGomez commentedon Sep 1, 2018
Changes in the books and in the examples I assume. Bad luck that a few members of the docs team aren't available currently...
blitzerr commentedon Sep 3, 2018
I will take this for my first PR
Rollup merge of rust-lang#54072 - blitzerr:master, r=Mark-Simulacrum
Centril commentedon Sep 15, 2018
Triage: The only thing remaining now is to update the reference / documentation.
steveklabnik commentedon Sep 16, 2018
Done!
steveklabnik commentedon Sep 16, 2018
Oops, mis-read. This is ready to stabilize.
Centril commentedon Sep 18, 2018
@steveklabnik I believe this was already stabilized in the compiler :)
Closing this issue; we can track the remaining work in the issues you've listed.