Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow `foo.rs` to be parent to `foo/bar.rs` #39702
Conversation
rust-highfive
assigned
pnkfelix
Feb 9, 2017
This comment has been minimized.
This comment has been minimized.
|
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
|
Not sure if this needs an RFC or not.
#[path="fragments.rs"]
mod fragments;
EDIT: Fixed this. |
This comment has been minimized.
This comment has been minimized.
Talked with the lang team, we agreed that this needs an RFC. I'll write one. |
withoutboats
force-pushed the
withoutboats:more_flexible_mods
branch
2 times, most recently
from
88f82fa
to
6b276c7
Feb 10, 2017
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
|
I'd like to say against this feature because it adds complexity without any benefits. |
This comment has been minimized.
This comment has been minimized.
|
I don't mind it so much: it could make moving from a single-file module ( |
This comment has been minimized.
This comment has been minimized.
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. |
This comment has been minimized.
This comment has been minimized.
|
Ah yes, I see what you were getting at. In that case, your suggestion sounds reasonable. |
withoutboats
force-pushed the
withoutboats:more_flexible_mods
branch
from
6b276c7
to
de2070b
Feb 11, 2017
This comment has been minimized.
This comment has been minimized.
|
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 |
This comment has been minimized.
This comment has been minimized.
Take arbitrary stance in the RFC and pose this question in the RFC’s unresolved questions section. |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
|
@withoutboats any update on the status of the RFC being drafted? Should I close this PR in the meantime? |
This comment has been minimized.
This comment has been minimized.
|
Yea I'll close this for now. Hope to get back to the RFC in the next few weeks. |
withoutboats commentedFeb 9, 2017
Prior to this commit, in order for a module to have submodules, it had
to be at the
/foo/mod.rsfilepath. After this commit, modules at the/foo.rsfilepath have submodules located in the/foo/directory.