Skip to content
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

Fix wrong suggestion for adding where clauses #97640

Merged

Conversation

TaKO8Ki
Copy link
Member

@TaKO8Ki TaKO8Ki commented Jun 2, 2022

closes #97576

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 2, 2022
@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 2, 2022
@rust-log-analyzer

This comment has been minimized.

@TaKO8Ki TaKO8Ki force-pushed the fix-wrong-suggestion-for-adding-where-clauses branch from 7f6a1c8 to b9df277 Compare June 2, 2022 07:51
@@ -591,8 +591,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
}) if !param_ty => {
Copy link
Contributor

@lcnr lcnr Jun 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you instead move that check to here?

a method called suggest_arbitrary_trait_bound should ideally do just that unconditionally

@TaKO8Ki TaKO8Ki force-pushed the fix-wrong-suggestion-for-adding-where-clauses branch from b9df277 to 2898890 Compare June 2, 2022 11:50
@lcnr
Copy link
Contributor

lcnr commented Jun 2, 2022

r? @lcnr

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 2, 2022

📌 Commit 2898890 has been approved by lcnr

@bors 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 Jun 2, 2022
@lcnr
Copy link
Contributor

lcnr commented Jun 2, 2022

@bors r-

@bors 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 Jun 2, 2022
@lcnr
Copy link
Contributor

lcnr commented Jun 2, 2022

@bors r+ rollup

😅

@bors
Copy link
Contributor

bors commented Jun 2, 2022

📌 Commit 2898890 has been approved by lcnr

@bors 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 Jun 2, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jun 2, 2022
…ding-where-clauses, r=lcnr

Fix wrong suggestion for adding where clauses

closes rust-lang#97576
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 3, 2022
…askrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#97502 (rustdoc: Add more test coverage)
 - rust-lang#97627 (update explicit impls error msg)
 - rust-lang#97640 (Fix wrong suggestion for adding where clauses)
 - rust-lang#97645 (don't use a `span_note` for ignored impls)
 - rust-lang#97655 (Improve documentation for constructors of pinned `Box`es)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0e33e97 into rust-lang:master Jun 3, 2022
@rustbot rustbot added this to the 1.63.0 milestone Jun 3, 2022
@TaKO8Ki TaKO8Ki deleted the fix-wrong-suggestion-for-adding-where-clauses branch June 3, 2022 04:04
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jun 11, 2022
…dy, r=cjgillot

Tidy up miscellaneous bounds suggestions

Just some small fixes to suggestions

- Generalizes `Ty::is_suggestable` into a `TypeVisitor`, so that it can be called on things other than `Ty`
- Makes `impl Trait` in arg position no longer suggestible (generalizing the fix in rust-lang#97640)
- Fixes `impl Trait` not being replaced with fresh type param when it's deeply nested in function signature (fixes rust-lang#97760)
- Fixes some poor handling of `where` clauses with no predicates (also rust-lang#97760)
- Uses `InferCtxt::resolve_numeric_literals_with_default` so we suggest `i32` instead of `{integer}` (fixes rust-lang#97677)

Sorry there aren't many tests the fixes. Most of them would just be duplicates of other tests with empty `where` clauses or `impl Trait` in arg position instead of generic params. Let me know if you'd want more test coverage.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2022
…, r=cjgillot

Tidy up miscellaneous bounds suggestions

Just some small fixes to suggestions

- Generalizes `Ty::is_suggestable` into a `TypeVisitor`, so that it can be called on things other than `Ty`
- Makes `impl Trait` in arg position no longer suggestible (generalizing the fix in rust-lang#97640)
- Fixes `impl Trait` not being replaced with fresh type param when it's deeply nested in function signature (fixes rust-lang#97760)
- Fixes some poor handling of `where` clauses with no predicates (also rust-lang#97760)
- Uses `InferCtxt::resolve_numeric_literals_with_default` so we suggest `i32` instead of `{integer}` (fixes rust-lang#97677)

Sorry there aren't many tests the fixes. Most of them would just be duplicates of other tests with empty `where` clauses or `impl Trait` in arg position instead of generic params. Let me know if you'd want more test coverage.
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler suggests adding illegal where bounds
7 participants