diff options
| author | SparkyPotato <noob.sparkypotato@gmail.com> | 2024-06-24 16:20:22 -0500 |
|---|---|---|
| committer | SparkyPotato <noob.sparkypotato@gmail.com> | 2024-06-24 16:20:22 -0500 |
| commit | 26677eb06efbd976e2a3b1c30eacf8e22c8c831c (patch) | |
| tree | 6b966025bb021760ce5181e61a3cfa3391bb03b5 /compiler/rustc_infer/src | |
| parent | d371d17496f2ce3a56da76aa083f4ef157572c20 (diff) | |
| download | rust-26677eb06efbd976e2a3b1c30eacf8e22c8c831c.tar.gz rust-26677eb06efbd976e2a3b1c30eacf8e22c8c831c.zip | |
don't suggest awaiting type expr patterns
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/error_reporting/suggest.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs index 74c65e93616..13b145296a7 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/suggest.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/suggest.rs @@ -209,8 +209,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { } (Some(ty), _) if self.same_type_modulo_infer(ty, exp_found.found) => match cause.code() { - ObligationCauseCode::Pattern { span: Some(then_span), .. } => { - Some(ConsiderAddingAwait::FutureSugg { span: then_span.shrink_to_hi() }) + ObligationCauseCode::Pattern { span: Some(then_span), origin_expr, .. } => { + origin_expr.then_some(ConsiderAddingAwait::FutureSugg { + span: then_span.shrink_to_hi(), + }) } ObligationCauseCode::IfExpression(box IfExpressionCause { then_id, .. }) => { let then_span = self.find_block_span_from_hir_id(*then_id); |
