-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Allow foo.rs
to be parent to foo/bar.rs
#39702
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
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
Not sure if this needs an RFC or not.
#[path="fragments.rs"]
mod fragments;
EDIT: Fixed this. |
Talked with the lang team, we agreed that this needs an RFC. I'll write one. |
88f82fa
to
6b276c7
Compare
Question for the RFC - Consider this code: // src/lib.rs
#[path="bar.rs"]
mod foo; // src/bar.rs (the `foo` module)
mod baz; Should the My inclination is to search at |
On the paths: unless there is an existing example otherwise, it probably makes sense to keep them as being relative to the directory containing the file which contains the |
I'd like to say against this feature because it adds complexity without any benefits. |
I don't mind it so much: it could make moving from a single-file module ( |
The way the path attribute is parsed can't change. The question is whether path'd modules have submodules at the subdirectory matching their module name or their path name. |
Ah yes, I see what you were getting at. In that case, your suggestion sounds reasonable. |
Prior to this commit, in order for a module to have submodules, it had to be at the `/foo/mod.rs` filepath. After this commit, moudles at the `/foo.rs` filepath have submodules located in the `/foo/` directory.
6b276c7
to
de2070b
Compare
After considering all the cases, what this implements (and the RFC will propose) is that a path attribute will contain submodules using these rules:
Again this only applies to modules at |
Take arbitrary stance in the RFC and pose this question in the RFC’s unresolved questions section. |
☔ The latest upstream changes (presumably #39765) made this pull request unmergeable. Please resolve the merge conflicts. |
@withoutboats any update on the status of the RFC being drafted? Should I close this PR in the meantime? |
Yea I'll close this for now. Hope to get back to the RFC in the next few weeks. |
Prior to this commit, in order for a module to have submodules, it had
to be at the
/foo/mod.rs
filepath. After this commit, modules at the/foo.rs
filepath have submodules located in the/foo/
directory.