When trying to recover from for<…> dyn … don't unconditionally treat dyn as a keyword - #162340
Open
fmease wants to merge 1 commit into
Open
When trying to recover from for<…> dyn … don't unconditionally treat dyn as a keyword#162340fmease wants to merge 1 commit into
for<…> dyn … don't unconditionally treat dyn as a keyword#162340fmease wants to merge 1 commit into
Conversation
Collaborator
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
fmease
force-pushed
the
fix-for-dyn-recovery
branch
from
September 5, 2026 17:21
27ed5e7 to
b6361ec
Compare
This comment has been minimized.
This comment has been minimized.
fmease
force-pushed
the
fix-for-dyn-recovery
branch
from
September 5, 2026 18:33
b6361ec to
a210e58
Compare
fmease
commented
Sep 5, 2026
| //~^ ERROR `for<...>` expected after `impl`, not before | ||
|
|
||
| // Issue #118564 | ||
| type A2 = dyn<for<> dyn>; |
Member
Author
There was a problem hiding this comment.
nightly-2023-12-03 also ICEs for the much smaller type X = for<> dyn; which incidentally is the code I added to dyn-2015-identifier.rs. Hence the other test now kills two birds with one stone allowing me to remove this regression test case.
fmease
force-pushed
the
fix-for-dyn-recovery
branch
from
September 6, 2026 09:23
a210e58 to
0d1e323
Compare
…t `dyn` as a keyword
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.
dynis only a keyword in Rust 2015 if it's followed by a token in the following set: {PathIdentSegment, LIFETIME_TOKEN,for,(,?}. However, thefor<…> dyn …→dyn for<…> …recovery code treated it as a keyword unconditionally meaning we were incorrectly rejecting Rust 2015 code liketrait dyn {} type X = for<> dyn;This is very similar to issue #157565.
(No LLM was or will be used by me during the entire creation process of this PR)