-
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
Fix wrong suggestion for adding where clauses #97640
Fix wrong suggestion for adding where clauses #97640
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
7f6a1c8
to
b9df277
Compare
@@ -591,8 +591,7 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> { | |||
}) if !param_ty => { |
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.
can you instead move that check to here?
a method called suggest_arbitrary_trait_bound
should ideally do just that unconditionally
b9df277
to
2898890
Compare
📌 Commit 2898890 has been approved by |
@bors r- |
@bors r+ rollup 😅 |
📌 Commit 2898890 has been approved by |
…ding-where-clauses, r=lcnr Fix wrong suggestion for adding where clauses closes rust-lang#97576
…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
…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.
…, 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.
closes #97576