-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Remove Nonterminal
and TokenKind::Interpolated
#124141
Open
nnethercote
wants to merge
12
commits into
rust-lang:master
Choose a base branch
from
nnethercote:rm-Nonterminal-and-TokenKind-Interpolated
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Remove Nonterminal
and TokenKind::Interpolated
#124141
nnethercote
wants to merge
12
commits into
rust-lang:master
from
nnethercote:rm-Nonterminal-and-TokenKind-Interpolated
+1,440
−2,472
Commits on Nov 24, 2024
-
We now use invisible delimiters for expanded `vis` fragments, instead of `Token::Interpolated`.
Configuration menu - View commit details
-
Copy full SHA for 4c098db - Browse repository at this point
Copy the full SHA 4c098dbView commit details -
Notes about tests: - tests/ui/parser/macro/trait-object-macro-matcher.rs: the syntax error is duplicated, because it occurs now when parsing the decl macro input, and also when parsing the expanded decl macro. But this won't show up for normal users due to error de-duplication. - tests/ui/associated-consts/issue-93835.rs: ditto. - The changes to metavariable descriptions in this PR's earlier commits are now visible in error message for several tests.
Configuration menu - View commit details
-
Copy full SHA for 3efa325 - Browse repository at this point
Copy the full SHA 3efa325View commit details -
The one notable test change is `tests/ui/macros/trace_faulty_macros.rs`. This commit removes the complicated `Interpolated` handling in `expected_expression_found` that results in a longer error message. But I think the new, shorter message is actually an improvement. The original complaint was in rust-lang#71039, when the error message started with "error: expected expression, found `1 + 1`". That was confusing because `1 + 1` is an expression. Other than that, the reporter said "the whole error message is not too bad if you ignore the first line". Subsequently, extra complexity and wording was added to the error message. But I don't think the extra wording actually helps all that much. In particular, it still says of the `1+1` that "this is expected to be expression". This repeats the problem from the original complaint! This commit removes the extra complexity, reverting to a simpler error message. This is primarily because the traversal is a pain without `Interpolated` tokens. Nonetheless, I think the error message is *improved*. It now starts with "expected expression, found `pat` metavariable", which is much clearer and the real problem. It also doesn't say anything specific about `1+1`, which is good, because the `1+1` isn't really relevant to the error -- it's the `$e:pat` that's important.
Configuration menu - View commit details
-
Copy full SHA for ce05de5 - Browse repository at this point
Copy the full SHA ce05de5View commit details -
This involves replacing `nt_pretty_printing_compatibility_hack` with `stream_pretty_printing_compatibility_hack`. The handling of statements in `transcribe` is slightly different to other nonterminal kinds, due to the lack of `from_ast` implementation for empty statements. Notable test changes: - `tests/ui/proc-macro/expand-to-derive.rs`: the diff looks large but the only difference is the insertion of a single invisible-delimited group around a metavar.
Configuration menu - View commit details
-
Copy full SHA for 2dfeaa9 - Browse repository at this point
Copy the full SHA 2dfeaa9View commit details -
More denesting of invisibly-delimited groups.
This time when converting them to proc-macro `Group` form.
Configuration menu - View commit details
-
Copy full SHA for d4fbe1f - Browse repository at this point
Copy the full SHA d4fbe1fView commit details -
Note: there was an existing code path involving `Interpolated` in `MetaItem::from_tokens` that was dead. This commit transfers that to the new form, but puts an `unreachable!` call inside it.
Configuration menu - View commit details
-
Copy full SHA for f5acfd7 - Browse repository at this point
Copy the full SHA f5acfd7View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6af929b - Browse repository at this point
Copy the full SHA 6af929bView commit details -
Notes about tests: - tests/ui/rfcs/rfc-2294-if-let-guard/feature-gate.rs: some messages are now duplicated due to repeated parsing. - tests/ui/rfcs/rfc-2497-if-let-chains/disallowed-positions.rs: ditto. - `tests/ui/proc-macro/macro-rules-derive-cfg.rs`: the diff looks large but the only difference is the insertion of a single invisible-delimited group around a metavar.
Configuration menu - View commit details
-
Copy full SHA for f797ad5 - Browse repository at this point
Copy the full SHA f797ad5View commit details -
Configuration menu - View commit details
-
Copy full SHA for febfb8d - Browse repository at this point
Copy the full SHA febfb8dView commit details
Commits on Nov 25, 2024
-
Remove
NtBlock
,Nonterminal
, andTokenKind::Interpolated
.`NtBlock` is the last remaining variant of `Nonterminal`, so once it is gone then `Nonterminal` can be removed as well.
Configuration menu - View commit details
-
Copy full SHA for 0a3c9b5 - Browse repository at this point
Copy the full SHA 0a3c9b5View commit details -
Configuration menu - View commit details
-
Copy full SHA for db50c0f - Browse repository at this point
Copy the full SHA db50c0fView commit details -
Remove
TokenStream::flattened
andInvisibleOrigin::FlattenToken
.They are no longer needed. This does slightly worsen the error message for a single test, but that test contains code that is so badly broken that I'm not worried about it.
Configuration menu - View commit details
-
Copy full SHA for 2479f6c - Browse repository at this point
Copy the full SHA 2479f6cView commit details
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.