Fix precise capturing suggestion for hidden regions when we have APITs#127664
Merged
bors merged 1 commit intorust-lang:masterfrom Jul 18, 2024
Merged
Conversation
Collaborator
|
☔ The latest upstream changes (presumably #127665) made this pull request unmergeable. Please resolve the merge conflicts. |
14 tasks
oli-obk
reviewed
Jul 17, 2024
oli-obk
reviewed
Jul 17, 2024
Comment on lines
1383
to
1387
| // This currently involves stripping the `impl` from the name of | ||
| // the parameter, since APITs are always named after how they are | ||
| // rendered in the AST. This sucks! But to recreate the bound list | ||
| // from the APIT itself would be miserable, so we're stuck with | ||
| // this for now! |
Contributor
There was a problem hiding this comment.
could also adjust the spans in the future to not include the impl if that is nice diagnostic wise on other diagnostics, too
Contributor
Author
There was a problem hiding this comment.
Well, there are likely problems with not returning the full span (e.g. for deletion, or renaming). Like, we already need to use the full span in this diagnostic to suggest renaming impl Trait into T.
5a1a949 to
1d40d4c
Compare
Contributor
Author
|
@bors r=oli-obk rollup |
Collaborator
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Jul 17, 2024
…better-sugg-apit, r=oli-obk Fix precise capturing suggestion for hidden regions when we have APITs Suggests to turn APITs into type parameters so they can be named in precise capturing syntax for hidden type lifetime errors. We also note that it may change the API. This is currently done via a note *and* a suggestion, which feels a bit redundant, but I wasn't totally sure of a better alternative for the presentation. Code is kind of a mess but there's a lot of cases to consider. Happy to iterate on this if you think the approach is too messy. Based on rust-lang#127619, only the last commit is relevant. r? oli-obk Tracking: - rust-lang#123432
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 18, 2024
…iaskrgr Rollup of 9 pull requests Successful merges: - rust-lang#127542 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#127652 (Unignore cg_gcc fmt) - rust-lang#127664 (Fix precise capturing suggestion for hidden regions when we have APITs) - rust-lang#127806 (Some parser improvements) - rust-lang#127828 (Commonize `uname -m` results for `aarch64` in docker runner) - rust-lang#127845 (unix: break `stack_overflow::install_main_guard` into smaller fn) - rust-lang#127854 (Add internal lint for detecting non-glob imports of `rustc_type_ir::inherent`) - rust-lang#127861 (Document the column numbers for the dbg! macro) - rust-lang#127875 (style-guide: Clarify version-sorting) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 18, 2024
Rollup of 9 pull requests Successful merges: - rust-lang#127542 ([`macro_metavar_expr_concat`] Add support for literals) - rust-lang#127652 (Unignore cg_gcc fmt) - rust-lang#127664 (Fix precise capturing suggestion for hidden regions when we have APITs) - rust-lang#127806 (Some parser improvements) - rust-lang#127828 (Commonize `uname -m` results for `aarch64` in docker runner) - rust-lang#127845 (unix: break `stack_overflow::install_main_guard` into smaller fn) - rust-lang#127859 (ptr::metadata: avoid references to extern types) - rust-lang#127861 (Document the column numbers for the dbg! macro) - rust-lang#127875 (style-guide: Clarify version-sorting) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jul 18, 2024
Rollup merge of rust-lang#127664 - compiler-errors:precise-capturing-better-sugg-apit, r=oli-obk Fix precise capturing suggestion for hidden regions when we have APITs Suggests to turn APITs into type parameters so they can be named in precise capturing syntax for hidden type lifetime errors. We also note that it may change the API. This is currently done via a note *and* a suggestion, which feels a bit redundant, but I wasn't totally sure of a better alternative for the presentation. Code is kind of a mess but there's a lot of cases to consider. Happy to iterate on this if you think the approach is too messy. Based on rust-lang#127619, only the last commit is relevant. r? oli-obk Tracking: - rust-lang#123432
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.
Suggests to turn APITs into type parameters so they can be named in precise capturing syntax for hidden type lifetime errors. We also note that it may change the API.
This is currently done via a note and a suggestion, which feels a bit redundant, but I wasn't totally sure of a better alternative for the presentation.
Code is kind of a mess but there's a lot of cases to consider. Happy to iterate on this if you think the approach is too messy.
Based on #127619, only the last commit is relevant.
r? oli-obk
Tracking:
precise_capturingsyntax #123432