-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
(Modules) Tracking issue for the mod.rs
changes
#53125
Comments
Of the various module changes, this one seems quite clear, uncontroversial, and ready to commit to. @rfcbot fcp merge |
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. |
@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 mechanismsSo both Common submodules and module configurationWhat 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 Non-code resources and module configuration
|
@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
Today,
Depends on your interpretation of where the module lives. While some other languages do have facilities similar to 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 |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
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. |
@Nemo157 Could you elaborate a bit on the problems you experienced with tab completion? |
Just that when I have a folder structure including both I’m sure the new scheme is something I could learn to deal with better, but after a few days of working on that crate I was still regularly accidentally opening the folder instead of the file I wanted. |
@Nemo157 Thanks for the data point! This does sound a bit concerning and I could see a lot of folks (myself included) being slowed down by this. I skimmed the RFC discussion and I couldn't find any mention of this issue, so it seems it wasn't addressed there. On the other hand, having multiple files named If the strategy here was to deprecate |
I feel like tab completion is more important to me than the tab titles in vim in my workflow... |
Counterpoint: In my workflow I very rarely have to type file paths manually (why would I do that?) but very often look at them in editor tabs. |
Yeah, this seems like a very editor-dependent experience. It seems like, in this respect at least, the new style can make things easier for some tabbed-IDE users, while making things a bit harder for VIM (etc) folks. |
That seems to suggest that we should keep both and make neither canonical. |
@mark-i-m AFAIK the plan was always to keep both. |
I'm not sure how much vim differs from emacs but the problem of having many mod.rs, as well as having to rename and move modules is as present in emacs as it is in vscode for me. I agree there can be some friction with path completion. It goes away when using project-wide find-file commands and/or fuzzy matching (like helm-projectile-find-file in spacemacs) though. |
@mark-i-m, @cramertj: Strongly disagree! What about the added complexity of two ways to achieve the same thing? See #53125 (comment). Not that I care so much about how we configure module structure in Rust, but I do care about keeping the language as simple as possible. Having multiple module configuration mechanisms contravenes Rust’s strategic policy (e.g., https://blog.rust-lang.org/2017/03/02/lang-ergonomics.html):
How to teach to novices: ‘oh, there a |
People are mentioning issues with various IDEs/editors, but we are barking up the wrong tree. The Rust refactoring feature set of these tools must be improved then. Not how Rust is designed. |
I was very careful not to mention any editor, my issues were mainly around accessing the files directly from a shell (and an editor command buffer with very similar completion to mainstream shells). While it might be possible to integrate RLS into my shell to be able to open files via module-name completion or something, that's not something I'm planning on doing anytime soon. |
What if deprecate #[path = "mymod/mod.rs"]
pub mod mymod; if somebody wants to keep all files related to the module in one place? |
I'm personally quite torn on what I'd use in my own projects given the choice of both. On one hand, My conclusion is that we shouldn't solve this globally for all Rust users because work flows are so different. The addition of |
Shall |
I think that |
The final comment period, with a disposition to merge, as per the review above, is now complete. |
Given that the FCP is now complete; any takers for writing up a stabilization PR? |
@Centril, |
|
@sanmai-NL with respect to process, we are, unfortunately, under time constraints to ship the edition so we may sometimes speed up the process more so than normally done. However, this does not mean that decisions should be rushed just because of time constraints. That said, this has already been extensively discussed on the RFC before it. The main decision to accept this was made there and then, this is simply confirming the decision as part of our double-checking and vetting process. As for your concern about teachability, where you wrote:
as well as:
@joshtriplett said:
I believe this addresses your point. At least it suffices for me. I would also like to add that Rust's language team does not generally adhere to PEP 20 -- The Zen of Python:
We sometimes do adhere to this, we sometimes don't, depending on the situation. :) |
This was proposed previously in an RFC, the RFC was accepted, the result was implemented, this change was widely discussed as part of the edition, and quite a bit of feedback already happened during that long process. The previous tracking issue incorporated plenty of discussion as well. No part of the process has been bypassed here; if anything, this change has had closer scrutiny and more extensive feedback than usual. |
@Centril: as for PEP 20-like principles. It seems to me teachability and simplicity haven’t been prioritized in Rust. Please note: not being prioritized does not mean being ignored completely. I deeply regret that. Here is another case where with deliberation and specific attention to teachability and simplicity (two separate but related concerns) would makes us conclude rust-lang/rfcs#2126 is not ‘uncontroversial’ at all. |
@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. |
Also, we should touch base with the @rust-lang/docs team: what is needed around documentation here? |
Changes in the books and in the examples I assume. Bad luck that a few members of the docs team aren't available currently... |
I will take this for my first PR |
Stabilization change for mod.rs This change is in response to rust-lang#53125. The patch makes the feature accepted and removes the tests that tested the non-accepted status of the feature.
Triage: The only thing remaining now is to update the reference / documentation. |
Oops, mis-read. This is ready to stabilize. |
@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. |
This is a sub-tracking issue for the RFC "Clarify and streamline paths and visibility" (rust-lang/rfcs#2126)
dealing with the
mod.rs
changes.foo.rs
orfoo/mod.rs
to support submodules likefoo/bar.rs
#45385Unresolved questions:
None
Summary
A
foo.rs
andfoo/
subdirectory may coexist; mod.rs is no longer needed when placing submodules in a subdirectory.The text was updated successfully, but these errors were encountered: