mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Tweak await span
This commit is contained in:
parent
12a2f24b15
commit
f0fc4f9acf
@ -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>),
|
||||
|
@ -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);
|
||||
|
@ -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, _)
|
||||
|
@ -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);
|
||||
|
@ -185,20 +185,14 @@ 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())
|
||||
ExprKind::Await(expr, await_kw_span) => {
|
||||
let await_kw_span = if expr.span.hi() < await_kw_span.hi() {
|
||||
*await_kw_span
|
||||
} else {
|
||||
// this is a recovered `await expr`
|
||||
e.span
|
||||
};
|
||||
self.lower_expr_await(dot_await_span, expr)
|
||||
self.lower_expr_await(await_kw_span, expr)
|
||||
}
|
||||
ExprKind::Closure(box Closure {
|
||||
binder,
|
||||
@ -710,18 +704,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,
|
||||
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,
|
||||
|
@ -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);
|
||||
|
@ -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");
|
||||
}
|
||||
|
@ -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(_)
|
||||
|
@ -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)
|
||||
|
@ -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"),
|
||||
}
|
||||
@ -3256,7 +3256,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
|
||||
}
|
||||
|
@ -1583,55 +1583,59 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
fn suggest_remove_await(&self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic) {
|
||||
let span = obligation.cause.span;
|
||||
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.
|
||||
|
||||
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.
|
||||
if let hir::Node::Expr(parent_expr) = hir.get_parent(*hir_id)
|
||||
// Peel off the DesugaringKind from the span
|
||||
&& let Some(desugar_parent_span) = parent_expr.span.parent_callsite()
|
||||
{
|
||||
err.span_suggestion(
|
||||
span,
|
||||
self.tcx.sess.source.shrink_to_hi().to(desugar_parent_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()
|
||||
{
|
||||
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
|
||||
);
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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)
|
||||
{
|
||||
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,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
@ -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: {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -162,68 +162,68 @@ LL | let _ = (await bar())?;
|
||||
| ^^^^^^^^^^^ only allowed inside `async` functions and blocks
|
||||
|
||||
error[E0728]: `await` is only allowed inside `async` functions and blocks
|
||||
--> $DIR/incorrect-syntax-suggestions.rs:71: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
|
||||
|
||||
|
28
tests/ui/async-await/clone-suggestion.fixed
Normal file
28
tests/ui/async-await/clone-suggestion.fixed
Normal file
@ -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() {}
|
28
tests/ui/async-await/clone-suggestion.rs
Normal file
28
tests/ui/async-await/clone-suggestion.rs
Normal file
@ -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() {}
|
20
tests/ui/async-await/clone-suggestion.stderr
Normal file
20
tests/ui/async-await/clone-suggestion.stderr
Normal file
@ -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 method call
|
||||
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`.
|
@ -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<_>`
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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`
|
||||
|
@ -1,11 +1,13 @@
|
||||
error[E0277]: `()` is not a future
|
||||
--> $DIR/issue-101715.rs:11:9
|
||||
--> $DIR/issue-101715.rs:11:10
|
||||
|
|
||||
LL | .await
|
||||
| ^^^^^^
|
||||
| |
|
||||
| `()` is not a future
|
||||
| help: remove the `.await`
|
||||
LL | S.very_long_method_name_the_longest_method_name_in_the_whole_universe()
|
||||
| ____________________________________________________________________________-
|
||||
LL | | .await
|
||||
| | ^^^^-
|
||||
| |__________|___|
|
||||
| | help: remove the `.await`
|
||||
| `()` is not a future
|
||||
|
|
||||
= help: the trait `Future` is not implemented for `()`
|
||||
= note: () must be a future or must implement `IntoFuture` to be awaited
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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`
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
@ -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`
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
|
||||
|
@ -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
|
||||
|
@ -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 `()`
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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`
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]`
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 `()`
|
||||
|
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 `()`
|
||||
|
|
||||
|
@ -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`
|
||||
|
Loading…
Reference in New Issue
Block a user