-
Notifications
You must be signed in to change notification settings - Fork 48
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
MCP: Change path attribute behavior of modules. #89
Comments
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed. |
See also rust-lang/rust#35016 |
We discussed this in our 2021-04-20 meeting. While there were many folks who felt that the current behavior could be surprising, the overall consensus was that in order to make changes here we would want to see:
Marking as disposition close. |
For the second bullet point, i'd list a few:
|
@crlf0710 we did discuss this latter point: we were wondering if it was even worth trying to make a feature just for this case. That said, the question is--- how often do those scenarios arise inside of an inline module? (And how problematic is the current behavior in that case? After all, if one knows what to expect, they can do |
The FCP has expired, so I've closed the issue. Thanks @crlf0710 for the suggestion. |
Proposal
Summary and problem statement
Change the file lookup rules of path attributes on modules to better align with current Rust module hierarchy organization.
Motivation, use-cases, and solution sketches
Currently path attribute behavior is explained in the two tables in reference. One thing that is not explained on the page is where will
mod c
's child module be lookuped at.c
's File Locationc
's Module Pathc
's child file locationsrc/a/b.rs
src/a/foo.rs
crate::a::b::c
src/a/d.rs
src/a/mod.rs
src/a/foo.rs
crate::a::c
src/a/d.rs
c
's File Locationc
's Module Pathc
's child file locationsrc/a/b.rs
src/a/b/inline/foo.rs
crate::a::b::inline::c
src/a/b/inline/d.rs
src/a/mod.rs
src/a/inline/foo.rs
crate::a::inline::c
src/a/inline/d.rs
I believe this is due to heritage of edition 2015, where mod
c
should actually be anmod.rs
file if it has non-inline child modules. However this seems really strange under 2018 edition. I hope this could be fixed under 2021 edition.One possible solution:
c
's child modules at the current location only when c is a "mod-rs" source file. Otherwise find its child within "foo" subdirectory.Another possible solution:
mod.rs
and its children following 2015 edition from there.Prioritization
Links and related work
#[path]
module. reference#573Initial people involved
What happens now?
This issue is part of the experimental MCP process described in RFC 2936. Once this issue is filed, a Zulip topic will be opened for discussion, and the lang-team will review open MCPs in its weekly triage meetings. You should receive feedback within a week or two.
This issue is not meant to be used for technical discussion. There is a Zulip stream for that. Use this issue to leave procedural comments, such as volunteering to review, indicating that you second the proposal (or third, etc), or raising a concern that you would like to be addressed.
The text was updated successfully, but these errors were encountered: