Repository navigation
Conversation
Merged
`use crate::a;`, `use super::{A, B};`, and `use a::{self, b};` failed
with "expected ident, received "crate"": the use tree parsers accepted
only identifier segments, while the lexer produces these path keywords
as keyword tokens. Inside a module the failure was silent, because the
item list stopped at the `use` item: `mod m { use super::A; }` parsed as
an empty module.
Use path, name, and rename segments now accept the path keywords, stored
as identifiers with the keyword's text.
`use a::{b, c,};`, `Foo<A, B,>`, and `fn f<T: A,>()` failed to parse,
since the lists required a value after every comma. Rust accepts a
trailing comma in each.
`List::parse_nonempty_until::<E>` parses one or more values with an
optional trailing separator before the token `E`; generic arguments and
generic parameters use it before `>`, and use groups parse a full,
possibly trailing, list, which also reports a missing comma
(`use a::{b c};`) as "expected punctuation". The skippers follow.
`use a::{};` failed with "expected Ident": a use group was recognized
only when a use tree began inside its braces, so an empty group fell
through to a use name. Rust accepts the empty group, which imports
nothing.
Any brace-delimited group in a use tree is now a use group, and the
group's skipper accepts one with no trees.
faysou
force-pushed
the
fix-use-tree-syntax
branch
from
November 21, 2026 07:10
44498b3 to
32c82ae
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Parse path keywords in use trees and accept empty groups such as
use a::{};. Preserve trailing commas in use groups and angle-bracket lists.The use-tree and generics test modules pass.
Related to #25.