rust/compiler/rustc_hir_analysis/src
Matthias Krüger bfe032334f
Rollup merge of #126054 - veera-sivarajan:bugfix-113073-bound-on-generics-2, r=fee1-dead
`E0229`: Suggest Moving Type Constraints to Type Parameter Declaration

Fixes #113073

This PR suggests  `impl<T: Bound> Trait<T> for Foo` when finding `impl Trait<T: Bound> for Foo`. Tangentially, it also improves a handful of other error messages.

It accomplishes this in two steps:
1. Check if constrained arguments and parameter names appear in the same order and delay emitting "incorrect number of generic arguments" error because it can be confusing for the programmer to see `0 generic arguments provided` when there are `n` constrained generic arguments.

2. Inside `E0229`, suggest declaring the type parameter right after the `impl` keyword by finding the relevant impl block's span for type parameter declaration. This also handles lifetime declarations correctly.

Also, the multi part suggestion doesn't use the fluent error mechanism because translating all the errors to fluent style feels outside the scope of this PR. I will handle it in a separate PR if this gets approved.
2024-06-14 12:23:36 +02:00
..
check Auto merge of #125918 - oli-obk:const_block_ice, r=compiler-errors 2024-06-07 09:08:59 +00:00
coherence Auto merge of #125380 - compiler-errors:wc-obj-safety, r=oli-obk 2024-06-04 02:34:20 +00:00
collect Rollup merge of #126340 - fee1-dead-contrib:fix-predicates_of-comments, r=compiler-errors 2024-06-12 14:26:29 -04:00
errors Explicitly mention Self 2024-04-20 11:39:43 -04:00
hir_ty_lowering Rollup merge of #126054 - veera-sivarajan:bugfix-113073-bound-on-generics-2, r=fee1-dead 2024-06-14 12:23:36 +02:00
impl_wf_check Opt-in diagnostics reporting to avoid doing extra work in the new solver 2024-06-03 09:27:52 -04:00
outlives Give EarlyBinder a tcx parameter 2024-05-26 20:04:05 -04:00
structured_errors Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
variance Add and use generics.is_empty() and generics.is_own_empty, rather than using generics' attributes 2024-05-19 11:10:56 -03:00
autoderef.rs Make builtin_deref just return a Ty 2024-05-09 22:55:00 -04:00
bounds.rs Rename ToPredicate for Upcast 2024-05-16 14:23:47 -04:00
check_unused.rs Remove LintDiagnostic::msg 2024-05-23 04:08:35 +02:00
collect.rs Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obk 2024-06-06 08:14:58 +00:00
constrained_generic_params.rs Auto merge of #125076 - compiler-errors:alias-term, r=lcnr 2024-05-13 22:20:43 +00:00
errors.rs Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubilee 2024-06-12 11:10:50 +00:00
hir_wf_check.rs Handle safety keyword for extern block inner items 2024-06-04 14:19:42 -03:00
impl_wf_check.rs Hide some follow-up errors 2024-06-03 13:03:53 +00:00
lib.rs Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
structured_errors.rs Rename StructuredDiagnostic as StructuredDiag. 2024-03-05 12:15:12 +11:00