Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint#134142
Merged
bors merged 1 commit intorust-lang:masterfrom Dec 11, 2024
Merged
Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint#134142bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
fmease
reviewed
Dec 10, 2024
Member
There was a problem hiding this comment.
We don't have basically any preexisting machinery to detect when parentheses are needed for types
We have hir::Generics::bounds_span_for_suggestions() for bounds (on generic params I guess?). I don't know if you can leverage it here in some way or generalize it. I haven't looked at it for a while.
Edit: And yeah, it checks for TyKind::Ref but not for TyKind::Ptr, I've been meaning to fix that for some time.
cc #120929
Contributor
Author
There was a problem hiding this comment.
That's more about ambiguities introduced by the bound of the RPIT themselves. This fixes ambiguities having to do with the parent type of the RPIT. I think both could use fixing and unification, but I don't think I'll do it here.
jieyouxu
approved these changes
Dec 11, 2024
Member
|
@bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 11, 2024
Rollup of 8 pull requests Successful merges: - rust-lang#134079 (Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless) - rust-lang#134105 (Validate self in host predicates correctly) - rust-lang#134136 (Exercise const trait interaction with default fields) - rust-lang#134139 ([AIX] keep profile-rt symbol alive) - rust-lang#134141 (Remove more traces of anonymous ADTs) - rust-lang#134142 (Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint) - rust-lang#134158 (Rename `projection_def_id` to `item_def_id`) - rust-lang#134160 (Add vacation entry for myself in triagebot.toml) r? `@ghost` `@rustbot` modify labels: rollup
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 11, 2024
Rollup of 8 pull requests Successful merges: - rust-lang#134079 (Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless) - rust-lang#134105 (Validate self in host predicates correctly) - rust-lang#134136 (Exercise const trait interaction with default fields) - rust-lang#134139 ([AIX] keep profile-rt symbol alive) - rust-lang#134141 (Remove more traces of anonymous ADTs) - rust-lang#134142 (Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint) - rust-lang#134158 (Rename `projection_def_id` to `item_def_id`) - rust-lang#134160 (Add vacation entry for myself in triagebot.toml) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Dec 11, 2024
Rollup merge of rust-lang#134142 - compiler-errors:paren-sug, r=jieyouxu Rudimentary heuristic to insert parentheses when needed for RPIT overcaptures lint We don't have basically any preexisting machinery to detect when parentheses are needed for *types*. AFAICT, all of the diagnostics we have for opaques just... fail when they suggest `+ 'a` when that's ambiguous. Fixes rust-lang#132853
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.
We don't have basically any preexisting machinery to detect when parentheses are needed for types. AFAICT, all of the diagnostics we have for opaques just... fail when they suggest
+ 'awhen that's ambiguous.Fixes #132853