Skip to content

Commit 58939b9

Browse files
committed
Specify correct spans in suggest_await_on_expect_found
1 parent 5c7afde commit 58939b9

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

compiler/rustc_infer/src/errors/mod.rs

+1-7
Original file line numberDiff line numberDiff line change
@@ -1072,14 +1072,8 @@ pub enum ConsiderAddingAwait {
10721072
#[primary_span]
10731073
span: Span,
10741074
},
1075-
#[suggestion(
1076-
infer_await_future,
1077-
code = ".await",
1078-
style = "verbose",
1079-
applicability = "maybe-incorrect"
1080-
)]
10811075
#[note(infer_await_note)]
1082-
FutureSuggWithNote {
1076+
FutureSuggNote {
10831077
#[primary_span]
10841078
span: Span,
10851079
},

compiler/rustc_infer/src/infer/error_reporting/suggest.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,11 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
223223
_ => Some(ConsiderAddingAwait::BothFuturesHelp),
224224
},
225225
(_, Some(ty)) if self.same_type_modulo_infer(exp_found.expected, ty) => {
226-
Some(ConsiderAddingAwait::FutureSuggWithNote { span: exp_span.shrink_to_hi() })
226+
// FIXME: Seems like we can't have a suggestion and a note with different spans in a single subdiagnostic
227+
diag.subdiagnostic(ConsiderAddingAwait::FutureSugg {
228+
span: exp_span.shrink_to_hi(),
229+
});
230+
Some(ConsiderAddingAwait::FutureSuggNote { span: exp_span })
227231
}
228232
(Some(ty), _) if self.same_type_modulo_infer(ty, exp_found.found) => match cause.code()
229233
{

0 commit comments

Comments
 (0)