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 e45794ebc42..12f9851196c 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs @@ -2212,17 +2212,11 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { interior_span, format!("has type `{}` which {}", target_ty, trait_explanation), ); - // If available, use the scope span to annotate the drop location. - let mut scope_note = None; if let Some(scope_span) = scope_span { let scope_span = source_map.end_point(scope_span); let msg = format!("{} is later dropped here", snippet); - if source_map.is_multiline(yield_span.between(scope_span)) { - span.push_span_label(scope_span, msg); - } else { - scope_note = Some((scope_span, msg)); - } + span.push_span_label(scope_span, msg); } err.span_note( span, @@ -2231,9 +2225,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> { future_or_generator, trait_explanation, an_await_or_yield ), ); - if let Some((span, msg)) = scope_note { - err.span_note(span, &msg); - } }; match interior_or_upvar_span { GeneratorInteriorOrUpvar::Interior(interior_span, interior_extra_info) => { diff --git a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr index 616623ee077..f0f5245a3b4 100644 --- a/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr +++ b/src/test/ui/async-await/async-await-let-else.drop-tracking.stderr @@ -68,14 +68,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:28 | LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | + | ----------- ^^^^^^ - `Rc::new(())` is later dropped here + | | | + | | await occurs here, with `Rc::new(())` maybe used later | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:33:35 - | -LL | (Rc::new(()), bar().await); - | ^ note: required by a bound in `is_send` --> $DIR/async-await-let-else.rs:19:15 | diff --git a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr index 7f93563e288..d3c5e80a30d 100644 --- a/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr +++ b/src/test/ui/async-await/async-await-let-else.no-drop-tracking.stderr @@ -53,14 +53,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/async-await-let-else.rs:33:28 | LL | (Rc::new(()), bar().await); - | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later - | | + | ----------- ^^^^^^ - `Rc::new(())` is later dropped here + | | | + | | await occurs here, with `Rc::new(())` maybe used later | has type `Rc<()>` which is not `Send` -note: `Rc::new(())` is later dropped here - --> $DIR/async-await-let-else.rs:33:35 - | -LL | (Rc::new(()), bar().await); - | ^ note: required by a bound in `is_send` --> $DIR/async-await-let-else.rs:19:15 | diff --git a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr index 34b31198e4f..8036d82daa4 100644 --- a/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr @@ -12,14 +12,10 @@ LL | baz(|| async{ | _____________- LL | | foo(tx.clone()); LL | | }).await; - | | - ^^^^^^ await occurs here, with the value maybe used later - | |_________| + | | - ^^^^^^- the value is later dropped here + | | | | + | |_________| await occurs here, with the value maybe used later | has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send` -note: the value is later dropped here - --> $DIR/issue-70935-complex-spans.rs:19:17 - | -LL | }).await; - | ^ error: aborting due to previous error diff --git a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr index ab196dca20c..1033fa6cc8b 100644 --- a/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr +++ b/src/test/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr @@ -13,14 +13,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/issue-65436-raw-ptr-not-send.rs:18:35 | LL | bar(Foo(std::ptr::null())).await; - | ---------------- ^^^^^^ await occurs here, with `std::ptr::null()` maybe used later - | | + | ---------------- ^^^^^^- `std::ptr::null()` is later dropped here + | | | + | | await occurs here, with `std::ptr::null()` maybe used later | has type `*const u8` which is not `Send` -note: `std::ptr::null()` is later dropped here - --> $DIR/issue-65436-raw-ptr-not-send.rs:18:41 - | -LL | bar(Foo(std::ptr::null())).await; - | ^ help: consider moving this into a `let` binding to create a shorter lived borrow --> $DIR/issue-65436-raw-ptr-not-send.rs:18:13 | diff --git a/src/test/ui/async-await/issues/issue-67893.stderr b/src/test/ui/async-await/issues/issue-67893.stderr index 316b6d06f93..2ce68a78291 100644 --- a/src/test/ui/async-await/issues/issue-67893.stderr +++ b/src/test/ui/async-await/issues/issue-67893.stderr @@ -9,14 +9,10 @@ note: future is not `Send` as this value is used across an await --> $DIR/auxiliary/issue_67893.rs:9:26 | LL | f(*x.lock().unwrap()).await; - | ----------------- ^^^^^^ await occurs here, with `x.lock().unwrap()` maybe used later - | | + | ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here + | | | + | | await occurs here, with `x.lock().unwrap()` maybe used later | has type `MutexGuard<'_, ()>` which is not `Send` -note: `x.lock().unwrap()` is later dropped here - --> $DIR/auxiliary/issue_67893.rs:9:32 - | -LL | f(*x.lock().unwrap()).await; - | ^ note: required by a bound in `g` --> $DIR/issue-67893.rs:6:14 |