summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2023-05-01 01:09:47 +0200
committerGitHub <noreply@github.com>2023-05-01 01:09:47 +0200
commit1b262b8b5660bc70530f647822b477a8d56e1f4e (patch)
tree41299c6d6c037d6b6addf13a984f9220fba45cd0
parent9ecda8de85ce893cc3fc748ab06be0b8250147a7 (diff)
parent6d6c90443182e18fb23c08cd2d97dae701d7b453 (diff)
downloadrust-1b262b8b5660bc70530f647822b477a8d56e1f4e.tar.gz
Rollup merge of #110823 - compiler-errors:tweak-await-span, r=b-naber
Tweak await span to not contain dot Fixes a discrepancy between method calls and await expressions where the latter are desugared to have a span that *contains* the dot (i.e. `.await`) but method call identifiers don't contain the dot. This leads to weird suggestions suggestions in borrowck -- see linked issue. Fixes #110761 This mostly touches a bunch of tests to tighten their `await` span.
-rw-r--r--compiler/rustc_ast/src/ast.rs4
-rw-r--r--compiler/rustc_ast/src/mut_visit.rs5
-rw-r--r--compiler/rustc_ast/src/util/parser.rs2
-rw-r--r--compiler/rustc_ast/src/visit.rs2
-rw-r--r--compiler/rustc_ast_lowering/src/errors.rs2
-rw-r--r--compiler/rustc_ast_lowering/src/expr.rs24
-rw-r--r--compiler/rustc_ast_lowering/src/format.rs2
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/expr.rs2
-rw-r--r--compiler/rustc_borrowck/messages.ftl9
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/mod.rs21
-rw-r--r--compiler/rustc_borrowck/src/session_diagnostics.rs8
-rw-r--r--compiler/rustc_builtin_macros/src/assert/context.rs2
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/ops.rs3
-rw-r--r--compiler/rustc_middle/src/util/call_kind.rs5
-rw-r--r--compiler/rustc_parse/src/parser/diagnostics.rs2
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs4
-rw-r--r--compiler/rustc_span/src/symbol.rs1
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs95
-rw-r--r--library/core/src/future/into_future.rs1
-rw-r--r--src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs2
-rw-r--r--src/tools/clippy/clippy_utils/src/ast_utils.rs2
-rw-r--r--src/tools/clippy/tests/ui/future_not_send.stderr24
-rw-r--r--src/tools/rustfmt/src/chains.rs4
-rw-r--r--src/tools/rustfmt/src/expr.rs4
-rw-r--r--tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir178
-rw-r--r--tests/ui/async-await/async-await-let-else.drop_tracking.stderr16
-rw-r--r--tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr12
-rw-r--r--tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr20
-rw-r--r--tests/ui/async-await/async-error-span.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/async-error-span.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr8
-rw-r--r--tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr8
-rw-r--r--tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr20
-rw-r--r--tests/ui/async-await/async-fn-nonsend.stderr49
-rw-r--r--tests/ui/async-await/async-is-unwindsafe.stderr4
-rw-r--r--tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr38
-rw-r--r--tests/ui/async-await/clone-suggestion.fixed28
-rw-r--r--tests/ui/async-await/clone-suggestion.rs28
-rw-r--r--tests/ui/async-await/clone-suggestion.stderr20
-rw-r--r--tests/ui/async-await/drop-track-bad-field-in-fru.stderr8
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-101715.stderr8
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-1-sync.stderr24
-rw-r--r--tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-2-send.stderr24
-rw-r--r--tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-3-other.stderr27
-rw-r--r--tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-64130-non-send-future-diags.stderr4
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr4
-rw-r--r--tests/ui/async-await/issue-70594.stderr16
-rw-r--r--tests/ui/async-await/issue-70818.stderr18
-rw-r--r--tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr8
-rw-r--r--tests/ui/async-await/issue-71137.stderr4
-rw-r--r--tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr11
-rw-r--r--tests/ui/async-await/issue-98634.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-107280.stderr20
-rw-r--r--tests/ui/async-await/issues/issue-51719.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-51751.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-62009-1.stderr20
-rw-r--r--tests/ui/async-await/issues/issue-62009-2.stderr4
-rw-r--r--tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr8
-rw-r--r--tests/ui/async-await/issues/issue-67893.stderr8
-rw-r--r--tests/ui/async-await/issues/non-async-enclosing-span.stderr4
-rw-r--r--tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr21
-rw-r--r--tests/ui/async-await/recursive-async-impl-trait-type.stderr12
-rw-r--r--tests/ui/async-await/unnecessary-await.rs20
-rw-r--r--tests/ui/async-await/unnecessary-await.stderr36
-rw-r--r--tests/ui/async-await/unresolved_type_param.drop_tracking.stderr12
-rw-r--r--tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr20
-rw-r--r--tests/ui/async-await/unresolved_type_param.stderr39
-rw-r--r--tests/ui/generator/borrowing.stderr31
-rw-r--r--tests/ui/generator/retain-resume-ref.stderr13
-rw-r--r--tests/ui/generator/unresolved-ct-var-drop-tracking.stderr28
-rw-r--r--tests/ui/generator/unresolved-ct-var.stderr28
-rw-r--r--tests/ui/lint/must_not_suspend/boxed.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr4
-rw-r--r--tests/ui/lint/must_not_suspend/dedup.stderr19
-rw-r--r--tests/ui/lint/must_not_suspend/mutex.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr4
-rw-r--r--tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr4
-rw-r--r--tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr4
-rw-r--r--tests/ui/lint/must_not_suspend/trait.stderr37
-rw-r--r--tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/unit.stderr26
-rw-r--r--tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr2
-rw-r--r--tests/ui/lint/must_not_suspend/warn.stderr26
-rw-r--r--tests/ui/suggestions/issue-96555.stderr12
-rw-r--r--tests/ui/traits/unsend-future.stderr4
113 files changed, 593 insertions, 806 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index 3ed342ce48b..ea04ba4f66e 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -1430,8 +1430,8 @@ pub enum ExprKind {
/// The async block used to have a `NodeId`, which was removed in favor of
/// using the parent `NodeId` of the parent `Expr`.
Async(CaptureBy, P<Block>),
- /// An await expression (`my_future.await`).
- Await(P<Expr>),
+ /// An await expression (`my_future.await`). Span is of await keyword.
+ Await(P<Expr>, Span),
/// A try block (`try { ... }`).
TryBlock(P<Block>),
diff --git a/compiler/rustc_ast/src/mut_visit.rs b/compiler/rustc_ast/src/mut_visit.rs
index 99f1f4bd968..68a4d522993 100644
--- a/compiler/rustc_ast/src/mut_visit.rs
+++ b/compiler/rustc_ast/src/mut_visit.rs
@@ -1415,7 +1415,10 @@ pub fn noop_visit_expr<T: MutVisitor>(
ExprKind::Async(_capture_by, body) => {
vis.visit_block(body);
}
- ExprKind::Await(expr) => vis.visit_expr(expr),
+ ExprKind::Await(expr, await_kw_span) => {
+ vis.visit_expr(expr);
+ vis.visit_span(await_kw_span);
+ }
ExprKind::Assign(el, er, _) => {
vis.visit_expr(el);
vis.visit_expr(er);
diff --git a/compiler/rustc_ast/src/util/parser.rs b/compiler/rustc_ast/src/util/parser.rs
index 24b4bd8623f..64ae904513c 100644
--- a/compiler/rustc_ast/src/util/parser.rs
+++ b/compiler/rustc_ast/src/util/parser.rs
@@ -388,7 +388,7 @@ pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
// X { y: 1 } + X { y: 2 }
contains_exterior_struct_lit(lhs) || contains_exterior_struct_lit(rhs)
}
- ast::ExprKind::Await(x)
+ ast::ExprKind::Await(x, _)
| ast::ExprKind::Unary(_, x)
| ast::ExprKind::Cast(x, _)
| ast::ExprKind::Type(x, _)
diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs
index 8a6b5d5c905..1526ffa0b03 100644
--- a/compiler/rustc_ast/src/visit.rs
+++ b/compiler/rustc_ast/src/visit.rs
@@ -864,7 +864,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
ExprKind::Async(_, body) => {
visitor.visit_block(body);
}
- ExprKind::Await(expr) => visitor.visit_expr(expr),
+ ExprKind::Await(expr, _) => visitor.visit_expr(expr),
ExprKind::Assign(lhs, rhs, _) => {
visitor.visit_expr(lhs);
visitor.visit_expr(rhs);
diff --git a/compiler/rustc_ast_lowering/src/errors.rs b/compiler/rustc_ast_lowering/src/errors.rs
index 3e9f9b43623..72dc52a6329 100644
--- a/compiler/rustc_ast_lowering/src/errors.rs
+++ b/compiler/rustc_ast_lowering/src/errors.rs
@@ -108,7 +108,7 @@ pub struct BaseExpressionDoubleDot {
pub struct AwaitOnlyInAsyncFnAndBlocks {
#[primary_span]
#[label]
- pub dot_await_span: Span,
+ pub await_kw_span: Span,
#[label(ast_lowering_this_not_async)]
pub item_span: Option<Span>,
}
diff --git a/compiler/rustc_ast_lowering/src/expr.rs b/compiler/rustc_ast_lowering/src/expr.rs
index 7a0a7da9695..5e0ab80c6ac 100644
--- a/compiler/rustc_ast_lowering/src/expr.rs
+++ b/compiler/rustc_ast_lowering/src/expr.rs
@@ -185,21 +185,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::AsyncGeneratorKind::Block,
|this| this.with_new_scopes(|this| this.lower_block_expr(block)),
),
- ExprKind::Await(expr) => {
- let dot_await_span = if expr.span.hi() < e.span.hi() {
- let span_with_whitespace = self
- .tcx
- .sess
- .source_map()
- .span_extend_while(expr.span, char::is_whitespace)
- .unwrap_or(expr.span);
- span_with_whitespace.shrink_to_hi().with_hi(e.span.hi())
- } else {
- // this is a recovered `await expr`
- e.span
- };
- self.lower_expr_await(dot_await_span, expr)
- }
+ ExprKind::Await(expr, await_kw_span) => self.lower_expr_await(*await_kw_span, expr),
ExprKind::Closure(box Closure {
binder,
capture_clause,
@@ -710,18 +696,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
/// }
/// }
/// ```
- fn lower_expr_await(&mut self, dot_await_span: Span, expr: &Expr) -> hir::ExprKind<'hir> {
- let full_span = expr.span.to(dot_await_span);
+ fn lower_expr_await(&mut self, await_kw_span: Span, expr: &Expr) -> hir::ExprKind<'hir> {
+ let full_span = expr.span.to(await_kw_span);
match self.generator_kind {
Some(hir::GeneratorKind::Async(_)) => {}
Some(hir::GeneratorKind::Gen) | None => {
self.tcx.sess.emit_err(AwaitOnlyInAsyncFnAndBlocks {
- dot_await_span,
+ await_kw_span,
item_span: self.current_item,
});
}
}
- let span = self.mark_span_with_reason(DesugaringKind::Await, dot_await_span, None);
+ let span = self.mark_span_with_reason(DesugaringKind::Await, await_kw_span, None);
let gen_future_span = self.mark_span_with_reason(
DesugaringKind::Await,
full_span,
diff --git a/compiler/rustc_ast_lowering/src/format.rs b/compiler/rustc_ast_lowering/src/format.rs
index c081162ea14..9b295339d94 100644
--- a/compiler/rustc_ast_lowering/src/format.rs
+++ b/compiler/rustc_ast_lowering/src/format.rs
@@ -583,7 +583,7 @@ fn may_contain_yield_point(e: &ast::Expr) -> bool {
impl Visitor<'_> for MayContainYieldPoint {
fn visit_expr(&mut self, e: &ast::Expr) {
- if let ast::ExprKind::Await(_) | ast::ExprKind::Yield(_) = e.kind {
+ if let ast::ExprKind::Await(_, _) | ast::ExprKind::Yield(_) = e.kind {
self.0 = true;
} else {
visit::walk_expr(self, e);
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
index aeb0c762020..bac8d21eb7a 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs
@@ -447,7 +447,7 @@ impl<'a> State<'a> {
self.ibox(0);
self.print_block_with_attrs(blk, attrs);
}
- ast::ExprKind::Await(expr) => {
+ ast::ExprKind::Await(expr, _) => {
self.print_expr_maybe_paren(expr, parser::PREC_POSTFIX);
self.word(".await");
}
diff --git a/compiler/rustc_borrowck/messages.ftl b/compiler/rustc_borrowck/messages.ftl
index 0b8123c9703..4a616dc2464 100644
--- a/compiler/rustc_borrowck/messages.ftl
+++ b/compiler/rustc_borrowck/messages.ftl
@@ -203,6 +203,15 @@ borrowck_moved_due_to_method_call =
*[false] call
}
+borrowck_moved_due_to_await =
+ {$place_name} {$is_partial ->
+ [true] partially moved
+ *[false] moved
+ } due to this {$is_loop_message ->
+ [true] await, in previous iteration of loop
+ *[false] await
+ }
+
borrowck_value_moved_here =
value {$is_partial ->
[true] partially moved
diff --git a/compiler/rustc_borrowck/src/diagnostics/mod.rs b/compiler/rustc_borrowck/src/diagnostics/mod.rs
index 4243ec214b0..a780255725e 100644
--- a/compiler/rustc_borrowck/src/diagnostics/mod.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/mod.rs
@@ -1085,12 +1085,21 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
}
}
} else {
- err.subdiagnostic(CaptureReasonLabel::MethodCall {
- fn_call_span,
- place_name: &place_name,
- is_partial,
- is_loop_message,
- });
+ if let Some((CallDesugaringKind::Await, _)) = desugaring {
+ err.subdiagnostic(CaptureReasonLabel::Await {
+ fn_call_span,
+ place_name: &place_name,
+ is_partial,
+ is_loop_message,
+ });
+ } else {
+ err.subdiagnostic(CaptureReasonLabel::MethodCall {
+ fn_call_span,
+ place_name: &place_name,
+ is_partial,
+ is_loop_message,
+ });
+ }
// Erase and shadow everything that could be passed to the new infcx.
let ty = moved_place.ty(self.body, tcx).ty;
diff --git a/compiler/rustc_borrowck/src/session_diagnostics.rs b/compiler/rustc_borrowck/src/session_diagnostics.rs
index bb95101845f..fceae5bb3ff 100644
--- a/compiler/rustc_borrowck/src/session_diagnostics.rs
+++ b/compiler/rustc_borrowck/src/session_diagnostics.rs
@@ -338,6 +338,14 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool,
is_loop_message: bool,
},
+ #[label(borrowck_moved_due_to_await)]
+ Await {
+ #[primary_span]
+ fn_call_span: Span,
+ place_name: &'a str,
+ is_partial: bool,
+ is_loop_message: bool,
+ },
#[label(borrowck_value_moved_here)]
MovedHere {
#[primary_span]
diff --git a/compiler/rustc_builtin_macros/src/assert/context.rs b/compiler/rustc_builtin_macros/src/assert/context.rs
index 090e00616fb..bd3f148c9a7 100644
--- a/compiler/rustc_builtin_macros/src/assert/context.rs
+++ b/compiler/rustc_builtin_macros/src/assert/context.rs
@@ -288,7 +288,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
ExprKind::Assign(_, _, _)
| ExprKind::AssignOp(_, _, _)
| ExprKind::Async(_, _)
- | ExprKind::Await(_)
+ | ExprKind::Await(_, _)
| ExprKind::Block(_, _)
| ExprKind::Break(_, _)
| ExprKind::Closure(_)
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
index 4fb66854571..e3d39091a74 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/ops.rs
@@ -184,6 +184,9 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
CallDesugaringKind::TryBlockFromOutput => {
error!("`try` block cannot convert `{}` to the result in {}s")
}
+ CallDesugaringKind::Await => {
+ error!("cannot convert `{}` into a future in {}s")
+ }
};
diag_trait(&mut err, self_ty, kind.trait_def_id(tcx));
diff --git a/compiler/rustc_middle/src/util/call_kind.rs b/compiler/rustc_middle/src/util/call_kind.rs
index 627c84c388c..98d55ea6d40 100644
--- a/compiler/rustc_middle/src/util/call_kind.rs
+++ b/compiler/rustc_middle/src/util/call_kind.rs
@@ -19,6 +19,8 @@ pub enum CallDesugaringKind {
QuestionFromResidual,
/// try { ..; x } calls type_of(x)::from_output(x)
TryBlockFromOutput,
+ /// `.await` calls `IntoFuture::into_future`
+ Await,
}
impl CallDesugaringKind {
@@ -29,6 +31,7 @@ impl CallDesugaringKind {
tcx.require_lang_item(LangItem::Try, None)
}
Self::QuestionFromResidual => tcx.get_diagnostic_item(sym::FromResidual).unwrap(),
+ Self::Await => tcx.get_diagnostic_item(sym::IntoFuture).unwrap(),
}
}
}
@@ -129,6 +132,8 @@ pub fn call_kind<'tcx>(
&& fn_call_span.desugaring_kind() == Some(DesugaringKind::TryBlock)
{
Some((CallDesugaringKind::TryBlockFromOutput, method_substs.type_at(0)))
+ } else if fn_call_span.is_desugaring(DesugaringKind::Await) {
+ Some((CallDesugaringKind::Await, method_substs.type_at(0)))
} else {
None
};
diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs
index c14c7f2fa0d..0e041df898c 100644
--- a/compiler/rustc_parse/src/parser/diagnostics.rs
+++ b/compiler/rustc_parse/src/parser/diagnostics.rs
@@ -1646,7 +1646,7 @@ impl<'a> Parser<'a> {
// Avoid knock-down errors as we don't know whether to interpret this as `foo().await?`
// or `foo()?.await` (the very reason we went with postfix syntax 😅).
ExprKind::Try(_) => ExprKind::Err,
- _ => ExprKind::Await(expr),
+ _ => ExprKind::Await(expr, await_sp),
};
let expr = self.mk_expr(lo.to(sp), kind);
self.maybe_recover_from_bad_qpath(expr)
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 27de9bd7268..bff9de5c652 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -859,7 +859,7 @@ impl<'a> Parser<'a> {
ExprKind::Field(_, _) => "a field access",
ExprKind::MethodCall(_) => "a method call",
ExprKind::Call(_, _) => "a function call",
- ExprKind::Await(_) => "`.await`",
+ ExprKind::Await(_, _) => "`.await`",
ExprKind::Err => return Ok(with_postfix),
_ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
}
@@ -3252,7 +3252,7 @@ impl<'a> Parser<'a> {
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));
+ let await_expr = self.mk_expr(span, ExprKind::Await(self_arg, self.prev_token.span));
self.recover_from_await_method_call();
await_expr
}
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index c2619956219..5bfbff76b4f 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -207,6 +207,7 @@ symbols! {
Input,
Into,
IntoDiagnostic,
+ IntoFuture,
IntoIterator,
IoRead,
IoWrite,
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 c969e5d4975..595f6e0b927 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -1583,55 +1583,68 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
}
fn suggest_remove_await(&self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic) {
- let span = obligation.cause.span;
-
- if let ObligationCauseCode::AwaitableExpr(hir_id) = obligation.cause.code().peel_derives() {
- let hir = self.tcx.hir();
- if let Some(hir::Node::Expr(expr)) = hir_id.and_then(|hir_id| hir.find(hir_id)) {
- // 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.
+ let hir = self.tcx.hir();
+ if let ObligationCauseCode::AwaitableExpr(Some(hir_id)) = obligation.cause.code().peel_derives()
+ && let hir::Node::Expr(expr) = hir.get(*hir_id)
+ {
+ // 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.
+
+ // use nth(1) to skip one layer of desugaring from `IntoIter::into_iter`
+ if let Some((_, hir::Node::Expr(await_expr))) = hir.parent_iter(*hir_id).nth(1)
+ && let Some(expr_span) = expr.span.find_ancestor_inside(await_expr.span)
+ {
+ let removal_span = self.tcx
+ .sess
+ .source_map()
+ .span_extend_while(expr_span, char::is_whitespace)
+ .unwrap_or(expr_span)
+ .shrink_to_hi()
+ .to(await_expr.span.shrink_to_hi());
err.span_suggestion(
- span,
+ removal_span,
"remove the `.await`",
"",
Applicability::MachineApplicable,
);
- // FIXME: account for associated `async fn`s.
- if let hir::Expr { span, kind: hir::ExprKind::Call(base, _), .. } = expr {
- if let ty::PredicateKind::Clause(ty::Clause::Trait(pred)) =
- obligation.predicate.kind().skip_binder()
+ } else {
+ err.span_label(obligation.cause.span, "remove the `.await`");
+ }
+ // FIXME: account for associated `async fn`s.
+ if let hir::Expr { span, kind: hir::ExprKind::Call(base, _), .. } = expr {
+ if let ty::PredicateKind::Clause(ty::Clause::Trait(pred)) =
+ obligation.predicate.kind().skip_binder()
+ {
+ err.span_label(*span, &format!("this call returns `{}`", pred.self_ty()));
+ }
+ if let Some(typeck_results) = &self.typeck_results
+ && let ty = typeck_results.expr_ty_adjusted(base)
+ && let ty::FnDef(def_id, _substs) = ty.kind()
+ && let Some(hir::Node::Item(hir::Item { ident, span, vis_span, .. })) =
+ hir.get_if_local(*def_id)
{
- err.span_label(*span, &format!("this call returns `{}`", pred.self_ty()));
- }
- if let Some(typeck_results) = &self.typeck_results
- && let ty = typeck_results.expr_ty_adjusted(base)
- && let ty::FnDef(def_id, _substs) = ty.kind()
- && let Some(hir::Node::Item(hir::Item { ident, span, vis_span, .. })) =
- hir.get_if_local(*def_id)
- {
- let msg = format!(
- "alternatively, consider making `fn {}` asynchronous",
- ident
+ let msg = format!(
+ "alternatively, consider making `fn {}` asynchronous",
+ ident
+ );
+ if vis_span.is_empty() {
+ err.span_suggestion_verbose(
+ span.shrink_to_lo(),
+ &msg,
+ "async ",
+ Applicability::MaybeIncorrect,
+ );
+ } else {
+ err.span_suggestion_verbose(
+ vis_span.shrink_to_hi(),
+ &msg,
+ " async",
+ Applicability::MaybeIncorrect,
);
- if vis_span.is_empty() {
- err.span_suggestion_verbose(
- span.shrink_to_lo(),
- &msg,
- "async ",
- Applicability::MaybeIncorrect,
- );
- } else {
- err.span_suggestion_verbose(
- vis_span.shrink_to_hi(),
- &msg,
- " async",
- Applicability::MaybeIncorrect,
- );
- }
}
- }
+ }
}
}
}
diff --git a/library/core/src/future/into_future.rs b/library/core/src/future/into_future.rs
index 649b4338772..38c654e76b4 100644
--- a/library/core/src/future/into_future.rs
+++ b/library/core/src/future/into_future.rs
@@ -99,6 +99,7 @@ use crate::future::Future;
/// }
/// ```
#[stable(feature = "into_future", since = "1.64.0")]
+#[rustc_diagnostic_item = "IntoFuture"]
pub trait IntoFuture {
/// The output that the future will produce on completion.
#[stable(feature = "into_future", since = "1.64.0")]
diff --git a/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs b/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs
index fab8e9c2ec1..e2cdc48b583 100644
--- a/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs
+++ b/src/tools/clippy/clippy_lints/src/suspicious_operation_groupings.rs
@@ -577,7 +577,7 @@ fn ident_difference_expr_with_base_location(
| (AssignOp(_, _, _), AssignOp(_, _, _))
| (Assign(_, _, _), Assign(_, _, _))
| (TryBlock(_), TryBlock(_))
- | (Await(_), Await(_))
+ | (Await(_, _), Await(_, _))
| (Async(_, _), Async(_, _))
| (Block(_, _), Block(_, _))
| (Closure(_), Closure(_))
diff --git a/src/tools/clippy/clippy_utils/src/ast_utils.rs b/src/tools/clippy/clippy_utils/src/ast_utils.rs
index 1f15598db36..8cc01f1ef97 100644
--- a/src/tools/clippy/clippy_utils/src/ast_utils.rs
+++ b/src/tools/clippy/clippy_utils/src/ast_utils.rs
@@ -143,7 +143,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
(Paren(l), _) => eq_expr(l, r),
(_, Paren(r)) => eq_expr(l, r),
(Err, Err) => true,
- (Try(l), Try(r)) | (Await(l), Await(r)) => eq_expr(l, r),
+ (Try(l), Try(r)) | (Await(l, _), Await(r, _)) => eq_expr(l, r),
(Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)),
(Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)),
(Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value),
diff --git a/src/tools/clippy/tests/ui/future_not_send.stderr b/src/tools/clippy/tests/ui/future_not_send.stderr
index 5b6858e4568..5c6348962a5 100644
--- a/src/tools/clippy/tests/ui/future_not_send.stderr
+++ b/src/tools/clippy/tests/ui/future_not_send.stderr
@@ -5,22 +5,22 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ future returned by `private_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
- --> $DIR/future_not_send.rs:8:19
+ --> $DIR/future_not_send.rs:8:20
|
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| -- has type `std::rc::Rc<[u8]>` which is not `Send`
LL | async { true }.await
- | ^^^^^^ await occurs here, with `rc` maybe used later
+ | ^^^^^ await occurs here, with `rc` maybe used later
LL | }
| - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
note: future is not `Send` as this value is used across an await
- --> $DIR/future_not_send.rs:8:19
+ --> $DIR/future_not_send.rs:8:20
|
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ---- has type `&std::cell::Cell<usize>` which is not `Send`
LL | async { true }.await
- | ^^^^^^ await occurs here, with `cell` maybe used later
+ | ^^^^^ await occurs here, with `cell` maybe used later
LL | }
| - `cell` is later dropped here
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
@@ -33,12 +33,12 @@ LL | pub async fn public_future(rc: Rc<[u8]>) {
| ^ future returned by `public_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
- --> $DIR/future_not_send.rs:12:19
+ --> $DIR/future_not_send.rs:12:20
|
LL | pub async fn public_future(rc: Rc<[u8]>) {
| -- has type `std::rc::Rc<[u8]>` which is not `Send`
LL | async { true }.await;
- | ^^^^^^ await occurs here, with `rc` maybe used later
+ | ^^^^^ await occurs here, with `rc` maybe used later
LL | }
| - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
@@ -82,12 +82,12 @@ LL | async fn private_future(&self) -> usize {
| ^^^^^ future returned by `private_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
- --> $DIR/future_not_send.rs:35:23
+ --> $DIR/future_not_send.rs:35:24
|
LL | async fn private_future(&self) -> usize {
| ----- has type `&Dummy` which is not `Send`
LL | async { true }.await;
- | ^^^^^^ await occurs here, with `&self` maybe used later
+ | ^^^^^ await occurs here, with `&self` maybe used later
LL | self.rc.len()
LL | }
| - `&self` is later dropped here
@@ -100,12 +100,12 @@ LL | pub async fn public_future(&self) {
| ^ future returned by `public_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
- --> $DIR/future_not_send.rs:40:30
+ --> $DIR/future_not_send.rs:40:31
|
LL | pub async fn public_future(&self) {
| ----- has type `&Dummy` which is not `Send`
LL | self.private_future().await;
- | ^^^^^^ await occurs here, with `&self` maybe used later
+ | ^^^^^ await occurs here, with `&self` maybe used later
LL | }
| - `&self` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
@@ -117,12 +117,12 @@ LL | async fn generic_future<T>(t: T) -> T
| ^ future returned by `generic_future` is not `Send`
|
note: future is not `Send` as this value is used across an await
- --> $DIR/future_not_send.rs:54:19
+ --> $DIR/future_not_send.rs:54:20
|
LL | let rt = &t;
| -- has type `&T` which is not `Send`
LL | async { true }.await;
- | ^^^^^^ await occurs here, with `rt` maybe used later
+ | ^^^^^ await occurs here, with `rt` maybe used later
LL | t
LL | }
| - `rt` is later dropped here
diff --git a/src/tools/rustfmt/src/chains.rs b/src/tools/rustfmt/src/chains.rs
index cbe523c6c3c..0afce7cf659 100644
--- a/src/tools/rustfmt/src/chains.rs
+++ b/src/tools/rustfmt/src/chains.rs
@@ -232,7 +232,7 @@ impl ChainItemKind {
let span = mk_sp(nested.span.hi(), field.span.hi());
(kind, span)
}
- ast::ExprKind::Await(ref nested) => {
+ ast::ExprKind::Await(ref nested, _) => {
let span = mk_sp(nested.span.hi(), expr.span.hi());
(ChainItemKind::Await, span)
}
@@ -459,7 +459,7 @@ impl Chain {
ast::ExprKind::MethodCall(ref call) => Some(Self::convert_try(&call.receiver, context)),
ast::ExprKind::Field(ref subexpr, _)
| ast::ExprKind::Try(ref subexpr)
- | ast::ExprKind::Await(ref subexpr) => Some(Self::convert_try(subexpr, context)),
+ | ast::ExprKind::Await(ref subexpr, _) => Some(Self::convert_try(subexpr, context)),
_ => None,
}
}
diff --git a/src/tools/rustfmt/src/expr.rs b/src/tools/rustfmt/src/expr.rs
index 824e4219136..5dc628adb0c 100644
--- a/src/tools/rustfmt/src/expr.rs
+++ b/src/tools/rustfmt/src/expr.rs
@@ -218,7 +218,7 @@ pub(crate) fn format_expr(
ast::ExprKind::Try(..)
| ast::ExprKind::Field(..)
| ast::ExprKind::MethodCall(..)
- | ast::ExprKind::Await(_) => rewrite_chain(expr, context, shape),
+ | ast::ExprKind::Await(_, _) => rewrite_chain(expr, context, shape),
ast::ExprKind::MacCall(ref mac) => {
rewrite_macro(mac, None, context, shape, MacroPosition::Expression).or_else(|| {
wrap_str(
@@ -1889,7 +1889,7 @@ impl<'ast> RhsAssignKind<'ast> {
ast::ExprKind::Try(..)
| ast::ExprKind::Field(..)
| ast::ExprKind::MethodCall(..)
- | ast::ExprKind::Await(_)
+ | ast::ExprKind::Await(_, _)
)
}
_ => false,
diff --git a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
index 9bced25a595..a9d1477b9fe 100644
--- a/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
+++ b/tests/mir-opt/building/async_await.b-{closure#0}.generator_resume.0.mir
@@ -4,7 +4,7 @@
_0: GeneratorSavedTy {
ty: impl std::future::Future<Output = ()>,
source_info: SourceInfo {
- span: $DIR/async_await.rs:15:8: 15:14 (#8),
+ span: $DIR/async_await.rs:15:9: 15:14 (#8),
scope: scope[0],
},
ignore_for_traits: false,
@@ -12,7 +12,7 @@
_1: GeneratorSavedTy {
ty: impl std::future::Future<Output = ()>,
source_info: SourceInfo {
- span: $DIR/async_await.rs:16:8: 16:14 (#10),
+ span: $DIR/async_await.rs:16:9: 16:14 (#10),
scope: scope[0],
},
ignore_for_traits: false,
@@ -35,42 +35,42 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
debug _task_context => _38; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let mut _0: std::task::Poll<()>; // return place in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let _3: (); // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _4: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let mut _4: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _5: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:8
- let mut _6: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let mut _6: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _7: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
- let _8: (); // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _11: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _12: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let _8: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _9: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _10: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _11: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _12: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _13: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
let mut _14: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ let mut _15: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _16: isize; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
let mut _18: !; // in scope 0 at $DIR/async_await.rs:+1:5: +1:14
- let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:8: +1:14
- let mut _21: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _19: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _20: (); // in scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ let mut _21: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _22: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:8
- let mut _23: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let _24: (); // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _27: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _28: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _23: impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let _24: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _25: std::task::Poll<()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _26: std::pin::Pin<&mut impl std::future::Future<Output = ()>>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _27: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _28: &mut impl std::future::Future<Output = ()>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _29: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
let mut _30: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _31: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _32: isize; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _34: !; // in scope 0 at $DIR/async_await.rs:+2:5: +2:14
- let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
- let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ let mut _35: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ let mut _36: (); // in scope 0 at $DIR/async_await.rs:+2:9: +2:14
let mut _37: (); // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let mut _38: &mut std::task::Context<'_>; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
let mut _39: u32; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
scope 1 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // in scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // in scope 1 at $DIR/async_await.rs:+1:9: +1:14
let _17: (); // in scope 1 at $DIR/async_await.rs:+1:5: +1:14
scope 2 {
}
@@ -79,7 +79,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
}
scope 4 {
- debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // in scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ debug __awaitee => (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // in scope 4 at $DIR/async_await.rs:+2:9: +2:14
let _33: (); // in scope 4 at $DIR/async_await.rs:+2:5: +2:14
scope 5 {
}
@@ -96,7 +96,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb1: {
_38 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2
StorageLive(_3); // scope 0 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_4); // scope 0 at $DIR/async_await.rs:+1:9: +1:14
StorageLive(_5); // scope 0 at $DIR/async_await.rs:+1:5: +1:8
_5 = a() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:5: +1:8
// mir::Constant
@@ -105,30 +105,30 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb2: {
- _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:8: +1:14
+ _4 = <impl Future<Output = ()> as IntoFuture>::into_future(move _5) -> [return: bb3, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
// mir::Constant
- // + span: $DIR/async_await.rs:15:8: 15:14
+ // + span: $DIR/async_await.rs:15:9: 15:14
// + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
}
bb3: {
StorageDead(_5); // scope 0 at $DIR/async_await.rs:+1:13: +1:14
- nop; // scope 0 at $DIR/async_await.rs:+1:8: +1:14
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>) = move _4; // scope 0 at $DIR/async_await.rs:+1:8: +1:14
- goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ nop; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>) = move _4; // scope 0 at $DIR/async_await.rs:+1:9: +1:14
+ goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb4: {
- StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_8); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_10); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_11); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _12 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#3).0: impl std::future::Future<Output = ()>); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _10 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _11) -> [return: bb5, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
// mir::Constant
- // + span: $DIR/async_await.rs:15:8: 15:14
+ // + span: $DIR/async_await.rs:15:9: 15:14
// + literal: Const { ty: unsafe fn(&mut impl Future<Output = ()>) -> Pin<&mut impl Future<Output = ()>> {Pin::<&mut impl Future<Output = ()>>::new_unchecked}, val: Value(<ZST>) }
}
@@ -136,8 +136,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_11); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
StorageLive(_13); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
StorageLive(_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
- StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:8: +1:14
- _15 = _38; // scope 2 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
+ _15 = _38; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
_14 = move _15; // scope 2 at $DIR/async_await.rs:+1:5: +1:14
goto -> bb6; // scope 2 at $DIR/async_await.rs:+1:5: +1:14
}
@@ -145,35 +145,35 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb6: {
_13 = &mut (*_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14
StorageDead(_15); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:8: +1:14
+ _9 = <impl Future<Output = ()> as Future>::poll(move _10, move _13) -> [return: bb7, unwind unreachable]; // scope 2 at $DIR/async_await.rs:+1:9: +1:14
// mir::Constant
- // + span: $DIR/async_await.rs:15:8: 15:14
+ // + span: $DIR/async_await.rs:15:9: 15:14
// + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future<Output = ()>>, &'b mut Context<'c>) -> Poll<<impl Future<Output = ()> as Future>::Output> {<impl Future<Output = ()> as Future>::poll}, val: Value(<ZST>) }
}
bb7: {
StorageDead(_13); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_10); // scope 2 at $DIR/async_await.rs:+1:13: +1:14
- _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _16 = discriminant(_9); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb8: {
- _8 = const (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _8 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
StorageDead(_14); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_12); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_9); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
StorageDead(_8); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- _20 = (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- return; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ StorageLive(_19); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ _20 = (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ _0 = Poll::<()>::Pending; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 3; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ return; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb9: {
- unreachable; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ unreachable; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb10: {
@@ -190,10 +190,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb11: {
StorageDead(_20); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _38 = move _19; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
StorageDead(_19); // scope 1 at $DIR/async_await.rs:+1:13: +1:14
- _7 = const (); // scope 1 at $DIR/async_await.rs:+1:8: +1:14
- goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14
+ _7 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
+ goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
}
bb12: {
@@ -204,7 +204,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb13: {
StorageDead(_4); // scope 0 at $DIR/async_await.rs:+1:14: +1:15
StorageDead(_3); // scope 0 at $DIR/async_await.rs:+1:14: +1:15
- StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_21); // scope 0 at $DIR/async_await.rs:+2:9: +2:14
StorageLive(_22); // scope 0 at $DIR/async_await.rs:+2:5: +2:8
_22 = a() -> [return: bb14, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:5: +2:8
// mir::Constant
@@ -213,30 +213,30 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
}
bb14: {
- _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:8: +2:14
+ _21 = <impl Future<Output = ()> as IntoFuture>::into_future(move _22) -> [return: bb15, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
// mir::Constant
- // + span: $DIR/async_await.rs:16:8: 16:14
+ // + span: $DIR/async_await.rs:16:9: 16:14
// + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
}
bb15: {
StorageDead(_22); // scope 0 at $DIR/async_await.rs:+2:13: +2:14
- nop; // scope 0 at $DIR/async_await.rs:+2:8: +2:14
- (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>) = move _21; // scope 0 at $DIR/async_await.rs:+2:8: +2:14
- goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ nop; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>) = move _21; // scope 0 at $DIR/async_await.rs:+2:9: +2:14
+ goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb16: {
- StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_24); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_26); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_27); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _28 = &mut (((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2])) as variant#4).0: impl std::future::Future<Output = ()>); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _26 = Pin::<&mut impl Future<Output = ()>>::new_unchecked(move _27) -> [return: bb17, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
// mir::Constant
- // + span: $DIR/async_await.rs:16:8: 16:14
+ // + span: $DIR/async_await.rs:16:9: 16:14
// + literal: Const { ty: unsafe fn(&mut impl Future<Output = ()>) -> Pin<&mut impl Future<Output = ()>> {Pin::<&mut impl Future<Output = ()>>::new_unchecked}, val: Value(<ZST>) }
}
@@ -244,8 +244,8 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
StorageDead(_27); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
StorageLive(_29); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
StorageLive(_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
- StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:8: +2:14
- _31 = _38; // scope 5 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
+ _31 = _38; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
_30 = move _31; // scope 5 at $DIR/async_await.rs:+2:5: +2:14
goto -> bb18; // scope 5 at $DIR/async_await.rs:+2:5: +2:14
}
@@ -253,31 +253,31 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb18: {
_29 = &mut (*_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14
StorageDead(_31); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:8: +2:14
+ _25 = <impl Future<Output = ()> as Future>::poll(move _26, move _29) -> [return: bb19, unwind unreachable]; // scope 5 at $DIR/async_await.rs:+2:9: +2:14
// mir::Constant
- // + span: $DIR/async_await.rs:16:8: 16:14
+ // + span: $DIR/async_await.rs:16:9: 16:14
// + literal: Const { ty: for<'a, 'b, 'c> fn(Pin<&'a mut impl Future<Output = ()>>, &'b mut Context<'c>) -> Poll<<impl Future<Output = ()> as Future>::Output> {<impl Future<Output = ()> as Future>::poll}, val: Value(<ZST>) }
}
bb19: {
StorageDead(_29); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_26); // scope 5 at $DIR/async_await.rs:+2:13: +2:14
- _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _32 = discriminant(_25); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb20: {
- _24 = const (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _24 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
StorageDead(_30); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_28); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_25); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
StorageDead(_24); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- _36 = (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- return; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ StorageLive(_35); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ _36 = (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ _0 = Poll::<()>::Pending; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ discriminant((*(_1.0: &mut [async fn body@$DIR/async_await.rs:14:18: 17:2]))) = 4; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ return; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb21: {
@@ -294,10 +294,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb22: {
StorageDead(_36); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _38 = move _35; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
StorageDead(_35); // scope 4 at $DIR/async_await.rs:+2:13: +2:14
- _7 = const (); // scope 4 at $DIR/async_await.rs:+2:8: +2:14
- goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14
+ _7 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
+ goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
}
bb23: {
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
index fb83ca90a37..dee90262fd4 100644
--- a/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
+++ b/tests/ui/async-await/async-await-let-else.drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | is_send(foo(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:14
+ --> $DIR/async-await-let-else.rs:11:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await
- | ^^^^^^ await occurs here, with `r` maybe used later
+ | ^^^^^ await occurs here, with `r` maybe used later
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send`
@@ -65,12 +65,12 @@ LL | is_send(foo3(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:28
+ --> $DIR/async-await-let-else.rs:33:29
|
LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | 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: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
@@ -86,12 +86,12 @@ LL | is_send(foo4(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:14
+ --> $DIR/async-await-let-else.rs:41:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await;
- | ^^^^^^ await occurs here, with `r` maybe used later
+ | ^^^^^ await occurs here, with `r` maybe used later
...
LL | };
| - `r` is later dropped here
diff --git a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
index c284bbfb1cc..e3fcceaa392 100644
--- a/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-await-let-else.drop_tracking_mir.stderr
@@ -6,12 +6,12 @@ LL | is_send(foo(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:14
+ --> $DIR/async-await-let-else.rs:11:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await
- | ^^^^^^ await occurs here, with `r` maybe used later
+ | ^^^^^ await occurs here, with `r` maybe used later
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
|
@@ -63,10 +63,10 @@ LL | is_send(foo3(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:28
+ --> $DIR/async-await-let-else.rs:33:29
|
LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
+ | ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send`
@@ -83,12 +83,12 @@ LL | is_send(foo4(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:14
+ --> $DIR/async-await-let-else.rs:41:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await;
- | ^^^^^^ await occurs here, with `r` maybe used later
+ | ^^^^^ await occurs here, with `r` maybe used later
note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
|
diff --git a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
index d3c5e80a30d..ece4e51ecff 100644
--- a/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
+++ b/tests/ui/async-await/async-await-let-else.no_drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | is_send(foo(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:11:14
+ --> $DIR/async-await-let-else.rs:11:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await
- | ^^^^^^ await occurs here, with `r` maybe used later
+ | ^^^^^ await occurs here, with `r` maybe used later
LL | };
| - `r` is later dropped here
note: required by a bound in `is_send`
@@ -28,10 +28,10 @@ LL | is_send(foo2(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:23:26
+ --> $DIR/async-await-let-else.rs:23:27
|
LL | bar2(Rc::new(())).await
- | ----------- ^^^^^^ await occurs here, with `Rc::new(())` maybe used later
+ | ----------- ^^^^^ await occurs here, with `Rc::new(())` maybe used later
| |
| has type `Rc<()>` which is not `Send`
LL | };
@@ -50,12 +50,12 @@ LL | is_send(foo3(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:33:28
+ --> $DIR/async-await-let-else.rs:33:29
|
LL | (Rc::new(()), bar().await);
- | ----------- ^^^^^^ - `Rc::new(())` is later dropped here
- | | |
- | | 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: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15
@@ -71,12 +71,12 @@ LL | is_send(foo4(Some(true)));
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-await-let-else.rs:41:14
+ --> $DIR/async-await-let-else.rs:41:15
|
LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send`
LL | bar().await;
- | ^^^^^^ await occurs here, with `r` maybe used later
+ | ^^^^^ await occurs here, with `r` maybe used later
...
LL | };
| - `r` is later dropped here
diff --git a/tests/ui/async-await/async-error-span.drop_tracking.stderr b/tests/ui/async-await/async-error-span.drop_tracking.stderr
index c6257cb324d..99a674a2684 100644
--- a/tests/ui/async-await/async-error-span.drop_tracking.stderr
+++ b/tests/ui/async-await/async-error-span.drop_tracking.stderr
@@ -14,10 +14,10 @@ LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/async-error-span.rs:19:17
+ --> $DIR/async-error-span.rs:19:18
|
LL | get_future().await;
- | ^^^^^^
+ | ^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
index c6257cb324d..99a674a2684 100644
--- a/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
+++ b/tests/ui/async-await/async-error-span.no_drop_tracking.stderr
@@ -14,10 +14,10 @@ LL | let a;
| ^ cannot infer type
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/async-error-span.rs:19:17
+ --> $DIR/async-error-span.rs:19:18
|
LL | get_future().await;
- | ^^^^^^
+ | ^^^^^
error: aborting due to 2 previous errors
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
index 0f0dc335e7f..0515edaeda3 100644
--- a/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
+++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | assert_send(non_send_temporary_in_match());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:25
+ --> $DIR/async-fn-nonsend.rs:36:26
|
LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
- | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
+ | ^^^^^ await occurs here, with `Some(non_send())` maybe used later
...
LL | }
| - `Some(non_send())` is later dropped here
@@ -29,13 +29,13 @@ LL | assert_send(non_sync_with_method_call());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:14
+ --> $DIR/async-fn-nonsend.rs:49:15
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
...
LL | fut().await;
- | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
+ | ^^^^^ await occurs here, with `get_formatter()` maybe used later
LL | }
LL | }
| - `get_formatter()` is later dropped here
diff --git a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
index 57a01280145..219945e0971 100644
--- a/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/async-fn-nonsend.drop_tracking_mir.stderr
@@ -6,12 +6,12 @@ LL | assert_send(non_send_temporary_in_match());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:25
+ --> $DIR/async-fn-nonsend.rs:36:26
|
LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
- | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
+ | ^^^^^ await occurs here, with `Some(non_send())` maybe used later
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
@@ -26,13 +26,13 @@ LL | assert_send(non_sync_with_method_call());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:14
+ --> $DIR/async-fn-nonsend.rs:49:15
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
...
LL | fut().await;
- | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
+ | ^^^^^ await occurs here, with `get_formatter()` maybe used later
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
diff --git a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
index 5cec21d890e..b29d2e192f4 100644
--- a/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
+++ b/tests/ui/async-await/async-fn-nonsend.no_drop_tracking.stderr
@@ -6,13 +6,13 @@ LL | assert_send(local_dropped_before_await());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:27:10
+ --> $DIR/async-fn-nonsend.rs:27:11
|
LL | let x = non_send();
| - has type `impl Debug` which is not `Send`
LL | drop(x);
LL | fut().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `assert_send`
@@ -29,12 +29,12 @@ LL | assert_send(non_send_temporary_in_match());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:25
+ --> $DIR/async-fn-nonsend.rs:36:26
|
LL | match Some(non_send()) {
| ---------- has type `impl Debug` which is not `Send`
LL | Some(_) => fut().await,
- | ^^^^^^ await occurs here, with `non_send()` maybe used later
+ | ^^^^^ await occurs here, with `non_send()` maybe used later
...
LL | }
| - `non_send()` is later dropped here
@@ -52,13 +52,13 @@ LL | assert_send(non_sync_with_method_call());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:14
+ --> $DIR/async-fn-nonsend.rs:49:15
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
...
LL | fut().await;
- | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
+ | ^^^^^ await occurs here, with `get_formatter()` maybe used later
LL | }
LL | }
| - `get_formatter()` is later dropped here
@@ -76,13 +76,13 @@ LL | assert_send(non_sync_with_method_call_panic());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:56:14
+ --> $DIR/async-fn-nonsend.rs:56:15
|
LL | let f: &mut std::fmt::Formatter = panic!();
| - has type `&mut Formatter<'_>` which is not `Send`
LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await;
- | ^^^^^^ await occurs here, with `f` maybe used later
+ | ^^^^^ await occurs here, with `f` maybe used later
LL | }
LL | }
| - `f` is later dropped here
@@ -100,13 +100,13 @@ LL | assert_send(non_sync_with_method_call_infinite_loop());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:63:14
+ --> $DIR/async-fn-nonsend.rs:63:15
|
LL | let f: &mut std::fmt::Formatter = loop {};
| - has type `&mut Formatter<'_>` which is not `Send`
LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await;
- | ^^^^^^ await occurs here, with `f` maybe used later
+ | ^^^^^ await occurs here, with `f` maybe used later
LL | }
LL | }
| - `f` is later dropped here
diff --git a/tests/ui/async-await/async-fn-nonsend.stderr b/tests/ui/async-await/async-fn-nonsend.stderr
deleted file mode 100644
index 0f0dc335e7f..00000000000
--- a/tests/ui/async-await/async-fn-nonsend.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:72:17
- |
-LL | assert_send(non_send_temporary_in_match());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:36:25
- |
-LL | match Some(non_send()) {
- | ---------------- has type `Option<impl Debug>` which is not `Send`
-LL | Some(_) => fut().await,
- | ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
-...
-LL | }
- | - `Some(non_send())` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: future cannot be sent between threads safely
- --> $DIR/async-fn-nonsend.rs:74:17
- |
-LL | assert_send(non_sync_with_method_call());
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
-note: future is not `Send` as this value is used across an await
- --> $DIR/async-fn-nonsend.rs:49:14
- |
-LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
- | --------------- has type `Formatter<'_>` which is not `Send`
-...
-LL | fut().await;
- | ^^^^^^ await occurs here, with `get_formatter()` maybe used later
-LL | }
-LL | }
- | - `get_formatter()` is later dropped here
-note: required by a bound in `assert_send`
- --> $DIR/async-fn-nonsend.rs:67:24
- |
-LL | fn assert_send(_: impl Send) {}
- | ^^^^ required by this bound in `assert_send`
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/async-await/async-is-unwindsafe.stderr b/tests/ui/async-await/async-is-unwindsafe.stderr
index d6404b30e74..5d29325c827 100644
--- a/tests/ui/async-await/async-is-unwindsafe.stderr
+++ b/tests/ui/async-await/async-is-unwindsafe.stderr
@@ -17,13 +17,13 @@ LL | | });
= help: within `[async block@$DIR/async-is-unwindsafe.rs:12:19: 29:6]`, the trait `UnwindSafe` is not implemented for `&mut Context<'_>`
= note: `UnwindSafe` is implemented for `&std::task::Context<'_>`, but not for `&mut std::task::Context<'_>`
note: future does not implement `UnwindSafe` as this value is used across an await
- --> $DIR/async-is-unwindsafe.rs:25:17
+ --> $DIR/async-is-unwindsafe.rs:25:18
|
LL | let cx_ref = &mut cx;
| ------ has type `&mut Context<'_>` which does not implement `UnwindSafe`
LL |
LL | async {}.await; // this needs an inner await point
- | ^^^^^^ await occurs here, with `cx_ref` maybe used later
+ | ^^^^^ await occurs here, with `cx_ref` maybe used later
...
LL | });
| - `cx_ref` is later dropped here
diff --git a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
index b30f2883732..7b03e56662a 100644
--- a/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
+++ b/tests/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
@@ -143,7 +143,7 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
LL | fn foo9() -> 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:57:13
@@ -151,7 +151,7 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
LL | fn foo10() -> 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:66:14
@@ -159,71 +159,71 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
LL | fn foo12() -> 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:71:18
+ --> $DIR/incorrect-syntax-suggestions.rs:71:19
|
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:18
+ --> $DIR/incorrect-syntax-suggestions.rs:76:19
|
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:18
+ --> $DIR/incorrect-syntax-suggestions.rs:81:19
|
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:18
+ --> $DIR/incorrect-syntax-suggestions.rs:85:19
|
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:22
+ --> $DIR/incorrect-syntax-suggestions.rs:90:23
|
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:22
+ --> $DIR/incorrect-syntax-suggestions.rs:97:23
|
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:29
+ --> $DIR/incorrect-syntax-suggestions.rs:113:17
|
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:29
+ --> $DIR/incorrect-syntax-suggestions.rs:121:17
|
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/tests/ui/async-await/clone-suggestion.fixed b/tests/ui/async-await/clone-suggestion.fixed
new file mode 100644
index 00000000000..3514cd63df1
--- /dev/null
+++ b/tests/ui/async-await/clone-suggestion.fixed
@@ -0,0 +1,28 @@
+// edition: 2021
+// run-rustfix
+
+#![allow(unused)]
+
+use std::future::Future;
+use std::pin::Pin;
+use std::task::{Context, Poll};
+
+#[derive(Clone)]
+struct SharedFuture;
+
+impl Future for SharedFuture {
+ type Output = ();
+
+ fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<<Self as Future>::Output> {
+ todo!()
+ }
+}
+
+async fn foo() {
+ let f = SharedFuture;
+ f.clone().await;
+ f.await;
+ //~^ ERROR use of moved value
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/clone-suggestion.rs b/tests/ui/async-await/clone-suggestion.rs
new file mode 100644
index 00000000000..5a4f70cbf44
--- /dev/null
+++ b/tests/ui/async-await/clone-suggestion.rs
@@ -0,0 +1,28 @@
+// edition: 2021
+// run-rustfix
+
+#![allow(unused)]
+
+use std::future::Future;
+use std::pin::Pin;
+use std::task::{Context, Poll};
+
+#[derive(Clone)]
+struct SharedFuture;
+
+impl Future for SharedFuture {
+ type Output = ();
+
+ fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<<Self as Future>::Output> {
+ todo!()
+ }
+}
+
+async fn foo() {
+ let f = SharedFuture;
+ f.await;
+ f.await;
+ //~^ ERROR use of moved value
+}
+
+fn main() {}
diff --git a/tests/ui/async-await/clone-suggestion.stderr b/tests/ui/async-await/clone-suggestion.stderr
new file mode 100644
index 00000000000..c02206f6f9b
--- /dev/null
+++ b/tests/ui/async-await/clone-suggestion.stderr
@@ -0,0 +1,20 @@
+error[E0382]: use of moved value: `f`
+ --> $DIR/clone-suggestion.rs:24:5
+ |
+LL | let f = SharedFuture;
+ | - move occurs because `f` has type `SharedFuture`, which does not implement the `Copy` trait
+LL | f.await;
+ | ----- `f` moved due to this await
+LL | f.await;
+ | ^ value used here after move
+ |
+note: `into_future` takes ownership of the receiver `self`, which moves `f`
+ --> $SRC_DIR/core/src/future/into_future.rs:LL:COL
+help: you can `clone` the value and consume it, but this might not be your desired behavior
+ |
+LL | f.clone().await;
+ | ++++++++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
index 819b64ad77f..07ab8b3c903 100644
--- a/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
+++ b/tests/ui/async-await/drop-track-bad-field-in-fru.stderr
@@ -5,12 +5,12 @@ LL | None { value: (), ..Default::default() }.await;
| ^^^^^ `Option<_>::None` does not have this field
error[E0277]: `Option<_>` is not a future
- --> $DIR/drop-track-bad-field-in-fru.rs:7:45
+ --> $DIR/drop-track-bad-field-in-fru.rs:7:46
|
LL | None { value: (), ..Default::default() }.await;
- | ^^^^^^
- | |
- | `Option<_>` is not a future
+ | -^^^^^
+ | ||
+ | |`Option<_>` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for `Option<_>`
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
index e2bba812d05..80402d8424d 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking.stderr
@@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:38
+ --> $DIR/drop-track-field-assign-nonsend.rs:23:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
...
LL | let _ = send_element(element).await;
- | ^^^^^^ await occurs here, with `mut info` maybe used later
+ | ^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
index b89d8680407..d9141cf4e36 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.drop_tracking_mir.stderr
@@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:38
+ --> $DIR/drop-track-field-assign-nonsend.rs:23:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
...
LL | let _ = send_element(element).await;
- | ^^^^^^ await occurs here, with `mut info` maybe used later
+ | ^^^^^ await occurs here, with `mut info` maybe used later
note: required by a bound in `assert_send`
--> $DIR/drop-track-field-assign-nonsend.rs:40:19
|
diff --git a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
index e2bba812d05..80402d8424d 100644
--- a/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
+++ b/tests/ui/async-await/drop-track-field-assign-nonsend.no_drop_tracking.stderr
@@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/drop-track-field-assign-nonsend.rs:23:38
+ --> $DIR/drop-track-field-assign-nonsend.rs:23:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
...
LL | let _ = send_element(element).await;
- | ^^^^^^ await occurs here, with `mut info` maybe used later
+ | ^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
index ac461a671a8..e2e64c9ae0c 100644
--- a/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
+++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking.stderr
@@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:38
+ --> $DIR/field-assign-nonsend.rs:23:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
...
LL | let _ = send_element(element).await;
- | ^^^^^^ await occurs here, with `mut info` maybe used later
+ | ^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
diff --git a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
index 8c9d14d624c..d1df8e91afa 100644
--- a/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/field-assign-nonsend.drop_tracking_mir.stderr
@@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:38
+ --> $DIR/field-assign-nonsend.rs:23:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
...
LL | let _ = send_element(element).await;
- | ^^^^^^ await occurs here, with `mut info` maybe used later
+ | ^^^^^ await occurs here, with `mut info` maybe used later
note: required by a bound in `assert_send`
--> $DIR/field-assign-nonsend.rs:40:19
|
diff --git a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
index ac461a671a8..e2e64c9ae0c 100644
--- a/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
+++ b/tests/ui/async-await/field-assign-nonsend.no_drop_tracking.stderr
@@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>`
note: future is not `Send` as this value is used across an await
- --> $DIR/field-assign-nonsend.rs:23:38
+ --> $DIR/field-assign-nonsend.rs:23:39
|
LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send`
...
LL | let _ = send_element(element).await;
- | ^^^^^^ await occurs here, with `mut info` maybe used later
+ | ^^^^^ await occurs here, with `mut info` maybe used later
LL | }
| - `mut info` is later dropped here
note: required by a bound in `assert_send`
diff --git a/tests/ui/async-await/issue-101715.stderr b/tests/ui/async-await/issue-101715.stderr
index a0e8d2a8943..d161fb0c05e 100644
--- a/tests/ui/async-await/issue-101715.stderr
+++ b/tests/ui/async-await/issue-101715.stderr
@@ -1,10 +1,10 @@
error[E0277]: `()` is not a future
- --> $DIR/issue-101715.rs:11:9
+ --> $DIR/issue-101715.rs:11:10
|
LL | .await
- | ^^^^^^
- | |
- | `()` is not a future
+ | -^^^^^
+ | ||
+ | |`()` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for `()`
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
index c4c7f26c7c7..56aa035f44b 100644
--- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | is_sync(bar());
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:10
+ --> $DIR/issue-64130-1-sync.rs:18:11
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | drop(x);
LL | }
| - `x` is later dropped here
diff --git a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
index 6f43b568a7a..ea1bfb9f9ac 100644
--- a/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-1-sync.drop_tracking_mir.stderr
@@ -6,12 +6,12 @@ LL | is_sync(bar());
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:10
+ --> $DIR/issue-64130-1-sync.rs:18:11
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_sync`
--> $DIR/issue-64130-1-sync.rs:14:15
|
diff --git a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
index c4c7f26c7c7..56aa035f44b 100644
--- a/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-1-sync.no_drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | is_sync(bar());
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:10
+ --> $DIR/issue-64130-1-sync.rs:18:11
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | drop(x);
LL | }
| - `x` is later dropped here
diff --git a/tests/ui/async-await/issue-64130-1-sync.stderr b/tests/ui/async-await/issue-64130-1-sync.stderr
deleted file mode 100644
index 8d5169a6302..00000000000
--- a/tests/ui/async-await/issue-64130-1-sync.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error: future cannot be shared between threads safely
- --> $DIR/issue-64130-1-sync.rs:24:13
- |
-LL | is_sync(bar());
- | ^^^^^ future returned by `bar` is not `Sync`
- |
- = help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
-note: future is not `Sync` as this value is used across an await
- --> $DIR/issue-64130-1-sync.rs:18:10
- |
-LL | let x = Foo;
- | - has type `Foo` which is not `Sync`
-LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_sync`
- --> $DIR/issue-64130-1-sync.rs:14:15
- |
-LL | fn is_sync<T: Sync>(t: T) { }
- | ^^^^ required by this bound in `is_sync`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
index b6a73c2a5cb..d1717ad3310 100644
--- a/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-2-send.drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | is_send(bar());
|
= note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:10
+ --> $DIR/issue-64130-2-send.rs:18:11
|
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_send`
diff --git a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
index 560560f6036..45e43525a20 100644
--- a/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-2-send.drop_tracking_mir.stderr
@@ -6,12 +6,12 @@ LL | is_send(bar());
|
= note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:10
+ --> $DIR/issue-64130-2-send.rs:18:11
|
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_send`
--> $DIR/issue-64130-2-send.rs:14:15
|
diff --git a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
index b6a73c2a5cb..d1717ad3310 100644
--- a/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-2-send.no_drop_tracking.stderr
@@ -6,12 +6,12 @@ LL | is_send(bar());
|
= note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:10
+ --> $DIR/issue-64130-2-send.rs:18:11
|
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_send`
diff --git a/tests/ui/async-await/issue-64130-2-send.stderr b/tests/ui/async-await/issue-64130-2-send.stderr
deleted file mode 100644
index f6505cad69e..00000000000
--- a/tests/ui/async-await/issue-64130-2-send.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-64130-2-send.rs:24:13
- |
-LL | is_send(bar());
- | ^^^^^ future returned by `bar` is not `Send`
- |
- = help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
-note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-2-send.rs:18:10
- |
-LL | let x = Foo;
- | - has type `Foo` which is not `Send`
-LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_send`
- --> $DIR/issue-64130-2-send.rs:14:15
- |
-LL | fn is_send<T: Send>(t: T) { }
- | ^^^^ required by this bound in `is_send`
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
index d65aae8cc3f..b69f06da1cd 100644
--- a/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.drop_tracking.stderr
@@ -8,12 +8,12 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:10
+ --> $DIR/issue-64130-3-other.rs:21:11
|
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_qux`
diff --git a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
index 8fed69d9d88..1298371241c 100644
--- a/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.drop_tracking_mir.stderr
@@ -8,12 +8,12 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:10
+ --> $DIR/issue-64130-3-other.rs:21:11
|
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
note: required by a bound in `is_qux`
--> $DIR/issue-64130-3-other.rs:17:14
|
diff --git a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
index d65aae8cc3f..b69f06da1cd 100644
--- a/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-3-other.no_drop_tracking.stderr
@@ -8,12 +8,12 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:10
+ --> $DIR/issue-64130-3-other.rs:21:11
|
LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
+ | ^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_qux`
diff --git a/tests/ui/async-await/issue-64130-3-other.stderr b/tests/ui/async-await/issue-64130-3-other.stderr
deleted file mode 100644
index cb36a3811b2..00000000000
--- a/tests/ui/async-await/issue-64130-3-other.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
- --> $DIR/issue-64130-3-other.rs:27:12
- |
-LL | async fn bar() {
- | - within this `impl Future<Output = ()>`
-...
-LL | is_qux(bar());
- | ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
- |
-note: future does not implement `Qux` as this value is used across an await
- --> $DIR/issue-64130-3-other.rs:21:10
- |
-LL | let x = Foo;
- | - has type `Foo` which does not implement `Qux`
-LL | baz().await;
- | ^^^^^^ await occurs here, with `x` maybe used later
-LL | }
- | - `x` is later dropped here
-note: required by a bound in `is_qux`
- --> $DIR/issue-64130-3-other.rs:17:14
- |
-LL | fn is_qux<T: Qux>(t: T) {}
- | ^^^ required by this bound in `is_qux`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
index 0bc7cb2f2ac..4b575a3d3b4 100644
--- a/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-64130-4-async-move.no_drop_tracking.stderr
@@ -6,13 +6,13 @@ LL | pub fn foo() -> impl Future + Send {
|
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-4-async-move.rs:27:31
+ --> $DIR/issue-64130-4-async-move.rs:27:32
|
LL | match client.status() {
| ------ has type `&Client` which is not `Send`
LL | 200 => {
LL | let _x = get().await;
- | ^^^^^^ await occurs here, with `client` maybe used later
+ | ^^^^^ await occurs here, with `client` maybe used later
...
LL | }
| - `client` is later dropped here
diff --git a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
index 1da80d98bf8..e044e2ca011 100644
--- a/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
+++ b/tests/ui/async-await/issue-64130-non-send-future-diags.stderr
@@ -6,12 +6,12 @@ LL | is_send(foo());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-64130-non-send-future-diags.rs:17:10
+ --> $DIR/issue-64130-non-send-future-diags.rs:17:11
|
LL | let g = x.lock().unwrap();
| - has type `MutexGuard<'_, u32>` which is not `Send`
LL | baz().await;
- | ^^^^^^ await occurs here, with `g` maybe used later
+ | ^^^^^ await occurs here, with `g` maybe used later
LL | }
| - `g` is later dropped here
note: required by a bound in `is_send`
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
index fc8bcc8ae79..fa22298658b 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
+++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking.stderr
@@ -11,12 +11,12 @@ LL | | });
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:23:16
+ --> $DIR/issue-67252-unnamed-future.rs:23:17
|
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
- | ^^^^^^ await occurs here, with `a` maybe used later
+ | ^^^^^ await occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
index a3ef7add116..8cf7bb8d917 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
+++ b/tests/ui/async-await/issue-67252-unnamed-future.drop_tracking_mir.stderr
@@ -6,12 +6,12 @@ LL | spawn(async {
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:23:16
+ --> $DIR/issue-67252-unnamed-future.rs:23:17
|
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
- | ^^^^^^ await occurs here, with `a` maybe used later
+ | ^^^^^ await occurs here, with `a` maybe used later
note: required by a bound in `spawn`
--> $DIR/issue-67252-unnamed-future.rs:9:13
|
diff --git a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
index fc8bcc8ae79..fa22298658b 100644
--- a/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-67252-unnamed-future.no_drop_tracking.stderr
@@ -11,12 +11,12 @@ LL | | });
|
= help: within `[async block@$DIR/issue-67252-unnamed-future.rs:21:11: 25:6]`, the trait `Send` is not implemented for `*mut ()`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-67252-unnamed-future.rs:23:16
+ --> $DIR/issue-67252-unnamed-future.rs:23:17
|
LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send`
LL | AFuture.await;
- | ^^^^^^ await occurs here, with `a` maybe used later
+ | ^^^^^ await occurs here, with `a` maybe used later
LL | drop(a);
LL | });
| - `a` is later dropped here
diff --git a/tests/ui/async-await/issue-70594.stderr b/tests/ui/async-await/issue-70594.stderr
index d3cf57d3b14..9866e00bb83 100644
--- a/tests/ui/async-await/issue-70594.stderr
+++ b/tests/ui/async-await/issue-70594.stderr
@@ -1,10 +1,10 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-70594.rs:4:11
+ --> $DIR/issue-70594.rs:4:12
|
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:9
@@ -13,18 +13,18 @@ LL | [1; ().await];
| ^^^^^^^^
error[E0744]: `.await` is not allowed in a `const`
- --> $DIR/issue-70594.rs:4:11
+ --> $DIR/issue-70594.rs:4:12
|
LL | [1; ().await];
- | ^^^^^^
+ | ^^^^^
error[E0277]: `()` is not a future
- --> $DIR/issue-70594.rs:4:11
+ --> $DIR/issue-70594.rs:4:12
|
LL | [1; ().await];
- | ^^^^^^
- | |
- | `()` is not a future
+ | -^^^^^
+ | ||
+ | |`()` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for `()`
diff --git a/tests/ui/async-await/issue-70818.stderr b/tests/ui/async-await/issue-70818.stderr
deleted file mode 100644
index ab0698c3ec2..00000000000
--- a/tests/ui/async-await/issue-70818.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error: future cannot be sent between threads safely
- --> $DIR/issue-70818.rs:7:38
- |
-LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
- |
-note: captured value is not `Send`
- --> $DIR/issue-70818.rs:9:18
- |
-LL | async { (ty, ty1) }
- | ^^^ has type `U` which is not `Send`
-help: consider restricting type parameter `U`
- |
-LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
- | +++++++++++++++++++
-
-error: aborting due to previous error
-
diff --git a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
index 8036d82daa4..ef0e182e515 100644
--- a/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issue-70935-complex-spans.no_drop_tracking.stderr
@@ -6,15 +6,15 @@ LL | fn foo(tx: std::sync::mpsc::Sender<i32>) -> impl Future + Send {
|
= help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-70935-complex-spans.rs:19:11
+ --> $DIR/issue-70935-complex-spans.rs:19:12
|
LL | baz(|| async{
| _____________-
LL | | foo(tx.clone());
LL | | }).await;
- | | - ^^^^^^- the value is later dropped here
- | | | |
- | |_________| 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`
error: aborting due to previous error
diff --git a/tests/ui/async-await/issue-71137.stderr b/tests/ui/async-await/issue-71137.stderr
index eade6aa2d3d..a344246d6bf 100644
--- a/tests/ui/async-await/issue-71137.stderr
+++ b/tests/ui/async-await/issue-71137.stderr
@@ -6,12 +6,12 @@ LL | fake_spawn(wrong_mutex());
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-71137.rs:14:25
+ --> $DIR/issue-71137.rs:14:26
|
LL | let mut guard = m.lock().unwrap();
| --------- has type `MutexGuard<'_, i32>` which is not `Send`
LL | (async { "right"; }).await;
- | ^^^^^^ await occurs here, with `mut guard` maybe used later
+ | ^^^^^ await occurs here, with `mut guard` maybe used later
LL | *guard += 1;
LL | }
| - `mut guard` is later dropped here
diff --git a/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr b/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr
deleted file mode 100644
index 6d19c3beb2f..00000000000
--- a/tests/ui/async-await/issue-73741-type-err-drop-tracking.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0070]: invalid left-hand side of assignment
- --> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
- |
-LL | 1 = 2;
- | - ^
- | |
- | cannot assign to this expression
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0070`.
diff --git a/tests/ui/async-await/issue-98634.stderr b/tests/ui/async-await/issue-98634.stderr
index 5b7f18a98b5..574904ceafa 100644
--- a/tests/ui/async-await/issue-98634.stderr
+++ b/tests/ui/async-await/issue-98634.stderr
@@ -23,10 +23,10 @@ LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync`
error[E0271]: expected `callback` to be a fn item that returns `Pin<Box<dyn Future<Output = ()>>>`, but it returns `impl Future<Output = ()>`
- --> $DIR/issue-98634.rs:45:33
+ --> $DIR/issue-98634.rs:45:34
|
LL | StructAsync { callback }.await;
- | ^^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found future
+ | ^^^^^ expected `Pin<Box<dyn Future<Output = ()>>>`, found future
|
note: required by a bound in `StructAsync`
--> $DIR/issue-98634.rs:9:35
diff --git a/tests/ui/async-await/issues/issue-107280.stderr b/tests/ui/async-await/issues/issue-107280.stderr
index dd3e10fcc18..2e69862a0e0 100644
--- a/tests/ui/async-await/issues/issue-107280.stderr
+++ b/tests/ui/async-await/issues/issue-107280.stderr
@@ -23,10 +23,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -35,10 +35,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -47,10 +47,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -59,10 +59,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5
@@ -71,10 +71,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/issue-107280.rs:4:21
+ --> $DIR/issue-107280.rs:4:22
|
LL | inner::<false>().await
- | ^^^^^^
+ | ^^^^^
error: aborting due to 6 previous errors
diff --git a/tests/ui/async-await/issues/issue-51719.stderr b/tests/ui/async-await/issues/issue-51719.stderr
index f3ce5d1c897..19cc339ec0a 100644
--- a/tests/ui/async-await/issues/issue-51719.stderr
+++ b/tests/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:24
+ --> $DIR/issue-51719.rs:8:25
|
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/tests/ui/async-await/issues/issue-51751.stderr b/tests/ui/async-await/issues/issue-51751.stderr
index 8696a5b798b..6dd3726608b 100644
--- a/tests/ui/async-await/issues/issue-51751.stderr
+++ b/tests/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:26
+ --> $DIR/issue-51751.rs:9:27
|
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/tests/ui/async-await/issues/issue-62009-1.stderr b/tests/ui/async-await/issues/issue-62009-1.stderr
index 222afb2c7b2..53d0577a1b2 100644
--- a/tests/ui/async-await/issues/issue-62009-1.stderr
+++ b/tests/ui/async-await/issues/issue-62009-1.stderr
@@ -1,36 +1,36 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks
- --> $DIR/issue-62009-1.rs:6:22
+ --> $DIR/issue-62009-1.rs:6:23
|
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:6
+ --> $DIR/issue-62009-1.rs:10:7
|
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:15
+ --> $DIR/issue-62009-1.rs:12:16
|
LL | fn main() {
| ---- this is not `async`
...
LL | (|_| 2333).await;
- | ^^^^^^ only allowed inside `async` functions and blocks
+ | ^^^^^ only allowed inside `async` functions and blocks
error[E0277]: `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
- --> $DIR/issue-62009-1.rs:12:15
+ --> $DIR/issue-62009-1.rs:12:16
|
LL | (|_| 2333).await;
- | ^^^^^^
- | |
- | `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
+ | -^^^^^
+ | ||
+ | |`[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`
diff --git a/tests/ui/async-await/issues/issue-62009-2.stderr b/tests/ui/async-await/issues/issue-62009-2.stderr
index 92e9a8a69a8..9c2f20df657 100644
--- a/tests/ui/async-await/issues/issue-62009-2.stderr
+++ b/tests/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:22
+ --> $DIR/issue-62009-2.rs:8:23
|
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/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
index 8745bdd973b..53d32620241 100644
--- a/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
+++ b/tests/ui/async-await/issues/issue-65436-raw-ptr-not-send.no_drop_tracking.stderr
@@ -10,12 +10,12 @@ LL | | })
|
= help: within `[async block@$DIR/issue-65436-raw-ptr-not-send.rs:17:17: 20:6]`, the trait `Send` is not implemented for `*const u8`
note: future is not `Send` as this value is used across an await
- --> $DIR/issue-65436-raw-ptr-not-send.rs:19:35
+ --> $DIR/issue-65436-raw-ptr-not-send.rs:19:36
|
LL | bar(Foo(std::ptr::null())).await;
- | ---------------- ^^^^^^- `std::ptr::null()` is later dropped here
- | | |
- | | 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`
help: consider moving this into a `let` binding to create a shorter lived borrow
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:13
diff --git a/tests/ui/async-await/issues/issue-67893.stderr b/tests/ui/async-await/issues/issue-67893.stderr
index ce9424c8b25..c941b9eeb29 100644
--- a/tests/ui/async-await/issues/issue-67893.stderr
+++ b/tests/ui/async-await/issues/issue-67893.stderr
@@ -6,12 +6,12 @@ LL | g(issue_67893::run())
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>`
note: future is not `Send` as this value is used across an await
- --> $DIR/auxiliary/issue_67893.rs:12:26
+ --> $DIR/auxiliary/issue_67893.rs:12:27
|
LL | f(*x.lock().unwrap()).await;
- | ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here
- | | |
- | | 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: required by a bound in `g`
--> $DIR/issue-67893.rs:6:14
diff --git a/tests/ui/async-await/issues/non-async-enclosing-span.stderr b/tests/ui/async-await/issues/non-async-enclosing-span.stderr
index 20b827479fa..b6583022c16 100644
--- a/tests/ui/async-await/issues/non-async-enclosing-span.stderr
+++ b/tests/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:27
+ --> $DIR/non-async-enclosing-span.rs:9:28
|
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/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr b/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
deleted file mode 100644
index 8a7317bb95a..00000000000
--- a/tests/ui/async-await/mutually-recursive-async-impl-trait-type.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
- |
-LL | async fn rec_1() {
- | ^ recursive `async fn`
- |
- = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
- = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
-
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
- |
-LL | async fn rec_2() {
- | ^ recursive `async fn`
- |
- = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
- = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/recursive-async-impl-trait-type.stderr b/tests/ui/async-await/recursive-async-impl-trait-type.stderr
deleted file mode 100644
index 7e63a8da552..00000000000
--- a/tests/ui/async-await/recursive-async-impl-trait-type.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0733]: recursion in an `async fn` requires boxing
- --> $DIR/recursive-async-impl-trait-type.rs:8:40
- |
-LL | async fn recursive_async_function() -> () {
- | ^^ recursive `async fn`
- |
- = note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
- = note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0733`.
diff --git a/tests/ui/async-await/unnecessary-await.rs b/tests/ui/async-await/unnecessary-await.rs
index 24673777b80..cd1e2871432 100644
--- a/tests/ui/async-await/unnecessary-await.rs
+++ b/tests/ui/async-await/unnecessary-await.rs
@@ -11,4 +11,24 @@ async fn baz() -> std::io::Result<()> {
std::io::Result::Ok(())
}
+macro_rules! e {
+ () => {
+ ()
+ };
+}
+
+macro_rules! f {
+ ($expr:expr) => {
+ $expr.await
+ //~^ ERROR `()` is not a future
+ };
+}
+
+async fn with_macros() {
+ e!().await;
+ //~^ ERROR `()` is not a future
+
+ f!(());
+}
+
fn main() {}
diff --git a/tests/ui/async-await/unnecessary-await.stderr b/tests/ui/async-await/unnecessary-await.stderr
index dc308933697..9a2a035b2dd 100644
--- a/tests/ui/async-await/unnecessary-await.stderr
+++ b/tests/ui/async-await/unnecessary-await.stderr
@@ -1,8 +1,8 @@
error[E0277]: `()` is not a future
- --> $DIR/unnecessary-await.rs:9:10
+ --> $DIR/unnecessary-await.rs:9:11
|
LL | boo().await;
- | -----^^^^^^ `()` is not a future
+ | ----- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
@@ -19,6 +19,36 @@ help: alternatively, consider making `fn boo` asynchronous
LL | async fn boo() {}
| +++++
-error: aborting due to previous error
+error[E0277]: `()` is not a future
+ --> $DIR/unnecessary-await.rs:28:10
+ |
+LL | e!().await;
+ | -^^^^^
+ | ||
+ | |`()` is not a future
+ | help: remove the `.await`
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `()` to implement `IntoFuture`
+
+error[E0277]: `()` is not a future
+ --> $DIR/unnecessary-await.rs:22:15
+ |
+LL | $expr.await
+ | ^^^^^
+ | |
+ | `()` is not a future
+ | remove the `.await`
+...
+LL | f!(());
+ | ------ in this macro invocation
+ |
+ = help: the trait `Future` is not implemented for `()`
+ = note: () must be a future or must implement `IntoFuture` to be awaited
+ = note: required for `()` to implement `IntoFuture`
+ = note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
index 912e2b34c05..6b4a3a36395 100644
--- a/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
+++ b/tests/ui/async-await/unresolved_type_param.drop_tracking.stderr
@@ -5,10 +5,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
@@ -17,10 +17,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
@@ -29,10 +29,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error: aborting due to 3 previous errors
diff --git a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
index 16d618caa57..6642e90acd8 100644
--- a/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
+++ b/tests/ui/async-await/unresolved_type_param.no_drop_tracking.stderr
@@ -5,10 +5,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
@@ -17,10 +17,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
@@ -29,10 +29,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
@@ -41,10 +41,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5
@@ -53,10 +53,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:12:10
+ --> $DIR/unresolved_type_param.rs:12:11
|
LL | bar().await;
- | ^^^^^^
+ | ^^^^^
error: aborting due to 5 previous errors
diff --git a/tests/ui/async-await/unresolved_type_param.stderr b/tests/ui/async-await/unresolved_type_param.stderr
deleted file mode 100644
index 64a31b5fc32..00000000000
--- a/tests/ui/async-await/unresolved_type_param.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:13:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:13:10
- |
-LL | bar().await;
- | ^^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:13:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:13:10
- |
-LL | bar().await;
- | ^^^^^^
-
-error[E0698]: type inside `async fn` body must be known in this context
- --> $DIR/unresolved_type_param.rs:13:5
- |
-LL | bar().await;
- | ^^^ cannot infer type for type parameter `T` declared on the function `bar`
- |
-note: the type is part of the `async fn` body because of this `await`
- --> $DIR/unresolved_type_param.rs:13:10
- |
-LL | bar().await;
- | ^^^^^^
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0698`.
diff --git a/tests/ui/generator/borrowing.stderr b/tests/ui/generator/borrowing.stderr
deleted file mode 100644
index 96e3c327f8b..00000000000
--- a/tests/ui/generator/borrowing.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:13:33
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | Pin::new(&mut || yield &a).resume(())
- | -- ^ borrowed value does not live long enough
- | |
- | value captured here by generator
-LL |
-LL | };
- | - `a` dropped here while still borrowed
-
-error[E0597]: `a` does not live long enough
- --> $DIR/borrowing.rs:20:20
- |
-LL | let _b = {
- | -- borrow later stored here
-LL | let a = 3;
-LL | || {
- | -- value captured here by generator
-LL | yield &a
- | ^ borrowed value does not live long enough
-...
-LL | };
- | - `a` dropped here while still borrowed
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/tests/ui/generator/retain-resume-ref.stderr b/tests/ui/generator/retain-resume-ref.stderr
deleted file mode 100644
index 7122a951e80..00000000000
--- a/tests/ui/generator/retain-resume-ref.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0499]: cannot borrow `thing` as mutable more than once at a time
- --> $DIR/retain-resume-ref.rs:27:25
- |
-LL | gen.as_mut().resume(&mut thing);
- | ---------- first mutable borrow occurs here
-LL | gen.as_mut().resume(&mut thing);
- | ------ ^^^^^^^^^^ second mutable borrow occurs here
- | |
- | first borrow later used by call
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0499`.
diff --git a/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr b/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
index 9e1fed54c54..dec0141ab67 100644
--- a/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
+++ b/tests/ui/generator/unresolved-ct-var-drop-tracking.stderr
@@ -1,10 +1,10 @@
error[E0277]: `[(); _]` is not a future
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44
+ --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ---------------------------^^^^^^
- | | |
- | | `[(); _]` is not a future
+ | ----------------------------^^^^^
+ | | ||
+ | | |`[(); _]` is not a future
| | help: remove the `.await`
| this call returns `[(); _]`
|
@@ -19,10 +19,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44
+ --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
@@ -31,10 +31,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44
+ --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
@@ -43,10 +43,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44
+ --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
@@ -55,10 +55,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44
+ --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17
@@ -67,10 +67,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var-drop-tracking.rs:7:44
+ --> $DIR/unresolved-ct-var-drop-tracking.rs:7:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error: aborting due to 6 previous errors
diff --git a/tests/ui/generator/unresolved-ct-var.stderr b/tests/ui/generator/unresolved-ct-var.stderr
index fdf00dfad7a..ace254178b7 100644
--- a/tests/ui/generator/unresolved-ct-var.stderr
+++ b/tests/ui/generator/unresolved-ct-var.stderr
@@ -1,10 +1,10 @@
error[E0277]: `[(); _]` is not a future
- --> $DIR/unresolved-ct-var.rs:6:44
+ --> $DIR/unresolved-ct-var.rs:6:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ---------------------------^^^^^^
- | | |
- | | `[(); _]` is not a future
+ | ----------------------------^^^^^
+ | | ||
+ | | |`[(); _]` is not a future
| | help: remove the `.await`
| this call returns `[(); _]`
|
@@ -19,10 +19,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:44
+ --> $DIR/unresolved-ct-var.rs:6:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17
@@ -31,10 +31,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:44
+ --> $DIR/unresolved-ct-var.rs:6:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17
@@ -43,10 +43,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:44
+ --> $DIR/unresolved-ct-var.rs:6:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17
@@ -55,10 +55,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:44
+ --> $DIR/unresolved-ct-var.rs:6:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17
@@ -67,10 +67,10 @@ LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^^^^^^^^^^^^^^ cannot infer the value of const parameter `N` declared on the function `from_fn`
|
note: the type is part of the `async` block because of this `await`
- --> $DIR/unresolved-ct-var.rs:6:44
+ --> $DIR/unresolved-ct-var.rs:6:45
|
LL | let s = std::array::from_fn(|_| ()).await;
- | ^^^^^^
+ | ^^^^^
error: aborting due to 6 previous errors
diff --git a/tests/ui/lint/must_not_suspend/boxed.stderr b/tests/ui/lint/must_not_suspend/boxed.stderr
index 9efc7b0693b..a2abfffc170 100644
--- a/tests/ui/lint/must_not_suspend/boxed.stderr
+++ b/tests/ui/lint/must_not_suspend/boxed.stderr
@@ -4,7 +4,7 @@ error: boxed `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/boxed.rs:20:9
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
index 262657da5fe..cd3baa857ab 100644
--- a/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/dedup.drop_tracking.stderr
@@ -4,7 +4,7 @@ error: `No` held across a suspend point, but should not be
LL | let no = No {};
| ^^
LL | wheeee(&no).await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:9
diff --git a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr
index 262657da5fe..cd3baa857ab 100644
--- a/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/dedup.drop_tracking_mir.stderr
@@ -4,7 +4,7 @@ error: `No` held across a suspend point, but should not be
LL | let no = No {};
| ^^
LL | wheeee(&no).await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:9
diff --git a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
index 7ed43d25719..aff2f7c32b9 100644
--- a/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/dedup.no_drop_tracking.stderr
@@ -4,7 +4,7 @@ error: `No` held across a suspend point, but should not be
LL | let no = No {};
| ^^
LL | wheeee(&no).await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:9
@@ -21,7 +21,7 @@ error: `No` held across a suspend point, but should not be
--> $DIR/dedup.rs:20:13
|
LL | wheeee(&no).await;
- | ^^ ------ the value is held across this suspend point
+ | ^^ ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:20:13
diff --git a/tests/ui/lint/must_not_suspend/dedup.stderr b/tests/ui/lint/must_not_suspend/dedup.stderr
deleted file mode 100644
index 18880f5a757..00000000000
--- a/tests/ui/lint/must_not_suspend/dedup.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error: `No` held across a suspend point, but should not be
- --> $DIR/dedup.rs:19:13
- |
-LL | wheeee(&No {}).await;
- | ^^^^^ ------ the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/dedup.rs:19:13
- |
-LL | wheeee(&No {}).await;
- | ^^^^^
-note: the lint level is defined here
- --> $DIR/dedup.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/mutex.stderr b/tests/ui/lint/must_not_suspend/mutex.stderr
index c251cb84589..9b5fc37a332 100644
--- a/tests/ui/lint/must_not_suspend/mutex.stderr
+++ b/tests/ui/lint/must_not_suspend/mutex.stderr
@@ -4,7 +4,7 @@ error: `MutexGuard` held across a suspend point, but should not be
LL | let _guard = m.lock().unwrap();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: holding a MutexGuard across suspend points can cause deadlocks, delays, and cause Futures to not implement `Send`
--> $DIR/mutex.rs:8:9
diff --git a/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr b/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
index 180e187c1b0..348880b9c9f 100644
--- a/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/ref-drop-tracking.stderr
@@ -5,7 +5,7 @@ LL | let guard = &mut self.u;
| ^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/ref-drop-tracking.rs:19:13
diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
index e3628ca5e49..fb18c2be9cb 100644
--- a/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/ref.drop_tracking.stderr
@@ -5,7 +5,7 @@ LL | let guard = &mut self.u;
| ^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/ref.rs:22:13
diff --git a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr
index e3628ca5e49..fb18c2be9cb 100644
--- a/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/ref.drop_tracking_mir.stderr
@@ -5,7 +5,7 @@ LL | let guard = &mut self.u;
| ^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/ref.rs:22:13
diff --git a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
index e9bfa08b5dd..6976dd34991 100644
--- a/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/ref.no_drop_tracking.stderr
@@ -5,7 +5,7 @@ LL | let guard = &mut self.u;
| ^^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/ref.rs:22:26
diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr
index 6e62a228a43..8c8ad1f3788 100644
--- a/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/trait.drop_tracking.stderr
@@ -5,7 +5,7 @@ LL | let _guard1 = r#impl();
| ^^^^^^^
...
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/trait.rs:24:9
@@ -25,7 +25,7 @@ LL | let _guard2 = r#dyn();
| ^^^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/trait.rs:25:9
diff --git a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
index 6e62a228a43..8c8ad1f3788 100644
--- a/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/trait.drop_tracking_mir.stderr
@@ -5,7 +5,7 @@ LL | let _guard1 = r#impl();
| ^^^^^^^
...
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/trait.rs:24:9
@@ -25,7 +25,7 @@ LL | let _guard2 = r#dyn();
| ^^^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/trait.rs:25:9
diff --git a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
index 6e62a228a43..8c8ad1f3788 100644
--- a/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/trait.no_drop_tracking.stderr
@@ -5,7 +5,7 @@ LL | let _guard1 = r#impl();
| ^^^^^^^
...
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/trait.rs:24:9
@@ -25,7 +25,7 @@ LL | let _guard2 = r#dyn();
| ^^^^^^^
LL |
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/trait.rs:25:9
diff --git a/tests/ui/lint/must_not_suspend/trait.stderr b/tests/ui/lint/must_not_suspend/trait.stderr
deleted file mode 100644
index 6e62a228a43..00000000000
--- a/tests/ui/lint/must_not_suspend/trait.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error: implementer of `Wow` held across a suspend point, but should not be
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-...
-LL | other().await;
- | ------ the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:24:9
- |
-LL | let _guard1 = r#impl();
- | ^^^^^^^
-note: the lint level is defined here
- --> $DIR/trait.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: boxed `Wow` trait object held across a suspend point, but should not be
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-LL |
-LL | other().await;
- | ------ the value is held across this suspend point
- |
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/trait.rs:25:9
- |
-LL | let _guard2 = r#dyn();
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr
index f89b3e341fd..e24cffdd0df 100644
--- a/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/unit.drop_tracking.stderr
@@ -4,7 +4,7 @@ error: `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/unit.rs:22:9
diff --git a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
index f89b3e341fd..e24cffdd0df 100644
--- a/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/unit.drop_tracking_mir.stderr
@@ -4,7 +4,7 @@ error: `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/unit.rs:22:9
diff --git a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
index f89b3e341fd..e24cffdd0df 100644
--- a/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/unit.no_drop_tracking.stderr
@@ -4,7 +4,7 @@ error: `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/unit.rs:22:9
diff --git a/tests/ui/lint/must_not_suspend/unit.stderr b/tests/ui/lint/must_not_suspend/unit.stderr
deleted file mode 100644
index 50ca292c2f6..00000000000
--- a/tests/ui/lint/must_not_suspend/unit.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-error: `Umm` held across a suspend point, but should not be
- --> $DIR/unit.rs:23:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ------ the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/unit.rs:23:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/unit.rs:23:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/unit.rs:6:9
- |
-LL | #![deny(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
index 7a422891ab1..4f7b40a5efe 100644
--- a/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/warn.drop_tracking.stderr
@@ -4,7 +4,7 @@ warning: `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/warn.rs:24:9
diff --git a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr b/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr
index 7a422891ab1..4f7b40a5efe 100644
--- a/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr
+++ b/tests/ui/lint/must_not_suspend/warn.drop_tracking_mir.stderr
@@ -4,7 +4,7 @@ warning: `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/warn.rs:24:9
diff --git a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
index 7a422891ab1..4f7b40a5efe 100644
--- a/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
+++ b/tests/ui/lint/must_not_suspend/warn.no_drop_tracking.stderr
@@ -4,7 +4,7 @@ warning: `Umm` held across a suspend point, but should not be
LL | let _guard = bar();
| ^^^^^^
LL | other().await;
- | ------ the value is held across this suspend point
+ | ----- the value is held across this suspend point
|
note: You gotta use Umm's, ya know?
--> $DIR/warn.rs:24:9
diff --git a/tests/ui/lint/must_not_suspend/warn.stderr b/tests/ui/lint/must_not_suspend/warn.stderr
deleted file mode 100644
index 7a422891ab1..00000000000
--- a/tests/ui/lint/must_not_suspend/warn.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: `Umm` held across a suspend point, but should not be
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-LL | other().await;
- | ------ the value is held across this suspend point
- |
-note: You gotta use Umm's, ya know?
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
- --> $DIR/warn.rs:24:9
- |
-LL | let _guard = bar();
- | ^^^^^^
-note: the lint level is defined here
- --> $DIR/warn.rs:7:9
- |
-LL | #![warn(must_not_suspend)]
- | ^^^^^^^^^^^^^^^^
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/suggestions/issue-96555.stderr b/tests/ui/suggestions/issue-96555.stderr
index 9a8a183dc2d..1a1e069f09e 100644
--- a/tests/ui/suggestions/issue-96555.stderr
+++ b/tests/ui/suggestions/issue-96555.stderr
@@ -1,8 +1,8 @@
error[E0277]: `()` is not a future
- --> $DIR/issue-96555.rs:4:12
+ --> $DIR/issue-96555.rs:4:13
|
LL | m::f1().await;
- | -------^^^^^^ `()` is not a future
+ | ------- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
@@ -20,10 +20,10 @@ LL | pub async fn f1() {}
| +++++
error[E0277]: `()` is not a future
- --> $DIR/issue-96555.rs:5:12
+ --> $DIR/issue-96555.rs:5:13
|
LL | m::f2().await;
- | -------^^^^^^ `()` is not a future
+ | ------- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
@@ -41,10 +41,10 @@ LL | pub(crate) async fn f2() {}
| +++++
error[E0277]: `()` is not a future
- --> $DIR/issue-96555.rs:6:12
+ --> $DIR/issue-96555.rs:6:13
|
LL | m::f3().await;
- | -------^^^^^^ `()` is not a future
+ | ------- ^^^^^ `()` is not a future
| |
| this call returns `()`
|
diff --git a/tests/ui/traits/unsend-future.stderr b/tests/ui/traits/unsend-future.stderr
index 4aaa7c4a924..6ce1cf452f4 100644
--- a/tests/ui/traits/unsend-future.stderr
+++ b/tests/ui/traits/unsend-future.stderr
@@ -6,12 +6,12 @@ LL | require_handler(handler)
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `*const i32`
note: future is not `Send` as this value is used across an await
- --> $DIR/unsend-future.rs:15:13
+ --> $DIR/unsend-future.rs:15:14
|
LL | let a = &1 as *const i32;
| - has type `*const i32` which is not `Send`
LL | async {}.await;
- | ^^^^^^ await occurs here, with `a` maybe used later
+ | ^^^^^ await occurs here, with `a` maybe used later
LL | }
| - `a` is later dropped here
note: required by a bound in `require_handler`