Uh oh!
There was an error while loading. Please reload this page.
Add nested groups in imports - #45846
Conversation
rust-highfive
commented
Nov 7, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
emilyalbini
commented
Nov 7, 2017
I know some tests are failing right now, but rustc compiles itself successfully and the actual implementation of the feature is ready. |
ff1eb91 to
73011dbCompareThere was a problem hiding this comment.
Could you avoid Spanned here and add the span: Span field into ViewPath_ explicitly, and then rename ViewPath_ -> ViewPath and ViewPathKind_ -> ViewPathKind.
There was a problem hiding this comment.
It's also a good opportunity to finally rename ViewPath (what does it even mean?) into something more reasonable, e.g. ImportTree or UseTree.
There was a problem hiding this comment.
Could you use the "new-style" naming
enumViewPathKind{Simple(Ident),Glob,
...
}without pub use self::ViewPathKind_::*.
0b88045 to
b67f99fCompareThere was a problem hiding this comment.
Nit: I've seen this ref ident in few places, ref is not necessary, Ident is small and Copy.
There was a problem hiding this comment.
This will accept use :: ::a::b; :)
(And also use :: $path::{a::b}.)
You really have to parse the prefix as a whole (including the starting ::) if it's a path, and treat "non-path" prefixes Ø and :: specially.
There was a problem hiding this comment.
Could you keep is_import_coupler alive and used here (even if it's used only here).
It will likely be useful again for fixing https://github.com/rust-lang/rust/pull/45846/files#r150397110.
bors
commented
Nov 12, 2017
☔ The latest upstream changes (presumably #45848) made this pull request unmergeable. Please resolve the merge conflicts. |
3c85490 to
b074edbCompareThere was a problem hiding this comment.
I'd probably like to get rid from default_to_global too, but it's better left for a separate PR.default_to_global is also used in visibilities and is_global relies on that starting CrateRoot and now returns inconsistent results, and is_global is used in too many places that may require adjustments. I don't recommend dealing with these issues in this PR.
For now, let's keep default_to_global for the outer use tree and avoid it for nested trees.
shepmaster
commented
Nov 18, 2017
Ping from triage @pietroalbini — it's been a week since we last heard from you! Will you be able to address the issues with this PR soon? |
emilyalbini
commented
Nov 18, 2017
@shepmaster all the review comments were already fixed, but in other files so github didn't hide them ;) |
There was a problem hiding this comment.
DUMMY_SP should not be used in anything that goes through name resolution - macro hygiene is span-based.
Actual span needs to be used even if it's zero length.
There was a problem hiding this comment.
(This may be the reason of ICE in the proc macro test, but I haven't checked.)
There was a problem hiding this comment.
This should be removed, because default_to_global was restored.
There was a problem hiding this comment.
default_to_global was restored so this isn't necessary too.
bors
commented
Nov 21, 2017
☔ The latest upstream changes (presumably #45771) made this pull request unmergeable. Please resolve the merge conflicts. |
10ea27e to
e46969bCompareThere was a problem hiding this comment.
Looks like this commit duplicates 90f5cfd, but only for import paths.
bors
commented
Nov 30, 2017
⌛ Testing commit cb213ef5ba6f65e846091fa59c5523a8f37fcf36 with merge b48013cebad8ec4ebb4ce75b3db17096e24cf1d0... |
bors
commented
Nov 30, 2017
💔 Test failed - status-travis |
petrochenkov
commented
Nov 30, 2017
Of course, rustfmt is broken. It's also desirable to send a PR to rustfmt fixing the breakage. |
This commit adds support for nested groups inside `use` declarations,
such as `use foo::{bar, sub::{baz::Foo, *}};`.cb213ef to
f7f6951Compareemilyalbini
commented
Nov 30, 2017
Ok, marked rustfmt and rls as broken. I'll look into sending a PR to rustfmt. @bors r=petrochenkov |
bors
commented
Nov 30, 2017
📌 Commit f7f6951 has been approved by |
bors
commented
Dec 1, 2017
Add nested groups in imports This PR adds support for nested groups in imports (rust-lang/rfcs#2128, tracking issue #44494). r? @petrochenkov
bors
commented
Dec 1, 2017
☀️ Test successful - status-appveyor, status-travis |
theduke
commented
Dec 1, 2017
@pietroalbini thanks for working on this, I've been waiting for the feature. |
emilyalbini
commented
Dec 1, 2017
🎉 🎉 🎉 🎉 Thank you @eddyb, @petrochenkov and @nikomatsakis for helping me during the implementation! |
syntax: Make imports in AST closer to the source and cleanup their parsing This is a continuation of #45846 in some sense.
This PR adds support for nested groups in imports (rust-lang/rfcs#2128, tracking issue #44494).
r? @petrochenkov