Uh oh!
There was an error while loading. Please reload this page.
Fix ordering of nested modules in non-mod.rs mods - #55192
Conversation
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fixrust-lang#55094rust-highfive
commented
Oct 19, 2018
(rust_highfive has picked a reviewer for you, use r? to override) |
cramertj
commented
Oct 19, 2018
Beta-nominating as this changes the behavior of functionality that would become stable in the current beta. |
Mark-Simulacrum
commented
Oct 19, 2018
@bors p=10 coming up on release week |
ehuss
commented
Oct 19, 2018
Sorry for being pestering, but I feel like I'm not communicating well, since I proposed this exact change. Is it OK that this breaks behavior for |
cramertj
commented
Oct 19, 2018
@ehuss Ah, my apologies! I didn't realize there was already a change open for this. Yeah, it does affect the behavior of |
ehuss
commented
Oct 19, 2018
If you want to, you can grab the fixes for the non-mod-rs tests from my PR. In-tree tests are pretty broken right now. |
I can almost guarantee that all changes done in this area after #37602 were subtly buggy, and you can't fix any bug in directory ownership / non-inline modules without introducing new bugs, unless you have detailed understanding of the whole picture. @cramertj and @ehuss |
petrochenkov
commented
Oct 19, 2018
Also, precise spec with motivational notes would be greatly helpful for this part of the language and compiler. |
@petrochenkov So, several of the rules laid out in #37602 are no longer true, especially since #47298. I'll try and lay out the current rules, and what we want to change. I'm not going to use the phrase "directory owner" here, since as we've discovered, we might want the semantics for what directory is "owned" by the current module to be different based on whether the ownership is being used to determine what location Some definitions:
The rules as currently implemented (post non-mod.rs mods stabilization):
I see two options to fixing this:
I think the first option is probably the best, but it's the one with the most complication and the least consistency between the behavior of #[path] and TL;DR: Edit: there's also the third option of breaking the current path behavior inside nested modules, which is what this PR currently implements. I think this is probably too big of a breaking change, but it might be worth a crater. |
petrochenkov
commented
Oct 20, 2018
@bors try |
bors
commented
Oct 20, 2018
Fix ordering of nested modules in non-mod.rs mods
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix#55094petrochenkov
commented
Oct 20, 2018
The "path-owning" vs "mod-owning" separations seems strange to me, unless we have to introduce it to explain the existing implementation. I'll re-read #55192 (comment) again tomorrow because right now I seem to forget previous paragraphs faster than I read the new ones. |
bors
commented
Oct 21, 2018
☀️ Test successful - status-travis |
petrochenkov
commented
Oct 21, 2018
@craterbot run start=master#155510e377ae2a8d8ee0dad1a5f809c9062a5526 end=try#ca35ca839582d74f045a4a1eb9e1a82e29f0e032 mode=check-only |
craterbot
commented
Oct 21, 2018
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
craterbot
commented
Oct 21, 2018
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
emilyalbini
commented
Oct 21, 2018
cc @rust-lang/release and @rust-lang/compiler for the backport to beta this close to the stable release |
craterbot
commented
Oct 22, 2018
🎉 Experiment
|
emilyalbini
commented
Oct 22, 2018
Wut, Crater broke itself again... |
Mark-Simulacrum
commented
Oct 23, 2018
This needs to land by Wednesday morning at the absolute latest if it is to make it for the release in beta; otherwise I think the likely course is to back out stabilization. Part of me says we should just do that, though -- is there some reason we can't destabilize this feature instead? |
craterbot
commented
Oct 26, 2018
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
alexcrichton
commented
Oct 27, 2018
I'm retagging this as beta-nominated as since this was destabilized in 1.30.0 this now affects 1.31.0 and if we want to continue to leave this as stable it'll presumably need this fix! |
craterbot
commented
Oct 28, 2018
🎉 Experiment
|
emilyalbini
commented
Oct 28, 2018
No regressions. |
petrochenkov
commented
Oct 28, 2018
@bors r+ |
bors
commented
Oct 28, 2018
📌 Commit ca35ca8 has been approved by |
bors
commented
Oct 28, 2018
Fix ordering of nested modules in non-mod.rs mods
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix#55094bors
commented
Oct 28, 2018
☀️ Test successful - status-appveyor, status-travis |
cramertj
commented
Oct 29, 2018
I don't think this should have been merged without more discussion on #55094. cc @rust-lang/lang this changed the behavior of |
[beta]: Prepare the 1.31.0 beta release * Update to Cargo's branched 1.31.0 branch * Update the channel to `beta` Rolled up beta-accepted PRs: * #55362: Remove `cargo new --edition` from release notes. * #55325: Fix link to macros chapter * #55358: Remove redundant clone (2) * #55346: Shrink `Statement`. * #55274: Handle bindings in substructure of patterns with type ascriptions * #55297: Partial implementation of uniform paths 2.0 to land before beta * #55192: Fix ordering of nested modules in non-mod.rs mods * #55185: path suggestions in Rust 2018 should point out the change in semantics * #55423: back out bogus `Ok`-wrapping suggestion on `?` arm type mismatch Note that **this does not update the bootstrap compiler** due to #55404
petrochenkov
commented
Oct 29, 2018
FWIW, I don't even care about precise rules anymore. |
cramertj
commented
Oct 31, 2018
@petrochenkov If we're willing and able to land this breaking change, then we can probably also land a breaking change that would make |
petrochenkov
commented
Oct 31, 2018
Quite possible. |
Flatten relative offset into directory path before adding inline
(mod x { ... }) module names to the current directory path.
Fix#55094