about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2021-11-16 22:06:25 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2021-12-13 17:09:16 +0000
commitb825b0fe6333ff08552aefa1fb25dfdc932b8bca (patch)
treea9d8b7032ebd9843f759da46b97239a3a902ba1c
parent8888d0d61e800654db4e1cd52e9e81dffb5c8ee2 (diff)
downloadrust-b825b0fe6333ff08552aefa1fb25dfdc932b8bca.tar.gz
rust-b825b0fe6333ff08552aefa1fb25dfdc932b8bca.zip
Fix rebase and clippy tests
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs24
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs6
-rw-r--r--compiler/rustc_passes/src/region.rs11
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs78
-rw-r--r--compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs4
-rw-r--r--src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr32
-rw-r--r--src/test/ui/async-await/issue-70594.rs1
-rw-r--r--src/test/ui/async-await/issue-70594.stderr21
-rw-r--r--src/test/ui/async-await/issues/issue-51719.stderr4
-rw-r--r--src/test/ui/async-await/issues/issue-51751.stderr4
-rw-r--r--src/test/ui/async-await/issues/issue-62009-1.rs1
-rw-r--r--src/test/ui/async-await/issues/issue-62009-1.stderr25
-rw-r--r--src/test/ui/async-await/issues/issue-62009-2.stderr4
-rw-r--r--src/test/ui/async-await/issues/non-async-enclosing-span.stderr4
-rw-r--r--src/test/ui/async-await/suggest-missing-await.stderr8
-rw-r--r--src/test/ui/async-await/unnecessary-await.stderr2
-rw-r--r--src/test/ui/issues/issue-33941.stderr14
-rw-r--r--src/tools/clippy/clippy_lints/src/needless_late_init.rs11
-rw-r--r--src/tools/clippy/tests/ui/needless_late_init_fixable.fixed38
-rw-r--r--src/tools/clippy/tests/ui/needless_late_init_fixable.rs2
-rw-r--r--src/tools/clippy/tests/ui/needless_late_init_fixable.stderr26
21 files changed, 136 insertions, 184 deletions
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 16fdd714575..75a45a437e7 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -130,7 +130,15 @@ impl<'hir> LoweringContext<'_, 'hir> {
                         hir::AsyncGeneratorKind::Block,
                         |this| this.with_new_scopes(|this| this.lower_block_expr(block)),
                     ),
-                ExprKind::Await(ref expr) => self.lower_expr_await(e.span, expr),
+                ExprKind::Await(ref expr) => {
+                    let span = if expr.span.hi() < e.span.hi() {
+                        expr.span.shrink_to_hi().with_hi(e.span.hi())
+                    } else {
+                        // this is a recovered `await expr`
+                        e.span
+                    };
+                    self.lower_expr_await(span, expr)
+                }
                 ExprKind::Closure(
                     capture_clause,
                     asyncness,
@@ -639,6 +647,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
             self.allow_gen_future.clone(),
         );
         let expr = self.lower_expr_mut(expr);
+        let expr_hir_id = expr.hir_id;
 
         let pinned_ident = Ident::with_dummy_span(sym::pinned);
         let (pinned_pat, pinned_pat_hid) =
@@ -665,19 +674,19 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 span,
                 hir::LangItem::PinNewUnchecked,
                 arena_vec![self; ref_mut_pinned],
-                Some(expr.hir_id),
+                Some(expr_hir_id),
             );
             let get_context = self.expr_call_lang_item_fn_mut(
                 gen_future_span,
                 hir::LangItem::GetContext,
                 arena_vec![self; task_context],
-                Some(expr.hir_id),
+                Some(expr_hir_id),
             );
             let call = self.expr_call_lang_item_fn(
                 span,
                 hir::LangItem::FuturePoll,
                 arena_vec![self; new_unchecked, get_context],
-                Some(expr.hir_id),
+                Some(expr_hir_id),
             );
             self.arena.alloc(self.expr_unsafe(call))
         };
@@ -694,7 +703,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 span,
                 hir::LangItem::PollReady,
                 ready_field,
-                Some(expr.hir_id),
+                Some(expr_hir_id),
             );
             let break_x = self.with_loop_scope(loop_node_id, move |this| {
                 let expr_break =
@@ -710,7 +719,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
                 span,
                 hir::LangItem::PollPending,
                 &[],
-                Some(expr.hir_id),
+                Some(expr_hir_id),
             );
             let empty_block = self.expr_block_empty(span);
             self.arm(pending_pat, empty_block)
@@ -731,7 +740,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
             let unit = self.expr_unit(span);
             let yield_expr = self.expr(
                 span,
-                hir::ExprKind::Yield(unit, hir::YieldSource::Await { expr: Some(expr.hir_id) }),
+                hir::ExprKind::Yield(unit, hir::YieldSource::Await { expr: Some(expr_hir_id) }),
                 ThinVec::new(),
             );
             let yield_expr = self.arena.alloc(yield_expr);
@@ -778,6 +787,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
             into_future_span,
             hir::LangItem::IntoFutureIntoFuture,
             arena_vec![self; expr],
+            Some(expr_hir_id),
         );
 
         // match <into_future_expr> {
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index babeafff820..0f8c0e1b8cf 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1153,7 +1153,7 @@ impl<'a> Parser<'a> {
     /// Assuming we have just parsed `.`, continue parsing into an expression.
     fn parse_dot_suffix(&mut self, self_arg: P<Expr>, lo: Span) -> PResult<'a, P<Expr>> {
         if self.token.uninterpolated_span().rust_2018() && self.eat_keyword(kw::Await) {
-            return Ok(self.mk_await_expr(self_arg));
+            return Ok(self.mk_await_expr(self_arg, lo));
         }
 
         let fn_span_lo = self.token.span;
@@ -2838,8 +2838,8 @@ impl<'a> Parser<'a> {
         ExprKind::Call(f, args)
     }
 
-    fn mk_await_expr(&mut self, self_arg: P<Expr>) -> P<Expr> {
-        let span = self.prev_token.span;
+    fn mk_await_expr(&mut self, self_arg: P<Expr>, lo: Span) -> P<Expr> {
+        let span = lo.to(self.prev_token.span);
         let await_expr = self.mk_expr(span, ExprKind::Await(self_arg), AttrVec::new());
         self.recover_from_await_method_call();
         await_expr
diff --git a/compiler/rustc_passes/src/region.rs b/compiler/rustc_passes/src/region.rs
index ae423070392..8968c163987 100644
--- a/compiler/rustc_passes/src/region.rs
+++ b/compiler/rustc_passes/src/region.rs
@@ -421,11 +421,14 @@ fn resolve_expr<'tcx>(visitor: &mut RegionResolutionVisitor<'tcx>, expr: &'tcx h
         // Mark this expr's scope and all parent scopes as containing `yield`.
         let mut scope = Scope { id: expr.hir_id.local_id, data: ScopeData::Node };
         loop {
-            let data = YieldData {
-                span: expr.span,
-                expr_and_pat_count: visitor.expr_and_pat_count,
-                source: *source,
+            let span = match expr.kind {
+                hir::ExprKind::Yield(expr, hir::YieldSource::Await { .. }) => {
+                    expr.span.shrink_to_hi().to(expr.span)
+                }
+                _ => expr.span,
             };
+            let data =
+                YieldData { span, expr_and_pat_count: visitor.expr_and_pat_count, source: *source };
             visitor.scope_tree.yield_in_scope.insert(scope, data);
             if visitor.pessimistic_yield {
                 debug!("resolve_expr in pessimistic_yield - marking scope {:?} for fixup", scope);
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index ede8511d815..67088ec83fa 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -886,46 +886,48 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
     ) {
         let span = obligation.cause.span;
 
-        if let ObligationCauseCode::AwaitableExpr(hir_id) = obligation.cause.code {
-            // FIXME: use `obligation.predicate.kind()...trait_ref.self_ty()` to see if we have `()`
-            // and if not maybe suggest doing something else? If we kept the expression around we
-            // could also check if it is an fn call (very likely) and suggest changing *that*, if
-            // it is from the local crate.
-            err.span_suggestion_verbose(
-                span,
-                "do not `.await` the expression",
-                String::new(),
-                Applicability::MachineApplicable,
-            );
-            // FIXME: account for associated `async fn`s.
+        if let ObligationCauseCode::AwaitableExpr(hir_id) = obligation.cause.code.peel_derives() {
             let hir = self.tcx.hir();
             if let Some(node) = hir_id.and_then(|hir_id| hir.find(hir_id)) {
-                if let hir::Node::Expr(hir::Expr {
-                    span, kind: hir::ExprKind::Call(base, _), ..
-                }) = node
-                {
-                    if let ty::PredicateKind::Trait(pred) =
-                        obligation.predicate.kind().skip_binder()
-                    {
-                        err.span_label(*span, &format!("this call returns `{}`", pred.self_ty()));
-                    }
-                    if let Some(typeck_results) =
-                        self.in_progress_typeck_results.map(|t| t.borrow())
-                    {
-                        let ty = typeck_results.expr_ty_adjusted(base);
-                        if let ty::FnDef(def_id, _substs) = ty.kind() {
-                            if let Some(hir::Node::Item(hir::Item { span, ident, .. })) =
-                                hir.get_if_local(*def_id)
-                            {
-                                err.span_suggestion_verbose(
-                                    span.shrink_to_lo(),
-                                    &format!(
-                                        "alternatively, consider making `fn {}` asynchronous",
-                                        ident
-                                    ),
-                                    "async ".to_string(),
-                                    Applicability::MaybeIncorrect,
-                                );
+                if let hir::Node::Expr(expr) = node {
+                    // FIXME: use `obligation.predicate.kind()...trait_ref.self_ty()` to see if we have `()`
+                    // and if not maybe suggest doing something else? If we kept the expression around we
+                    // could also check if it is an fn call (very likely) and suggest changing *that*, if
+                    // it is from the local crate.
+                    err.span_suggestion_verbose(
+                        expr.span.shrink_to_hi().with_hi(span.hi()),
+                        "do not `.await` the expression",
+                        String::new(),
+                        Applicability::MachineApplicable,
+                    );
+                    // FIXME: account for associated `async fn`s.
+                    if let hir::Expr { span, kind: hir::ExprKind::Call(base, _), .. } = expr {
+                        if let ty::PredicateKind::Trait(pred) =
+                            obligation.predicate.kind().skip_binder()
+                        {
+                            err.span_label(
+                                *span,
+                                &format!("this call returns `{}`", pred.self_ty()),
+                            );
+                        }
+                        if let Some(typeck_results) =
+                            self.in_progress_typeck_results.map(|t| t.borrow())
+                        {
+                            let ty = typeck_results.expr_ty_adjusted(base);
+                            if let ty::FnDef(def_id, _substs) = ty.kind() {
+                                if let Some(hir::Node::Item(hir::Item { span, ident, .. })) =
+                                    hir.get_if_local(*def_id)
+                                {
+                                    err.span_suggestion_verbose(
+                                        span.shrink_to_lo(),
+                                        &format!(
+                                            "alternatively, consider making `fn {}` asynchronous",
+                                            ident
+                                        ),
+                                        "async ".to_string(),
+                                        Applicability::MaybeIncorrect,
+                                    );
+                                }
                             }
                         }
                     }
diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
index ab2d5286907..738af9bfb8c 100644
--- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
+++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
@@ -810,7 +810,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             def_id,
             &substs,
             match lang_item {
-                hir::LangItem::FuturePoll => ObligationCauseCode::AwaitableExpr(expr_hir_id),
+                hir::LangItem::IntoFutureIntoFuture => {
+                    ObligationCauseCode::AwaitableExpr(expr_hir_id)
+                }
                 hir::LangItem::IteratorNext | hir::LangItem::IntoIterIntoIter => {
                     ObligationCauseCode::ForLoopIterator
                 }
diff --git a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
index 27f4b0dac61..b4323c314ba 100644
--- a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
+++ b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
@@ -162,68 +162,68 @@ LL |     let _ = (await bar())?;
    |              ^^^^^^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:71:19
+  --> $DIR/incorrect-syntax-suggestions.rs:71:18
    |
 LL | fn foo13() -> Result<(), ()> {
    |    ----- this is not `async`
 LL |     let _ = bar().await();
-   |                   ^^^^^ only allowed inside `async` functions and blocks
+   |                  ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:76:19
+  --> $DIR/incorrect-syntax-suggestions.rs:76:18
    |
 LL | fn foo14() -> Result<(), ()> {
    |    ----- this is not `async`
 LL |     let _ = bar().await()?;
-   |                   ^^^^^ only allowed inside `async` functions and blocks
+   |                  ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:81:19
+  --> $DIR/incorrect-syntax-suggestions.rs:81:18
    |
 LL | fn foo15() -> Result<(), ()> {
    |    ----- this is not `async`
 LL |     let _ = bar().await;
-   |                   ^^^^^ only allowed inside `async` functions and blocks
+   |                  ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:85:19
+  --> $DIR/incorrect-syntax-suggestions.rs:85:18
    |
 LL | fn foo16() -> Result<(), ()> {
    |    ----- this is not `async`
 LL |     let _ = bar().await?;
-   |                   ^^^^^ only allowed inside `async` functions and blocks
+   |                  ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:90:23
+  --> $DIR/incorrect-syntax-suggestions.rs:90:22
    |
 LL |     fn foo() -> Result<(), ()> {
    |        --- this is not `async`
 LL |         let _ = bar().await?;
-   |                       ^^^^^ only allowed inside `async` functions and blocks
+   |                      ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:97:23
+  --> $DIR/incorrect-syntax-suggestions.rs:97:22
    |
 LL |     let foo = || {
    |               -- this is not `async`
 LL |         let _ = bar().await?;
-   |                       ^^^^^ only allowed inside `async` functions and blocks
+   |                      ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:113:17
+  --> $DIR/incorrect-syntax-suggestions.rs:113:29
    |
 LL |     fn foo() -> Result<(), ()> {
    |        --- this is not `async`
 LL |         let _ = await!(bar())?;
-   |                 ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
+   |                             ^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/incorrect-syntax-suggestions.rs:121:17
+  --> $DIR/incorrect-syntax-suggestions.rs:121:29
    |
 LL |     let foo = || {
    |               -- this is not `async`
 LL |         let _ = await!(bar())?;
-   |                 ^^^^^^^^^^^^^ only allowed inside `async` functions and blocks
+   |                             ^ only allowed inside `async` functions and blocks
 
 error: aborting due to 33 previous errors
 
diff --git a/src/test/ui/async-await/issue-70594.rs b/src/test/ui/async-await/issue-70594.rs
index bfed4b0b05c..9e7c5847b3b 100644
--- a/src/test/ui/async-await/issue-70594.rs
+++ b/src/test/ui/async-await/issue-70594.rs
@@ -6,7 +6,6 @@ async fn fun() {
     //~| error: `.await` is not allowed in a `const`
     //~| error: `.await` is not allowed in a `const`
     //~| error: `()` is not a future
-    //~| error: `()` is not a future
 }
 
 fn main() {}
diff --git a/src/test/ui/async-await/issue-70594.stderr b/src/test/ui/async-await/issue-70594.stderr
index a2d4257577e..40570928682 100644
--- a/src/test/ui/async-await/issue-70594.stderr
+++ b/src/test/ui/async-await/issue-70594.stderr
@@ -1,16 +1,16 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-70594.rs:4:12
+  --> $DIR/issue-70594.rs:4:11
    |
 LL | async fn fun() {
    |          --- this is not `async`
 LL |     [1; ().await];
-   |            ^^^^^ only allowed inside `async` functions and blocks
+   |           ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0744]: `.await` is not allowed in a `const`
-  --> $DIR/issue-70594.rs:4:12
+  --> $DIR/issue-70594.rs:4:9
    |
 LL |     [1; ().await];
-   |            ^^^^^
+   |         ^^^^^^^^
 
 error[E0744]: `.await` is not allowed in a `const`
   --> $DIR/issue-70594.rs:4:11
@@ -19,16 +19,6 @@ LL |     [1; ().await];
    |           ^^^^^^
 
 error[E0277]: `()` is not a future
-  --> $DIR/issue-70594.rs:4:12
-   |
-LL |     [1; ().await];
-   |            ^^^^^ `()` is not a future
-   |
-   = help: the trait `Future` is not implemented for `()`
-   = note: () must be a future or must implement `IntoFuture` to be awaited
-   = note: required because of the requirements on the impl of `IntoFuture` for `()`
-
-error[E0277]: `()` is not a future
   --> $DIR/issue-70594.rs:4:11
    |
 LL |     [1; ().await];
@@ -36,13 +26,14 @@ LL |     [1; ().await];
    |
    = help: the trait `Future` is not implemented for `()`
    = note: () must be a future or must implement `IntoFuture` to be awaited
+   = note: required because of the requirements on the impl of `IntoFuture` for `()`
 help: do not `.await` the expression
    |
 LL -     [1; ().await];
 LL +     [1; ()];
    | 
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0277, E0728, E0744.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/async-await/issues/issue-51719.stderr b/src/test/ui/async-await/issues/issue-51719.stderr
index 19cc339ec0a..f3ce5d1c897 100644
--- a/src/test/ui/async-await/issues/issue-51719.stderr
+++ b/src/test/ui/async-await/issues/issue-51719.stderr
@@ -1,8 +1,8 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-51719.rs:8:25
+  --> $DIR/issue-51719.rs:8:24
    |
 LL |     let _gen = || foo().await;
-   |                --       ^^^^^ only allowed inside `async` functions and blocks
+   |                --      ^^^^^^ only allowed inside `async` functions and blocks
    |                |
    |                this is not `async`
 
diff --git a/src/test/ui/async-await/issues/issue-51751.stderr b/src/test/ui/async-await/issues/issue-51751.stderr
index 6dd3726608b..8696a5b798b 100644
--- a/src/test/ui/async-await/issues/issue-51751.stderr
+++ b/src/test/ui/async-await/issues/issue-51751.stderr
@@ -1,11 +1,11 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-51751.rs:9:27
+  --> $DIR/issue-51751.rs:9:26
    |
 LL | fn main() {
    |    ---- this is not `async`
 LL |     let result = inc(10000);
 LL |     let finished = result.await;
-   |                           ^^^^^ only allowed inside `async` functions and blocks
+   |                          ^^^^^^ only allowed inside `async` functions and blocks
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/async-await/issues/issue-62009-1.rs b/src/test/ui/async-await/issues/issue-62009-1.rs
index 71108b4e1d8..40ccf25712e 100644
--- a/src/test/ui/async-await/issues/issue-62009-1.rs
+++ b/src/test/ui/async-await/issues/issue-62009-1.rs
@@ -12,5 +12,4 @@ fn main() {
     (|_| 2333).await;
     //~^ ERROR `await` is only allowed inside `async` functions and blocks
     //~| ERROR is not a future
-    //~| ERROR is not a future
 }
diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr
index c09903e48c6..3ea5dac76d4 100644
--- a/src/test/ui/async-await/issues/issue-62009-1.stderr
+++ b/src/test/ui/async-await/issues/issue-62009-1.stderr
@@ -1,38 +1,28 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-62009-1.rs:6:23
+  --> $DIR/issue-62009-1.rs:6:22
    |
 LL | fn main() {
    |    ---- this is not `async`
 LL |     async { let (); }.await;
-   |                       ^^^^^ only allowed inside `async` functions and blocks
+   |                      ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-62009-1.rs:10:7
+  --> $DIR/issue-62009-1.rs:10:6
    |
 LL | fn main() {
    |    ---- this is not `async`
 ...
 LL |     }.await;
-   |       ^^^^^ only allowed inside `async` functions and blocks
+   |      ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-62009-1.rs:12:16
+  --> $DIR/issue-62009-1.rs:12:15
    |
 LL | fn main() {
    |    ---- this is not `async`
 ...
 LL |     (|_| 2333).await;
-   |                ^^^^^ only allowed inside `async` functions and blocks
-
-error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
-  --> $DIR/issue-62009-1.rs:12:16
-   |
-LL |     (|_| 2333).await;
-   |                ^^^^^ `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
-   |
-   = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
-   = note: [closure@$DIR/issue-62009-1.rs:12:5: 12:15] must be a future or must implement `IntoFuture` to be awaited
-   = note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
+   |               ^^^^^^ only allowed inside `async` functions and blocks
 
 error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]` is not a future
   --> $DIR/issue-62009-1.rs:12:15
@@ -42,13 +32,14 @@ LL |     (|_| 2333).await;
    |
    = help: the trait `Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
    = note: [closure@$DIR/issue-62009-1.rs:12:5: 12:15] must be a future or must implement `IntoFuture` to be awaited
+   = note: required because of the requirements on the impl of `IntoFuture` for `[closure@$DIR/issue-62009-1.rs:12:5: 12:15]`
 help: do not `.await` the expression
    |
 LL -     (|_| 2333).await;
 LL +     (|_| 2333);
    | 
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
 Some errors have detailed explanations: E0277, E0728.
 For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/async-await/issues/issue-62009-2.stderr b/src/test/ui/async-await/issues/issue-62009-2.stderr
index 9c2f20df657..92e9a8a69a8 100644
--- a/src/test/ui/async-await/issues/issue-62009-2.stderr
+++ b/src/test/ui/async-await/issues/issue-62009-2.stderr
@@ -1,10 +1,10 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/issue-62009-2.rs:8:23
+  --> $DIR/issue-62009-2.rs:8:22
    |
 LL | fn main() {
    |    ---- this is not `async`
 LL |     (async || 2333)().await;
-   |                       ^^^^^ only allowed inside `async` functions and blocks
+   |                      ^^^^^^ only allowed inside `async` functions and blocks
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/async-await/issues/non-async-enclosing-span.stderr b/src/test/ui/async-await/issues/non-async-enclosing-span.stderr
index b6583022c16..20b827479fa 100644
--- a/src/test/ui/async-await/issues/non-async-enclosing-span.stderr
+++ b/src/test/ui/async-await/issues/non-async-enclosing-span.stderr
@@ -1,11 +1,11 @@
 error[E0728]: `await` is only allowed inside `async` functions and blocks
-  --> $DIR/non-async-enclosing-span.rs:9:28
+  --> $DIR/non-async-enclosing-span.rs:9:27
    |
 LL | fn main() {
    |    ---- this is not `async`
 LL |     let x = move || {};
 LL |     let y = do_the_thing().await;
-   |                            ^^^^^ only allowed inside `async` functions and blocks
+   |                           ^^^^^^ only allowed inside `async` functions and blocks
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr
index a812840d40b..3cca9616a35 100644
--- a/src/test/ui/async-await/suggest-missing-await.stderr
+++ b/src/test/ui/async-await/suggest-missing-await.stderr
@@ -39,7 +39,7 @@ LL |     dummy();
    |            +
 
 error[E0308]: `if` and `else` have incompatible types
-  --> $DIR/suggest-missing-await.rs:35:17
+  --> $DIR/suggest-missing-await.rs:35:9
    |
 LL |       let _x = if true {
    |  ______________-
@@ -48,7 +48,7 @@ LL | |         dummy()
 LL | |
 LL | |     } else {
 LL | |         dummy().await
-   | |                 ^^^^^ expected opaque type, found `()`
+   | |         ^^^^^^^^^^^^^ expected opaque type, found `()`
 LL | |
 LL | |     };
    | |_____- `if` and `else` have incompatible types
@@ -61,7 +61,7 @@ LL |         dummy().await
    |                ++++++
 
 error[E0308]: `match` arms have incompatible types
-  --> $DIR/suggest-missing-await.rs:45:22
+  --> $DIR/suggest-missing-await.rs:45:14
    |
 LL |       let _x = match 0usize {
    |  ______________-
@@ -70,7 +70,7 @@ LL | |         0 => dummy(),
 LL | |         1 => dummy(),
    | |              ------- this is found to be of type `impl Future<Output = ()>`
 LL | |         2 => dummy().await,
-   | |                      ^^^^^ expected opaque type, found `()`
+   | |              ^^^^^^^^^^^^^ expected opaque type, found `()`
 LL | |
 LL | |     };
    | |_____- `match` arms have incompatible types
diff --git a/src/test/ui/async-await/unnecessary-await.stderr b/src/test/ui/async-await/unnecessary-await.stderr
index 4caa15e67b7..fc22ebc5972 100644
--- a/src/test/ui/async-await/unnecessary-await.stderr
+++ b/src/test/ui/async-await/unnecessary-await.stderr
@@ -7,6 +7,8 @@ LL |     boo().await;
    |     this call returns `()`
    |
    = help: the trait `Future` is not implemented for `()`
+   = note: () must be a future or must implement `IntoFuture` to be awaited
+   = note: required because of the requirements on the impl of `IntoFuture` for `()`
 help: do not `.await` the expression
    |
 LL -     boo().await;
diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr
index 52341517756..c6650d60c21 100644
--- a/src/test/ui/issues/issue-33941.stderr
+++ b/src/test/ui/issues/issue-33941.stderr
@@ -23,20 +23,6 @@ LL |     for _ in HashMap::new().iter().cloned() {}
    = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
    = note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
 
-<<<<<<< HEAD
 error: aborting due to 2 previous errors
-=======
-error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as Iterator>::Item == &_`
-  --> $DIR/issue-33941.rs:4:14
-   |
-LL |     for _ in HashMap::new().iter().cloned() {}
-   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference
-   |
-   = note:  expected tuple `(&_, &_)`
-           found reference `&_`
-   = note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
-
-error: aborting due to 3 previous errors
->>>>>>> 330b90f5fc1 (Remove yet more output from `for`-loop and `?` errors)
 
 For more information about this error, try `rustc --explain E0271`.
diff --git a/src/tools/clippy/clippy_lints/src/needless_late_init.rs b/src/tools/clippy/clippy_lints/src/needless_late_init.rs
index e0522f3fe0b..5b098659377 100644
--- a/src/tools/clippy/clippy_lints/src/needless_late_init.rs
+++ b/src/tools/clippy/clippy_lints/src/needless_late_init.rs
@@ -73,7 +73,7 @@ fn contains_assign_expr<'tcx>(cx: &LateContext<'tcx>, stmt: &'tcx Stmt<'tcx>) ->
     seen
 }
 
-#[derive(Debug)]
+#[derive(Debug, Clone)]
 struct LocalAssign {
     lhs_id: HirId,
     lhs_span: Span,
@@ -154,9 +154,14 @@ fn assignment_suggestions<'tcx>(
         assignments.push(assign);
     }
 
-    let suggestions = assignments
+    let suggestions = assignments.clone()
         .into_iter()
-        .map(|assignment| Some((assignment.span, snippet_opt(cx, assignment.rhs_span)?)))
+        .map(|assignment| Some((assignment.span.until(assignment.rhs_span), String::new())))
+        .chain(
+            assignments
+                .into_iter()
+                .map(|assignment| Some((assignment.rhs_span.shrink_to_hi().with_hi(assignment.span.hi()), String::new())))
+        )
         .collect::<Option<Vec<(Span, String)>>>()?;
 
     let applicability = if suggestions.len() > 1 {
diff --git a/src/tools/clippy/tests/ui/needless_late_init_fixable.fixed b/src/tools/clippy/tests/ui/needless_late_init_fixable.fixed
deleted file mode 100644
index 32d5d04fde4..00000000000
--- a/src/tools/clippy/tests/ui/needless_late_init_fixable.fixed
+++ /dev/null
@@ -1,38 +0,0 @@
-// run-rustfix
-
-#![allow(unused, clippy::assign_op_pattern)]
-
-fn main() {
-    
-    let a = "zero";
-
-    
-    
-    let b = 1;
-    let c = 2;
-
-    
-    let d: usize = 1;
-
-    
-    let mut e = 1;
-    e = 2;
-
-    
-    let f = match 1 {
-        1 => "three",
-        _ => return,
-    }; // has semi
-
-    
-    let g: usize = if true {
-        5
-    } else {
-        panic!();
-    };
-
-    
-    let h = format!("{}", e);
-
-    println!("{}", a);
-}
diff --git a/src/tools/clippy/tests/ui/needless_late_init_fixable.rs b/src/tools/clippy/tests/ui/needless_late_init_fixable.rs
index 6bc85f68632..76099df0e06 100644
--- a/src/tools/clippy/tests/ui/needless_late_init_fixable.rs
+++ b/src/tools/clippy/tests/ui/needless_late_init_fixable.rs
@@ -1,5 +1,3 @@
-// run-rustfix
-
 #![allow(unused, clippy::assign_op_pattern)]
 
 fn main() {
diff --git a/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr b/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr
index a0ce4f812f4..728e19252ea 100644
--- a/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr
+++ b/src/tools/clippy/tests/ui/needless_late_init_fixable.stderr
@@ -1,5 +1,5 @@
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:6:5
+  --> $DIR/needless_late_init_fixable.rs:4:5
    |
 LL |     let a;
    |     ^^^^^^
@@ -11,7 +11,7 @@ LL |     let a = "zero";
    |     ~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:9:5
+  --> $DIR/needless_late_init_fixable.rs:7:5
    |
 LL |     let b;
    |     ^^^^^^
@@ -22,7 +22,7 @@ LL |     let b = 1;
    |     ~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:10:5
+  --> $DIR/needless_late_init_fixable.rs:8:5
    |
 LL |     let c;
    |     ^^^^^^
@@ -33,7 +33,7 @@ LL |     let c = 2;
    |     ~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:14:5
+  --> $DIR/needless_late_init_fixable.rs:12:5
    |
 LL |     let d: usize;
    |     ^^^^^^^^^^^^^
@@ -44,7 +44,7 @@ LL |     let d: usize = 1;
    |     ~~~~~~~~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:17:5
+  --> $DIR/needless_late_init_fixable.rs:15:5
    |
 LL |     let mut e;
    |     ^^^^^^^^^^
@@ -55,7 +55,7 @@ LL |     let mut e = 1;
    |     ~~~~~~~~~
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:21:5
+  --> $DIR/needless_late_init_fixable.rs:19:5
    |
 LL |     let f;
    |     ^^^^^^
@@ -66,11 +66,12 @@ LL |     let f = match 1 {
    |     +++++++
 help: remove the assignments from the `match` arms
    |
-LL |         1 => "three",
-   |              ~~~~~~~
+LL -         1 => f = "three",
+LL +         1 => "three",
+   | 
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:27:5
+  --> $DIR/needless_late_init_fixable.rs:25:5
    |
 LL |     let g: usize;
    |     ^^^^^^^^^^^^^
@@ -81,15 +82,16 @@ LL |     let g: usize = if true {
    |     ++++++++++++++
 help: remove the assignments from the branches
    |
-LL |         5
-   |
+LL -         g = 5;
+LL +         5
+   | 
 help: add a semicolon after the `if` expression
    |
 LL |     };
    |      +
 
 error: unneeded late initalization
-  --> $DIR/needless_late_init_fixable.rs:34:5
+  --> $DIR/needless_late_init_fixable.rs:32:5
    |
 LL |     let h;
    |     ^^^^^^