-
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
Recover from function pointer types with generic parameter list #104223
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
rustbot
added
A-translation
Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Nov 10, 2022
cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki |
fmease
changed the title
Recover from fn ptr tys with generic param list
Recover from function pointer types with generic parameter list
Nov 10, 2022
fmease
commented
Nov 10, 2022
fmease
force-pushed
the
recover-fn-ptr-with-generics
branch
2 times, most recently
from
November 10, 2022 11:46
5fe8cf1
to
bbe8f1d
Compare
📌 Commit bbe8f1d56588bc85f450fec2e041066a417f8f03 has been approved by It is now in the queue for this repository. |
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-review
Status: Awaiting review from the assignee but also interested parties.
labels
Nov 11, 2022
This comment was marked as resolved.
This comment was marked as resolved.
bors
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-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
labels
Nov 11, 2022
fmease
force-pushed
the
recover-fn-ptr-with-generics
branch
from
November 11, 2022 12:43
bbe8f1d
to
c2b906b
Compare
@rustbot reviewer |
rustbot
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
and removed
S-waiting-on-author
Status: This is awaiting some action (such as code changes or more information) from the author.
labels
Nov 11, 2022
@bors r=estebank |
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-review
Status: Awaiting review from the assignee but also interested parties.
labels
Nov 14, 2022
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Nov 14, 2022
…s, r=estebank Recover from function pointer types with generic parameter list Give a more helpful error when encountering function pointer types with a generic parameter list like `fn<'a>(&'a str) -> bool` or `fn<T>(T) -> T` and suggest moving lifetime parameters to a `for<>` parameter list. I've added a bunch of extra code to properly handle (unlikely?) corner cases like `for<'a> fn<'b>()` (where there already exists a `for<>` parameter list) correctly suggesting `for<'a, 'b> fn()` (merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case. I am quite open to suggestions regarding the wording of the diagnostic messages. Fixes rust-lang#103487. `@rustbot` label A-diagnostics r? diagnostics
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Nov 15, 2022
…iaskrgr Rollup of 11 pull requests Successful merges: - rust-lang#101967 (Move `unix_socket_abstract` feature API to `SocketAddrExt`.) - rust-lang#102470 (Stabilize const char convert) - rust-lang#104223 (Recover from function pointer types with generic parameter list) - rust-lang#104229 (Don't print full paths in overlap errors) - rust-lang#104294 (Don't ICE with inline const errors during MIR build) - rust-lang#104332 (Fixed some `_i32` notation in `maybe_uninit`’s doc) - rust-lang#104349 (fix some typos in comments) - rust-lang#104350 (Fix x finding Python on Windows) - rust-lang#104356 (interpret: make check_mplace public) - rust-lang#104364 (rustdoc: Resolve doc links in external traits having local impls) - rust-lang#104378 (Bump chalk to v0.87) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-translation
Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic
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.
Give a more helpful error when encountering function pointer types with a generic parameter list like
fn<'a>(&'a str) -> bool
orfn<T>(T) -> T
and suggest moving lifetime parameters to afor<>
parameter list.I've added a bunch of extra code to properly handle (unlikely?) corner cases like
for<'a> fn<'b>()
(where there already exists afor<>
parameter list) correctly suggestingfor<'a, 'b> fn()
(merging the lists). If you deem this useless, I can simplify the code by suggesting nothing at all in this case.I am quite open to suggestions regarding the wording of the diagnostic messages.
Fixes #103487.
@rustbot label A-diagnostics
r? diagnostics