-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Recover keywords in trait bounds #99915
Merged
Merged
Conversation
This file contains 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
For example, this fixes a error for `impl fn()` (notice the capitalization)
rustbot
added
the
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
label
Jul 29, 2022
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Jul 29, 2022
WaffleLapkin
force-pushed
the
recover_keyword_bounds
branch
from
July 29, 2022 18:11
e659dba
to
e6a4f79
Compare
This comment has been minimized.
This comment has been minimized.
WaffleLapkin
force-pushed
the
recover_keyword_bounds
branch
from
July 29, 2022 19:29
e6a4f79
to
798016c
Compare
compiler-errors
added
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Aug 11, 2022
let span = self.prev_token.span; | ||
self.sess.gated_spans.gate(sym::const_trait_impl, span); | ||
|
||
self.struct_span_err(span, "const bounds must start with `~`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if ~const Trait
is called a "const" bound technically-- I would call it a "const if const" bound. But whatever, should be fine.
@bors r+ |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Aug 22, 2022
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 22, 2022
Rollup of 5 pull requests Successful merges: - rust-lang#93162 (Std module docs improvements) - rust-lang#99386 (Add tests that check `Vec::retain` predicate execution order.) - rust-lang#99915 (Recover keywords in trait bounds) - rust-lang#100694 (Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)) - rust-lang#100757 (Catch overflow early) Failed merges: - rust-lang#99917 (Move Error trait into core) r? `@ghost` `@rustbot` modify labels: rollup
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Feb 9, 2023
…macro-is-ok, r=estebank Do not eagerly recover for bad `impl Trait` types in macros Fixes rust-lang#107796 cc rust-lang#106712, `@estebank` and `@Ezrashaw` please make sure to use [`Parser::may_recover`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.may_recover) for all eager-token-consuming parser recoveries. This also fixes a separate regression from rust-lang#99915, that was introduced before we added `may_recover` though.
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Feb 9, 2023
…macro-is-ok, r=estebank Do not eagerly recover for bad `impl Trait` types in macros Fixes rust-lang#107796 cc rust-lang#106712, ``@estebank`` and ``@Ezrashaw`` please make sure to use [`Parser::may_recover`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.may_recover) for all eager-token-consuming parser recoveries. This also fixes a separate regression from rust-lang#99915, that was introduced before we added `may_recover` though.
compiler-errors
added a commit
to compiler-errors/rust
that referenced
this pull request
Feb 9, 2023
…macro-is-ok, r=estebank Do not eagerly recover for bad `impl Trait` types in macros Fixes rust-lang#107796 cc rust-lang#106712, ```@estebank``` and ```@Ezrashaw``` please make sure to use [`Parser::may_recover`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/parser/struct.Parser.html#method.may_recover) for all eager-token-consuming parser recoveries. This also fixes a separate regression from rust-lang#99915, that was introduced before we added `may_recover` though.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
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.
(this pr was inspired by this tweet)
Recover keywords in trait bound, motivational example:
Current nightly (3 needless and confusing errors!)
This PR:
It would be nice to have suggestion in the first error like "have you meant
Fn
trait", instead of a separate error, but the recovery is deep inside ident parsing, which makes it a lot harder to do.r? @compiler-errors