Rollup merge of #99075 - danobi:dup_type_hint_sugg, r=petrochenkov

Fix duplicated type annotation suggestion

Before, there was more or less duplicated suggestions to add type hints.
Fix by clearing more generic suggestions when a more specific suggestion
is possible.

This fixes #93506 .
This commit is contained in:
Matthias Krüger 2022-07-11 22:39:05 +02:00 committed by GitHub
commit d89c183554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 13 additions and 25 deletions

View file

@ -2094,6 +2094,9 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
// |
// = note: cannot satisfy `_: Tt`
// Clear any more general suggestions in favor of our specific one
err.clear_suggestions();
err.span_suggestion_verbose(
span.shrink_to_hi(),
&format!(