diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-02-07 17:57:14 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-07 17:57:14 +0100 |
| commit | 917662a8f6f4ddce6993ed7a528f1d8d8dd2764d (patch) | |
| tree | d8e07ed464d2f4bf267ff26f0969b05e9d996f8b /compiler/rustc_trait_selection/src | |
| parent | 44bc2db4842842b63dfa69a0bd3b5e65ee523f51 (diff) | |
| parent | af5a37e8440c503b5bb89ec94199f036d772b9e8 (diff) | |
Rollup merge of #107555 - edward-shen:edward-shen/dup-trait-suggestion, r=compiler-errors
Modify existing bounds if they exist Fixes #107335. This implementation is kinda gross but I don't really see a better way to do it. This primarily does two things: Modifies `suggest_constraining_type_param` to accept a new parameter that indicates a span to be replaced instead of added, if presented, and limit the additive suggestions to either suggest a new bound on an existing bound (see newly added unit test) or add the generics argument if a generics argument wasn't found. The former change is required to retain the capability to add an entirely new bounds if it was entirely omitted. r? ``@compiler-errors``
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs index 87dbf7c3fd6..91da690a000 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -679,6 +679,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ¶m_name, &constraint, Some(trait_pred.def_id()), + None, ) { return; } @@ -1087,6 +1088,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { param.name.as_str(), "Clone", Some(clone_trait), + None, ); } err.span_suggestion_verbose( |
