about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIQuant <quant3234@gmail.com>2023-02-14 23:16:29 +0300
committerIQuant <quant3234@gmail.com>2023-02-14 23:16:29 +0300
commit58939b9520e71b6caa2ccc5ca28071e6379d39c0 (patch)
tree4a2ac88607603dc053c31a718055fe9f5c125637
parent5c7afde6f2729963b06477f25ef66680e68e434f (diff)
Specify correct spans in suggest_await_on_expect_found
-rw-r--r--compiler/rustc_infer/src/errors/mod.rs8
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/suggest.rs6
2 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_infer/src/errors/mod.rs b/compiler/rustc_infer/src/errors/mod.rs
index f4af251d11f..0c2713fb1a7 100644
--- a/compiler/rustc_infer/src/errors/mod.rs
+++ b/compiler/rustc_infer/src/errors/mod.rs
@@ -1072,14 +1072,8 @@ pub enum ConsiderAddingAwait {
         #[primary_span]
         span: Span,
     },
-    #[suggestion(
-        infer_await_future,
-        code = ".await",
-        style = "verbose",
-        applicability = "maybe-incorrect"
-    )]
     #[note(infer_await_note)]
-    FutureSuggWithNote {
+    FutureSuggNote {
         #[primary_span]
         span: Span,
     },
diff --git a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs
index b183abf977f..18c5097a262 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs
@@ -223,7 +223,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
                 _ => Some(ConsiderAddingAwait::BothFuturesHelp),
             },
             (_, Some(ty)) if self.same_type_modulo_infer(exp_found.expected, ty) => {
-                Some(ConsiderAddingAwait::FutureSuggWithNote { span: exp_span.shrink_to_hi() })
+                // FIXME: Seems like we can't have a suggestion and a note with different spans in a single subdiagnostic
+                diag.subdiagnostic(ConsiderAddingAwait::FutureSugg {
+                    span: exp_span.shrink_to_hi(),
+                });
+                Some(ConsiderAddingAwait::FutureSuggNote { span: exp_span })
             }
             (Some(ty), _) if self.same_type_modulo_infer(ty, exp_found.found) => match cause.code()
             {