- err.span_note(
- span,
- &format!(
- "{} {} as this value is used across {}",
- future_or_generator, trait_explanation, an_await_or_yield
- ),
- );
+ // If available, use the scope span to annotate the drop location.
+ if let Some(scope_span) = scope_span {
+ span.push_span_label(
+ source_map.end_point(*scope_span),
+ format!("`{}` is later dropped here", snippet),
+ );
+ }
+
+ err.span_note(
+ span,
+ &format!(
+ "{} {} as this value is used across {}",
+ future_or_generator, trait_explanation, an_await_or_yield
+ ),
+ );
+ }