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:
Daniel Xu 2022-07-08 21:03:03 -05:00
parent 06754d8852
commit 34e9e6dff1
8 changed files with 12 additions and 24 deletions

View file

@ -2074,6 +2074,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!(