Auto merge of #111040 - matthiaskrgr:rollup-g2sns0f, r=matthiaskrgr

Rollup of 6 pull requests

Successful merges:

 - #110823 (Tweak await span to not contain dot)
 - #111015 (Remove wrong assertion in match checking.)
 - #111023 (Test precise capture with a multi-variant enum and exhaustive patterns)
 - #111032 (Migrate `builtin_macros::asm` diagnostics to translatable diagnostics)
 - #111033 (Ping Nadrieril when changing exhaustiveness checking)
 - #111037 (Close parentheses for `offset_of` in AST pretty printing)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
This commit is contained in:
bors 2023-05-01 03:47:09 +00:00
commit 2034b6d23c
121 changed files with 813 additions and 883 deletions

View File

@ -1430,8 +1430,8 @@ pub enum ExprKind {
/// The async block used to have a `NodeId`, which was removed in favor of /// The async block used to have a `NodeId`, which was removed in favor of
/// using the parent `NodeId` of the parent `Expr`. /// using the parent `NodeId` of the parent `Expr`.
Async(CaptureBy, P<Block>), Async(CaptureBy, P<Block>),
/// An await expression (`my_future.await`). /// An await expression (`my_future.await`). Span is of await keyword.
Await(P<Expr>), Await(P<Expr>, Span),
/// A try block (`try { ... }`). /// A try block (`try { ... }`).
TryBlock(P<Block>), TryBlock(P<Block>),

View File

@ -1415,7 +1415,10 @@ pub fn noop_visit_expr<T: MutVisitor>(
ExprKind::Async(_capture_by, body) => { ExprKind::Async(_capture_by, body) => {
vis.visit_block(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, _) => { ExprKind::Assign(el, er, _) => {
vis.visit_expr(el); vis.visit_expr(el);
vis.visit_expr(er); vis.visit_expr(er);

View File

@ -388,7 +388,7 @@ pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
// X { y: 1 } + X { y: 2 } // X { y: 1 } + X { y: 2 }
contains_exterior_struct_lit(lhs) || contains_exterior_struct_lit(rhs) contains_exterior_struct_lit(lhs) || contains_exterior_struct_lit(rhs)
} }
ast::ExprKind::Await(x) ast::ExprKind::Await(x, _)
| ast::ExprKind::Unary(_, x) | ast::ExprKind::Unary(_, x)
| ast::ExprKind::Cast(x, _) | ast::ExprKind::Cast(x, _)
| ast::ExprKind::Type(x, _) | ast::ExprKind::Type(x, _)

View File

@ -864,7 +864,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) {
ExprKind::Async(_, body) => { ExprKind::Async(_, body) => {
visitor.visit_block(body); visitor.visit_block(body);
} }
ExprKind::Await(expr) => visitor.visit_expr(expr), ExprKind::Await(expr, _) => visitor.visit_expr(expr),
ExprKind::Assign(lhs, rhs, _) => { ExprKind::Assign(lhs, rhs, _) => {
visitor.visit_expr(lhs); visitor.visit_expr(lhs);
visitor.visit_expr(rhs); visitor.visit_expr(rhs);

View File

@ -108,7 +108,7 @@ pub struct BaseExpressionDoubleDot {
pub struct AwaitOnlyInAsyncFnAndBlocks { pub struct AwaitOnlyInAsyncFnAndBlocks {
#[primary_span] #[primary_span]
#[label] #[label]
pub dot_await_span: Span, pub await_kw_span: Span,
#[label(ast_lowering_this_not_async)] #[label(ast_lowering_this_not_async)]
pub item_span: Option<Span>, pub item_span: Option<Span>,
} }

View File

@ -185,21 +185,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
hir::AsyncGeneratorKind::Block, hir::AsyncGeneratorKind::Block,
|this| this.with_new_scopes(|this| this.lower_block_expr(block)), |this| this.with_new_scopes(|this| this.lower_block_expr(block)),
), ),
ExprKind::Await(expr) => { ExprKind::Await(expr, await_kw_span) => self.lower_expr_await(*await_kw_span, expr),
let dot_await_span = if expr.span.hi() < e.span.hi() {
let span_with_whitespace = self
.tcx
.sess
.source_map()
.span_extend_while(expr.span, char::is_whitespace)
.unwrap_or(expr.span);
span_with_whitespace.shrink_to_hi().with_hi(e.span.hi())
} else {
// this is a recovered `await expr`
e.span
};
self.lower_expr_await(dot_await_span, expr)
}
ExprKind::Closure(box Closure { ExprKind::Closure(box Closure {
binder, binder,
capture_clause, capture_clause,
@ -710,18 +696,18 @@ impl<'hir> LoweringContext<'_, 'hir> {
/// } /// }
/// } /// }
/// ``` /// ```
fn lower_expr_await(&mut self, dot_await_span: Span, expr: &Expr) -> hir::ExprKind<'hir> { fn lower_expr_await(&mut self, await_kw_span: Span, expr: &Expr) -> hir::ExprKind<'hir> {
let full_span = expr.span.to(dot_await_span); let full_span = expr.span.to(await_kw_span);
match self.generator_kind { match self.generator_kind {
Some(hir::GeneratorKind::Async(_)) => {} Some(hir::GeneratorKind::Async(_)) => {}
Some(hir::GeneratorKind::Gen) | None => { Some(hir::GeneratorKind::Gen) | None => {
self.tcx.sess.emit_err(AwaitOnlyInAsyncFnAndBlocks { self.tcx.sess.emit_err(AwaitOnlyInAsyncFnAndBlocks {
dot_await_span, await_kw_span,
item_span: self.current_item, 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( let gen_future_span = self.mark_span_with_reason(
DesugaringKind::Await, DesugaringKind::Await,
full_span, full_span,

View File

@ -583,7 +583,7 @@ fn may_contain_yield_point(e: &ast::Expr) -> bool {
impl Visitor<'_> for MayContainYieldPoint { impl Visitor<'_> for MayContainYieldPoint {
fn visit_expr(&mut self, e: &ast::Expr) { 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; self.0 = true;
} else { } else {
visit::walk_expr(self, e); visit::walk_expr(self, e);

View File

@ -447,7 +447,7 @@ impl<'a> State<'a> {
self.ibox(0); self.ibox(0);
self.print_block_with_attrs(blk, attrs); 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.print_expr_maybe_paren(expr, parser::PREC_POSTFIX);
self.word(".await"); self.word(".await");
} }
@ -566,7 +566,7 @@ impl<'a> State<'a> {
self.print_ident(field); self.print_ident(field);
} }
} }
self.pclose();
self.end(); self.end();
} }
ast::ExprKind::MacCall(m) => self.print_mac(m), ast::ExprKind::MacCall(m) => self.print_mac(m),

View File

@ -203,6 +203,15 @@ borrowck_moved_due_to_method_call =
*[false] call *[false] call
} }
borrowck_moved_due_to_await =
{$place_name} {$is_partial ->
[true] partially moved
*[false] moved
} due to this {$is_loop_message ->
[true] await, in previous iteration of loop
*[false] await
}
borrowck_value_moved_here = borrowck_value_moved_here =
value {$is_partial -> value {$is_partial ->
[true] partially moved [true] partially moved

View File

@ -1085,12 +1085,21 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
} }
} }
} else { } else {
err.subdiagnostic(CaptureReasonLabel::MethodCall { if let Some((CallDesugaringKind::Await, _)) = desugaring {
fn_call_span, err.subdiagnostic(CaptureReasonLabel::Await {
place_name: &place_name, fn_call_span,
is_partial, place_name: &place_name,
is_loop_message, is_partial,
}); is_loop_message,
});
} else {
err.subdiagnostic(CaptureReasonLabel::MethodCall {
fn_call_span,
place_name: &place_name,
is_partial,
is_loop_message,
});
}
// Erase and shadow everything that could be passed to the new infcx. // Erase and shadow everything that could be passed to the new infcx.
let ty = moved_place.ty(self.body, tcx).ty; let ty = moved_place.ty(self.body, tcx).ty;

View File

@ -338,6 +338,14 @@ pub(crate) enum CaptureReasonLabel<'a> {
is_partial: bool, is_partial: bool,
is_loop_message: bool, is_loop_message: bool,
}, },
#[label(borrowck_moved_due_to_await)]
Await {
#[primary_span]
fn_call_span: Span,
place_name: &'a str,
is_partial: bool,
is_loop_message: bool,
},
#[label(borrowck_value_moved_here)] #[label(borrowck_value_moved_here)]
MovedHere { MovedHere {
#[primary_span] #[primary_span]

View File

@ -169,5 +169,40 @@ builtin_macros_asm_pure_no_output = asm with the `pure` option must have at leas
builtin_macros_asm_modifier_invalid = asm template modifier must be a single character builtin_macros_asm_modifier_invalid = asm template modifier must be a single character
builtin_macros_asm_requires_template = requires at least a template string argument
builtin_macros_asm_expected_comma = expected token: `,`
.label = expected `,`
builtin_macros_asm_underscore_input = _ cannot be used for input operands
builtin_macros_asm_sym_no_path = expected a path for argument to `sym`
builtin_macros_asm_expected_other = expected operand, {$is_global_asm ->
[true] options
*[false] clobber_abi, options
}, or additional template string
builtin_macros_asm_duplicate_arg = duplicate argument named `{$name}`
.label = previously here
.arg = duplicate argument
builtin_macros_asm_pos_after = positional arguments cannot follow named arguments or explicit register arguments
.pos = positional argument
.named = named argument
.explicit = explicit register argument
builtin_macros_asm_noreturn = asm outputs are not allowed with the `noreturn` option
builtin_macros_global_asm_clobber_abi = `clobber_abi` cannot be used with `global_asm!`
builtin_macros_asm_clobber_no_reg = asm with `clobber_abi` must specify explicit registers for outputs
builtin_macros_asm_clobber_abi = clobber_abi
builtin_macros_asm_clobber_outputs = generic outputs
builtin_macros_asm_opt_already_provided = the `{$symbol}` option was already provided
.label = this option was already provided
.suggestion = remove this option
builtin_macros_test_runner_invalid = `test_runner` argument must be a path builtin_macros_test_runner_invalid = `test_runner` argument must be a path
builtin_macros_test_runner_nargs = `#![test_runner(..)]` accepts exactly 1 argument builtin_macros_test_runner_nargs = `#![test_runner(..)]` accepts exactly 1 argument

View File

@ -3,7 +3,7 @@ use rustc_ast::ptr::P;
use rustc_ast::token::{self, Delimiter}; use rustc_ast::token::{self, Delimiter};
use rustc_ast::tokenstream::TokenStream; use rustc_ast::tokenstream::TokenStream;
use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::{Applicability, PResult}; use rustc_errors::PResult;
use rustc_expand::base::{self, *}; use rustc_expand::base::{self, *};
use rustc_parse::parser::Parser; use rustc_parse::parser::Parser;
use rustc_parse_format as parse; use rustc_parse_format as parse;
@ -49,7 +49,7 @@ pub fn parse_asm_args<'a>(
let diag = &sess.span_diagnostic; let diag = &sess.span_diagnostic;
if p.token == token::Eof { if p.token == token::Eof {
return Err(diag.struct_span_err(sp, "requires at least a template string argument")); return Err(diag.create_err(errors::AsmRequiresTemplate { span: sp }));
} }
let first_template = p.parse_expr()?; let first_template = p.parse_expr()?;
@ -68,8 +68,7 @@ pub fn parse_asm_args<'a>(
if !p.eat(&token::Comma) { if !p.eat(&token::Comma) {
if allow_templates { if allow_templates {
// After a template string, we always expect *only* a comma... // After a template string, we always expect *only* a comma...
let mut err = diag.struct_span_err(p.token.span, "expected token: `,`"); let mut err = diag.create_err(errors::AsmExpectedComma { span: p.token.span });
err.span_label(p.token.span, "expected `,`");
p.maybe_annotate_with_ascription(&mut err, false); p.maybe_annotate_with_ascription(&mut err, false);
return Err(err); return Err(err);
} else { } else {
@ -112,7 +111,7 @@ pub fn parse_asm_args<'a>(
let op = if !is_global_asm && p.eat_keyword(kw::In) { let op = if !is_global_asm && p.eat_keyword(kw::In) {
let reg = parse_reg(p, &mut explicit_reg)?; let reg = parse_reg(p, &mut explicit_reg)?;
if p.eat_keyword(kw::Underscore) { if p.eat_keyword(kw::Underscore) {
let err = diag.struct_span_err(p.token.span, "_ cannot be used for input operands"); let err = diag.create_err(errors::AsmUnderscoreInput { span: p.token.span });
return Err(err); return Err(err);
} }
let expr = p.parse_expr()?; let expr = p.parse_expr()?;
@ -128,7 +127,7 @@ pub fn parse_asm_args<'a>(
} else if !is_global_asm && p.eat_keyword(sym::inout) { } else if !is_global_asm && p.eat_keyword(sym::inout) {
let reg = parse_reg(p, &mut explicit_reg)?; let reg = parse_reg(p, &mut explicit_reg)?;
if p.eat_keyword(kw::Underscore) { if p.eat_keyword(kw::Underscore) {
let err = diag.struct_span_err(p.token.span, "_ cannot be used for input operands"); let err = diag.create_err(errors::AsmUnderscoreInput { span: p.token.span });
return Err(err); return Err(err);
} }
let expr = p.parse_expr()?; let expr = p.parse_expr()?;
@ -142,7 +141,7 @@ pub fn parse_asm_args<'a>(
} else if !is_global_asm && p.eat_keyword(sym::inlateout) { } else if !is_global_asm && p.eat_keyword(sym::inlateout) {
let reg = parse_reg(p, &mut explicit_reg)?; let reg = parse_reg(p, &mut explicit_reg)?;
if p.eat_keyword(kw::Underscore) { if p.eat_keyword(kw::Underscore) {
let err = diag.struct_span_err(p.token.span, "_ cannot be used for input operands"); let err = diag.create_err(errors::AsmUnderscoreInput { span: p.token.span });
return Err(err); return Err(err);
} }
let expr = p.parse_expr()?; let expr = p.parse_expr()?;
@ -160,7 +159,7 @@ pub fn parse_asm_args<'a>(
let expr = p.parse_expr()?; let expr = p.parse_expr()?;
let ast::ExprKind::Path(qself, path) = &expr.kind else { let ast::ExprKind::Path(qself, path) = &expr.kind else {
let err = diag let err = diag
.struct_span_err(expr.span, "expected a path for argument to `sym`"); .create_err(errors::AsmSymNoPath { span: expr.span });
return Err(err); return Err(err);
}; };
let sym = ast::InlineAsmSym { let sym = ast::InlineAsmSym {
@ -181,13 +180,10 @@ pub fn parse_asm_args<'a>(
) => {} ) => {}
ast::ExprKind::MacCall(..) => {} ast::ExprKind::MacCall(..) => {}
_ => { _ => {
let errstr = if is_global_asm { let err = diag.create_err(errors::AsmExpectedOther {
"expected operand, options, or additional template string" span: template.span,
} else { is_global_asm,
"expected operand, clobber_abi, options, or additional template string" });
};
let mut err = diag.struct_span_err(template.span, errstr);
err.span_label(template.span, errstr);
return Err(err); return Err(err);
} }
} }
@ -212,28 +208,16 @@ pub fn parse_asm_args<'a>(
args.reg_args.insert(slot); args.reg_args.insert(slot);
} else if let Some(name) = name { } else if let Some(name) = name {
if let Some(&prev) = args.named_args.get(&name) { if let Some(&prev) = args.named_args.get(&name) {
diag.struct_span_err(span, &format!("duplicate argument named `{}`", name)) diag.emit_err(errors::AsmDuplicateArg { span, name, prev: args.operands[prev].1 });
.span_label(args.operands[prev].1, "previously here")
.span_label(span, "duplicate argument")
.emit();
continue; continue;
} }
args.named_args.insert(name, slot); args.named_args.insert(name, slot);
} else { } else {
if !args.named_args.is_empty() || !args.reg_args.is_empty() { if !args.named_args.is_empty() || !args.reg_args.is_empty() {
let mut err = diag.struct_span_err( let named = args.named_args.values().map(|p| args.operands[*p].1).collect();
span, let explicit = args.reg_args.iter().map(|p| args.operands[*p].1).collect();
"positional arguments cannot follow named arguments \
or explicit register arguments", diag.emit_err(errors::AsmPositionalAfter { span, named, explicit });
);
err.span_label(span, "positional argument");
for pos in args.named_args.values() {
err.span_label(args.operands[*pos].1, "named argument");
}
for pos in &args.reg_args {
err.span_label(args.operands[*pos].1, "explicit register argument");
}
err.emit();
} }
} }
} }
@ -284,34 +268,25 @@ pub fn parse_asm_args<'a>(
diag.emit_err(errors::AsmPureNoOutput { spans: args.options_spans.clone() }); diag.emit_err(errors::AsmPureNoOutput { spans: args.options_spans.clone() });
} }
if args.options.contains(ast::InlineAsmOptions::NORETURN) && !outputs_sp.is_empty() { if args.options.contains(ast::InlineAsmOptions::NORETURN) && !outputs_sp.is_empty() {
let err = diag let err = diag.create_err(errors::AsmNoReturn { outputs_sp });
.struct_span_err(outputs_sp, "asm outputs are not allowed with the `noreturn` option");
// Bail out now since this is likely to confuse MIR // Bail out now since this is likely to confuse MIR
return Err(err); return Err(err);
} }
if args.clobber_abis.len() > 0 { if args.clobber_abis.len() > 0 {
if is_global_asm { if is_global_asm {
let err = diag.struct_span_err( let err = diag.create_err(errors::GlobalAsmClobberAbi {
args.clobber_abis.iter().map(|(_, span)| *span).collect::<Vec<Span>>(), spans: args.clobber_abis.iter().map(|(_, span)| *span).collect(),
"`clobber_abi` cannot be used with `global_asm!`", });
);
// Bail out now since this is likely to confuse later stages // Bail out now since this is likely to confuse later stages
return Err(err); return Err(err);
} }
if !regclass_outputs.is_empty() { if !regclass_outputs.is_empty() {
diag.struct_span_err( diag.emit_err(errors::AsmClobberNoReg {
regclass_outputs.clone(), spans: regclass_outputs,
"asm with `clobber_abi` must specify explicit registers for outputs", clobbers: args.clobber_abis.iter().map(|(_, span)| *span).collect(),
) });
.span_labels(
args.clobber_abis.iter().map(|(_, span)| *span).collect::<Vec<Span>>(),
"clobber_abi",
)
.span_labels(regclass_outputs, "generic outputs")
.emit();
} }
} }
@ -323,25 +298,9 @@ pub fn parse_asm_args<'a>(
/// This function must be called immediately after the option token is parsed. /// This function must be called immediately after the option token is parsed.
/// Otherwise, the suggestion will be incorrect. /// Otherwise, the suggestion will be incorrect.
fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) { fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) {
let mut err = p
.sess
.span_diagnostic
.struct_span_err(span, &format!("the `{}` option was already provided", symbol));
err.span_label(span, "this option was already provided");
// Tool-only output // Tool-only output
let mut full_span = span; let full_span = if p.token.kind == token::Comma { span.to(p.token.span) } else { span };
if p.token.kind == token::Comma { p.sess.span_diagnostic.emit_err(errors::AsmOptAlreadyprovided { span, symbol, full_span });
full_span = full_span.to(p.token.span);
}
err.tool_only_span_suggestion(
full_span,
"remove this option",
"",
Applicability::MachineApplicable,
);
err.emit();
} }
/// Try to set the provided option in the provided `AsmArgs`. /// Try to set the provided option in the provided `AsmArgs`.

View File

@ -288,7 +288,7 @@ impl<'cx, 'a> Context<'cx, 'a> {
ExprKind::Assign(_, _, _) ExprKind::Assign(_, _, _)
| ExprKind::AssignOp(_, _, _) | ExprKind::AssignOp(_, _, _)
| ExprKind::Async(_, _) | ExprKind::Async(_, _)
| ExprKind::Await(_) | ExprKind::Await(_, _)
| ExprKind::Block(_, _) | ExprKind::Block(_, _)
| ExprKind::Break(_, _) | ExprKind::Break(_, _)
| ExprKind::Closure(_) | ExprKind::Closure(_)

View File

@ -1,5 +1,6 @@
use rustc_errors::{ use rustc_errors::{
AddToDiagnostic, EmissionGuarantee, IntoDiagnostic, MultiSpan, SingleLabelManySpans, AddToDiagnostic, DiagnosticBuilder, EmissionGuarantee, Handler, IntoDiagnostic, MultiSpan,
SingleLabelManySpans,
}; };
use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_macros::{Diagnostic, Subdiagnostic};
use rustc_span::{symbol::Ident, Span, Symbol}; use rustc_span::{symbol::Ident, Span, Symbol};
@ -370,11 +371,12 @@ pub(crate) struct EnvNotDefined {
// Hand-written implementation to support custom user messages // Hand-written implementation to support custom user messages
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for EnvNotDefined { impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for EnvNotDefined {
#[track_caller] #[track_caller]
fn into_diagnostic( fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, G> {
self,
handler: &'a rustc_errors::Handler,
) -> rustc_errors::DiagnosticBuilder<'a, G> {
let mut diag = if let Some(msg) = self.msg { let mut diag = if let Some(msg) = self.msg {
#[expect(
rustc::untranslatable_diagnostic,
reason = "cannot translate user-provided messages"
)]
handler.struct_diagnostic(msg.as_str()) handler.struct_diagnostic(msg.as_str())
} else { } else {
handler.struct_diagnostic(crate::fluent_generated::builtin_macros_env_not_defined) handler.struct_diagnostic(crate::fluent_generated::builtin_macros_env_not_defined)
@ -606,6 +608,117 @@ pub(crate) struct AsmModifierInvalid {
pub(crate) span: Span, pub(crate) span: Span,
} }
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_requires_template)]
pub(crate) struct AsmRequiresTemplate {
#[primary_span]
pub(crate) span: Span,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_expected_comma)]
pub(crate) struct AsmExpectedComma {
#[primary_span]
#[label]
pub(crate) span: Span,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_underscore_input)]
pub(crate) struct AsmUnderscoreInput {
#[primary_span]
pub(crate) span: Span,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_sym_no_path)]
pub(crate) struct AsmSymNoPath {
#[primary_span]
pub(crate) span: Span,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_expected_other)]
pub(crate) struct AsmExpectedOther {
#[primary_span]
#[label(builtin_macros_asm_expected_other)]
pub(crate) span: Span,
pub(crate) is_global_asm: bool,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_duplicate_arg)]
pub(crate) struct AsmDuplicateArg {
#[primary_span]
#[label(builtin_macros_arg)]
pub(crate) span: Span,
#[label]
pub(crate) prev: Span,
pub(crate) name: Symbol,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_pos_after)]
pub(crate) struct AsmPositionalAfter {
#[primary_span]
#[label(builtin_macros_pos)]
pub(crate) span: Span,
#[label(builtin_macros_named)]
pub(crate) named: Vec<Span>,
#[label(builtin_macros_explicit)]
pub(crate) explicit: Vec<Span>,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_noreturn)]
pub(crate) struct AsmNoReturn {
#[primary_span]
pub(crate) outputs_sp: Vec<Span>,
}
#[derive(Diagnostic)]
#[diag(builtin_macros_global_asm_clobber_abi)]
pub(crate) struct GlobalAsmClobberAbi {
#[primary_span]
pub(crate) spans: Vec<Span>,
}
pub(crate) struct AsmClobberNoReg {
pub(crate) spans: Vec<Span>,
pub(crate) clobbers: Vec<Span>,
}
impl<'a, G: EmissionGuarantee> IntoDiagnostic<'a, G> for AsmClobberNoReg {
fn into_diagnostic(self, handler: &'a Handler) -> DiagnosticBuilder<'a, G> {
let mut diag =
handler.struct_diagnostic(crate::fluent_generated::builtin_macros_asm_clobber_no_reg);
diag.set_span(self.spans.clone());
// eager translation as `span_labels` takes `AsRef<str>`
let lbl1 = handler.eagerly_translate_to_string(
crate::fluent_generated::builtin_macros_asm_clobber_abi,
[].into_iter(),
);
diag.span_labels(self.clobbers, &lbl1);
let lbl2 = handler.eagerly_translate_to_string(
crate::fluent_generated::builtin_macros_asm_clobber_outputs,
[].into_iter(),
);
diag.span_labels(self.spans, &lbl2);
diag
}
}
#[derive(Diagnostic)]
#[diag(builtin_macros_asm_opt_already_provided)]
pub(crate) struct AsmOptAlreadyprovided {
#[primary_span]
#[label]
pub(crate) span: Span,
pub(crate) symbol: Symbol,
#[suggestion(code = "", applicability = "machine-applicable", style = "tool-only")]
pub(crate) full_span: Span,
}
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(builtin_macros_test_runner_invalid)] #[diag(builtin_macros_test_runner_invalid)]
pub(crate) struct TestRunnerInvalid { pub(crate) struct TestRunnerInvalid {

View File

@ -184,6 +184,9 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
CallDesugaringKind::TryBlockFromOutput => { CallDesugaringKind::TryBlockFromOutput => {
error!("`try` block cannot convert `{}` to the result in {}s") error!("`try` block cannot convert `{}` to the result in {}s")
} }
CallDesugaringKind::Await => {
error!("cannot convert `{}` into a future in {}s")
}
}; };
diag_trait(&mut err, self_ty, kind.trait_def_id(tcx)); diag_trait(&mut err, self_ty, kind.trait_def_id(tcx));

View File

@ -19,6 +19,8 @@ pub enum CallDesugaringKind {
QuestionFromResidual, QuestionFromResidual,
/// try { ..; x } calls type_of(x)::from_output(x) /// try { ..; x } calls type_of(x)::from_output(x)
TryBlockFromOutput, TryBlockFromOutput,
/// `.await` calls `IntoFuture::into_future`
Await,
} }
impl CallDesugaringKind { impl CallDesugaringKind {
@ -29,6 +31,7 @@ impl CallDesugaringKind {
tcx.require_lang_item(LangItem::Try, None) tcx.require_lang_item(LangItem::Try, None)
} }
Self::QuestionFromResidual => tcx.get_diagnostic_item(sym::FromResidual).unwrap(), Self::QuestionFromResidual => tcx.get_diagnostic_item(sym::FromResidual).unwrap(),
Self::Await => tcx.get_diagnostic_item(sym::IntoFuture).unwrap(),
} }
} }
} }
@ -129,6 +132,8 @@ pub fn call_kind<'tcx>(
&& fn_call_span.desugaring_kind() == Some(DesugaringKind::TryBlock) && fn_call_span.desugaring_kind() == Some(DesugaringKind::TryBlock)
{ {
Some((CallDesugaringKind::TryBlockFromOutput, method_substs.type_at(0))) Some((CallDesugaringKind::TryBlockFromOutput, method_substs.type_at(0)))
} else if fn_call_span.is_desugaring(DesugaringKind::Await) {
Some((CallDesugaringKind::Await, method_substs.type_at(0)))
} else { } else {
None None
}; };

View File

@ -334,9 +334,6 @@ impl<'p, 'tcx> MatchVisitor<'_, 'p, 'tcx> {
let refutable = !is_let_irrefutable(&mut ncx, local_lint_level, tpat); let refutable = !is_let_irrefutable(&mut ncx, local_lint_level, tpat);
Some((expr.span, refutable)) Some((expr.span, refutable))
} }
ExprKind::LogicalOp { op: LogicalOp::And, .. } => {
bug!()
}
_ => None, _ => None,
} }
}; };

View File

@ -1646,7 +1646,7 @@ impl<'a> Parser<'a> {
// Avoid knock-down errors as we don't know whether to interpret this as `foo().await?` // 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 😅). // or `foo()?.await` (the very reason we went with postfix syntax 😅).
ExprKind::Try(_) => ExprKind::Err, ExprKind::Try(_) => ExprKind::Err,
_ => ExprKind::Await(expr), _ => ExprKind::Await(expr, await_sp),
}; };
let expr = self.mk_expr(lo.to(sp), kind); let expr = self.mk_expr(lo.to(sp), kind);
self.maybe_recover_from_bad_qpath(expr) self.maybe_recover_from_bad_qpath(expr)

View File

@ -859,7 +859,7 @@ impl<'a> Parser<'a> {
ExprKind::Field(_, _) => "a field access", ExprKind::Field(_, _) => "a field access",
ExprKind::MethodCall(_) => "a method call", ExprKind::MethodCall(_) => "a method call",
ExprKind::Call(_, _) => "a function call", ExprKind::Call(_, _) => "a function call",
ExprKind::Await(_) => "`.await`", ExprKind::Await(_, _) => "`.await`",
ExprKind::Err => return Ok(with_postfix), ExprKind::Err => return Ok(with_postfix),
_ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"), _ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
} }
@ -3252,7 +3252,7 @@ impl<'a> Parser<'a> {
fn mk_await_expr(&mut self, self_arg: P<Expr>, lo: Span) -> P<Expr> { fn mk_await_expr(&mut self, self_arg: P<Expr>, lo: Span) -> P<Expr> {
let span = lo.to(self.prev_token.span); 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(); self.recover_from_await_method_call();
await_expr await_expr
} }

View File

@ -207,6 +207,7 @@ symbols! {
Input, Input,
Into, Into,
IntoDiagnostic, IntoDiagnostic,
IntoFuture,
IntoIterator, IntoIterator,
IoRead, IoRead,
IoWrite, IoWrite,

View File

@ -1583,55 +1583,68 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
} }
fn suggest_remove_await(&self, obligation: &PredicateObligation<'tcx>, err: &mut Diagnostic) { 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() { // use nth(1) to skip one layer of desugaring from `IntoIter::into_iter`
let hir = self.tcx.hir(); if let Some((_, hir::Node::Expr(await_expr))) = hir.parent_iter(*hir_id).nth(1)
if let Some(hir::Node::Expr(expr)) = hir_id.and_then(|hir_id| hir.find(hir_id)) { && let Some(expr_span) = expr.span.find_ancestor_inside(await_expr.span)
// 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 let removal_span = self.tcx
// could also check if it is an fn call (very likely) and suggest changing *that*, if .sess
// it is from the local crate. .source_map()
.span_extend_while(expr_span, char::is_whitespace)
.unwrap_or(expr_span)
.shrink_to_hi()
.to(await_expr.span.shrink_to_hi());
err.span_suggestion( err.span_suggestion(
span, removal_span,
"remove the `.await`", "remove the `.await`",
"", "",
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
// FIXME: account for associated `async fn`s. } else {
if let hir::Expr { span, kind: hir::ExprKind::Call(base, _), .. } = expr { err.span_label(obligation.cause.span, "remove the `.await`");
if let ty::PredicateKind::Clause(ty::Clause::Trait(pred)) = }
obligation.predicate.kind().skip_binder() // FIXME: account for associated `async fn`s.
{ if let hir::Expr { span, kind: hir::ExprKind::Call(base, _), .. } = expr {
err.span_label(*span, &format!("this call returns `{}`", pred.self_ty())); if let ty::PredicateKind::Clause(ty::Clause::Trait(pred)) =
} obligation.predicate.kind().skip_binder()
if let Some(typeck_results) = &self.typeck_results {
&& let ty = typeck_results.expr_ty_adjusted(base) err.span_label(*span, &format!("this call returns `{}`", pred.self_ty()));
&& 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,
);
}
}
} }
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,
);
}
}
} }
} }
} }

View File

@ -99,6 +99,7 @@ use crate::future::Future;
/// } /// }
/// ``` /// ```
#[stable(feature = "into_future", since = "1.64.0")] #[stable(feature = "into_future", since = "1.64.0")]
#[rustc_diagnostic_item = "IntoFuture"]
pub trait IntoFuture { pub trait IntoFuture {
/// The output that the future will produce on completion. /// The output that the future will produce on completion.
#[stable(feature = "into_future", since = "1.64.0")] #[stable(feature = "into_future", since = "1.64.0")]

View File

@ -577,7 +577,7 @@ fn ident_difference_expr_with_base_location(
| (AssignOp(_, _, _), AssignOp(_, _, _)) | (AssignOp(_, _, _), AssignOp(_, _, _))
| (Assign(_, _, _), Assign(_, _, _)) | (Assign(_, _, _), Assign(_, _, _))
| (TryBlock(_), TryBlock(_)) | (TryBlock(_), TryBlock(_))
| (Await(_), Await(_)) | (Await(_, _), Await(_, _))
| (Async(_, _), Async(_, _)) | (Async(_, _), Async(_, _))
| (Block(_, _), Block(_, _)) | (Block(_, _), Block(_, _))
| (Closure(_), Closure(_)) | (Closure(_), Closure(_))

View File

@ -143,7 +143,7 @@ pub fn eq_expr(l: &Expr, r: &Expr) -> bool {
(Paren(l), _) => eq_expr(l, r), (Paren(l), _) => eq_expr(l, r),
(_, Paren(r)) => eq_expr(l, r), (_, Paren(r)) => eq_expr(l, r),
(Err, Err) => true, (Err, Err) => true,
(Try(l), Try(r)) | (Await(l), Await(r)) => eq_expr(l, r), (Try(l), Try(r)) | (Await(l, _), Await(r, _)) => eq_expr(l, r),
(Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)), (Array(l), Array(r)) => over(l, r, |l, r| eq_expr(l, r)),
(Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)), (Tup(l), Tup(r)) => over(l, r, |l, r| eq_expr(l, r)),
(Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value), (Repeat(le, ls), Repeat(re, rs)) => eq_expr(le, re) && eq_expr(&ls.value, &rs.value),

View File

@ -5,22 +5,22 @@ LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ^^^^ future returned by `private_future` is not `Send` | ^^^^ future returned by `private_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:8:19 --> $DIR/future_not_send.rs:8:20
| |
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| -- has type `std::rc::Rc<[u8]>` which is not `Send` | -- has type `std::rc::Rc<[u8]>` which is not `Send`
LL | async { true }.await LL | async { true }.await
| ^^^^^^ await occurs here, with `rc` maybe used later | ^^^^^ await occurs here, with `rc` maybe used later
LL | } LL | }
| - `rc` is later dropped here | - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:8:19 --> $DIR/future_not_send.rs:8:20
| |
LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool { LL | async fn private_future(rc: Rc<[u8]>, cell: &Cell<usize>) -> bool {
| ---- has type `&std::cell::Cell<usize>` which is not `Send` | ---- has type `&std::cell::Cell<usize>` which is not `Send`
LL | async { true }.await LL | async { true }.await
| ^^^^^^ await occurs here, with `cell` maybe used later | ^^^^^ await occurs here, with `cell` maybe used later
LL | } LL | }
| - `cell` is later dropped here | - `cell` is later dropped here
= note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync` = note: `std::cell::Cell<usize>` doesn't implement `std::marker::Sync`
@ -33,12 +33,12 @@ LL | pub async fn public_future(rc: Rc<[u8]>) {
| ^ future returned by `public_future` is not `Send` | ^ future returned by `public_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:12:19 --> $DIR/future_not_send.rs:12:20
| |
LL | pub async fn public_future(rc: Rc<[u8]>) { LL | pub async fn public_future(rc: Rc<[u8]>) {
| -- has type `std::rc::Rc<[u8]>` which is not `Send` | -- has type `std::rc::Rc<[u8]>` which is not `Send`
LL | async { true }.await; LL | async { true }.await;
| ^^^^^^ await occurs here, with `rc` maybe used later | ^^^^^ await occurs here, with `rc` maybe used later
LL | } LL | }
| - `rc` is later dropped here | - `rc` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Send`
@ -82,12 +82,12 @@ LL | async fn private_future(&self) -> usize {
| ^^^^^ future returned by `private_future` is not `Send` | ^^^^^ future returned by `private_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:35:23 --> $DIR/future_not_send.rs:35:24
| |
LL | async fn private_future(&self) -> usize { LL | async fn private_future(&self) -> usize {
| ----- has type `&Dummy` which is not `Send` | ----- has type `&Dummy` which is not `Send`
LL | async { true }.await; LL | async { true }.await;
| ^^^^^^ await occurs here, with `&self` maybe used later | ^^^^^ await occurs here, with `&self` maybe used later
LL | self.rc.len() LL | self.rc.len()
LL | } LL | }
| - `&self` is later dropped here | - `&self` is later dropped here
@ -100,12 +100,12 @@ LL | pub async fn public_future(&self) {
| ^ future returned by `public_future` is not `Send` | ^ future returned by `public_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:40:30 --> $DIR/future_not_send.rs:40:31
| |
LL | pub async fn public_future(&self) { LL | pub async fn public_future(&self) {
| ----- has type `&Dummy` which is not `Send` | ----- has type `&Dummy` which is not `Send`
LL | self.private_future().await; LL | self.private_future().await;
| ^^^^^^ await occurs here, with `&self` maybe used later | ^^^^^ await occurs here, with `&self` maybe used later
LL | } LL | }
| - `&self` is later dropped here | - `&self` is later dropped here
= note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync` = note: `std::rc::Rc<[u8]>` doesn't implement `std::marker::Sync`
@ -117,12 +117,12 @@ LL | async fn generic_future<T>(t: T) -> T
| ^ future returned by `generic_future` is not `Send` | ^ future returned by `generic_future` is not `Send`
| |
note: future is not `Send` as this value is used across an await note: future is not `Send` as this value is used across an await
--> $DIR/future_not_send.rs:54:19 --> $DIR/future_not_send.rs:54:20
| |
LL | let rt = &t; LL | let rt = &t;
| -- has type `&T` which is not `Send` | -- has type `&T` which is not `Send`
LL | async { true }.await; LL | async { true }.await;
| ^^^^^^ await occurs here, with `rt` maybe used later | ^^^^^ await occurs here, with `rt` maybe used later
LL | t LL | t
LL | } LL | }
| - `rt` is later dropped here | - `rt` is later dropped here

View File

@ -232,7 +232,7 @@ impl ChainItemKind {
let span = mk_sp(nested.span.hi(), field.span.hi()); let span = mk_sp(nested.span.hi(), field.span.hi());
(kind, span) (kind, span)
} }
ast::ExprKind::Await(ref nested) => { ast::ExprKind::Await(ref nested, _) => {
let span = mk_sp(nested.span.hi(), expr.span.hi()); let span = mk_sp(nested.span.hi(), expr.span.hi());
(ChainItemKind::Await, span) (ChainItemKind::Await, span)
} }
@ -459,7 +459,7 @@ impl Chain {
ast::ExprKind::MethodCall(ref call) => Some(Self::convert_try(&call.receiver, context)), ast::ExprKind::MethodCall(ref call) => Some(Self::convert_try(&call.receiver, context)),
ast::ExprKind::Field(ref subexpr, _) ast::ExprKind::Field(ref subexpr, _)
| ast::ExprKind::Try(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, _ => None,
} }
} }

View File

@ -218,7 +218,7 @@ pub(crate) fn format_expr(
ast::ExprKind::Try(..) ast::ExprKind::Try(..)
| ast::ExprKind::Field(..) | ast::ExprKind::Field(..)
| ast::ExprKind::MethodCall(..) | ast::ExprKind::MethodCall(..)
| ast::ExprKind::Await(_) => rewrite_chain(expr, context, shape), | ast::ExprKind::Await(_, _) => rewrite_chain(expr, context, shape),
ast::ExprKind::MacCall(ref mac) => { ast::ExprKind::MacCall(ref mac) => {
rewrite_macro(mac, None, context, shape, MacroPosition::Expression).or_else(|| { rewrite_macro(mac, None, context, shape, MacroPosition::Expression).or_else(|| {
wrap_str( wrap_str(
@ -1889,7 +1889,7 @@ impl<'ast> RhsAssignKind<'ast> {
ast::ExprKind::Try(..) ast::ExprKind::Try(..)
| ast::ExprKind::Field(..) | ast::ExprKind::Field(..)
| ast::ExprKind::MethodCall(..) | ast::ExprKind::MethodCall(..)
| ast::ExprKind::Await(_) | ast::ExprKind::Await(_, _)
) )
} }
_ => false, _ => false,

View File

@ -4,7 +4,7 @@
_0: GeneratorSavedTy { _0: GeneratorSavedTy {
ty: impl std::future::Future<Output = ()>, ty: impl std::future::Future<Output = ()>,
source_info: SourceInfo { 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], scope: scope[0],
}, },
ignore_for_traits: false, ignore_for_traits: false,
@ -12,7 +12,7 @@
_1: GeneratorSavedTy { _1: GeneratorSavedTy {
ty: impl std::future::Future<Output = ()>, ty: impl std::future::Future<Output = ()>,
source_info: SourceInfo { source_info: SourceInfo {
span: $DIR/async_await.rs:16:8: 16:14 (#10), span: $DIR/async_await.rs:16:9: 16:14 (#10),
scope: scope[0], scope: scope[0],
}, },
ignore_for_traits: false, 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 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 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 _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 _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 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 _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:8: +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:8: +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:8: +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:8: +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 _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 _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 _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:8: +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 _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 _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:8: +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:8: +2: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 _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 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:8: +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:8: +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:8: +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:8: +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:8: +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 _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 _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 _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:8: +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 _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 _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:8: +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 _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 _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 let mut _39: u32; // in scope 0 at $DIR/async_await.rs:+0:18: +3:2
scope 1 { 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 let _17: (); // in scope 1 at $DIR/async_await.rs:+1:5: +1:14
scope 2 { 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 { 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 let _33: (); // in scope 4 at $DIR/async_await.rs:+2:5: +2:14
scope 5 { 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: { bb1: {
_38 = move _2; // scope 0 at $DIR/async_await.rs:+0:18: +3:2 _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(_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 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 _5 = a() -> [return: bb2, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+1:5: +1:8
// mir::Constant // 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: { 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 // 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>) } // + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
} }
bb3: { bb3: {
StorageDead(_5); // scope 0 at $DIR/async_await.rs:+1:13: +1:14 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 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: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:9: +1:14
goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
} }
bb4: { bb4: {
StorageLive(_8); // scope 1 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:8: +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:8: +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:8: +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:8: +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: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:9: +1:14
_11 = &mut (*_12); // scope 2 at $DIR/async_await.rs:+1:8: +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: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:9: +1:14
// mir::Constant // 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>) } // + 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 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(_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(_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 StorageLive(_15); // scope 2 at $DIR/async_await.rs:+1:9: +1:14
_15 = _38; // scope 2 at $DIR/async_await.rs:+1:8: +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 _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 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: { bb6: {
_13 = &mut (*_14); // scope 2 at $DIR/async_await.rs:+1:5: +1:14 _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 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 // 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>) } // + 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: { bb7: {
StorageDead(_13); // scope 2 at $DIR/async_await.rs:+1:13: +1:14 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 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 _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:8: +1:14 switchInt(move _16) -> [0: bb10, 1: bb8, otherwise: bb9]; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
} }
bb8: { 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(_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(_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(_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 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(_19); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:8: +1:14 StorageLive(_20); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
_20 = (); // scope 1 at $DIR/async_await.rs:+1:8: +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:8: +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: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:9: +1:14
return; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 return; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
} }
bb9: { 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: { bb10: {
@ -190,10 +190,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb11: { bb11: {
StorageDead(_20); // scope 1 at $DIR/async_await.rs:+1:13: +1:14 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 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 _7 = const (); // scope 1 at $DIR/async_await.rs:+1:9: +1:14
goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:8: +1:14 goto -> bb4; // scope 1 at $DIR/async_await.rs:+1:9: +1:14
} }
bb12: { bb12: {
@ -204,7 +204,7 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb13: { bb13: {
StorageDead(_4); // scope 0 at $DIR/async_await.rs:+1:14: +1:15 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 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 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 _22 = a() -> [return: bb14, unwind unreachable]; // scope 0 at $DIR/async_await.rs:+2:5: +2:8
// mir::Constant // 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: { 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 // 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>) } // + literal: Const { ty: fn(impl Future<Output = ()>) -> <impl Future<Output = ()> as IntoFuture>::IntoFuture {<impl Future<Output = ()> as IntoFuture>::into_future}, val: Value(<ZST>) }
} }
bb15: { bb15: {
StorageDead(_22); // scope 0 at $DIR/async_await.rs:+2:13: +2:14 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 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: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:9: +2:14
goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
} }
bb16: { bb16: {
StorageLive(_24); // scope 4 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:8: +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:8: +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:8: +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:8: +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: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:9: +2:14
_27 = &mut (*_28); // scope 5 at $DIR/async_await.rs:+2:8: +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: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:9: +2:14
// mir::Constant // 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>) } // + 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 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(_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(_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 StorageLive(_31); // scope 5 at $DIR/async_await.rs:+2:9: +2:14
_31 = _38; // scope 5 at $DIR/async_await.rs:+2:8: +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 _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 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: { bb18: {
_29 = &mut (*_30); // scope 5 at $DIR/async_await.rs:+2:5: +2:14 _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 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 // 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>) } // + 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: { bb19: {
StorageDead(_29); // scope 5 at $DIR/async_await.rs:+2:13: +2:14 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 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 _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:8: +2:14 switchInt(move _32) -> [0: bb21, 1: bb20, otherwise: bb9]; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
} }
bb20: { 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(_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(_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(_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 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(_35); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:8: +2:14 StorageLive(_36); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
_36 = (); // scope 4 at $DIR/async_await.rs:+2:8: +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:8: +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: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:9: +2:14
return; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 return; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
} }
bb21: { bb21: {
@ -294,10 +294,10 @@ fn b::{closure#0}(_1: Pin<&mut [async fn body@$DIR/async_await.rs:14:18: 17:2]>,
bb22: { bb22: {
StorageDead(_36); // scope 4 at $DIR/async_await.rs:+2:13: +2:14 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 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 _7 = const (); // scope 4 at $DIR/async_await.rs:+2:9: +2:14
goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:8: +2:14 goto -> bb16; // scope 4 at $DIR/async_await.rs:+2:9: +2:14
} }
bb23: { bb23: {

View File

@ -0,0 +1,4 @@
// pp-exact
#![feature(offset_of)]
fn main() { std::mem::offset_of!(std :: ops :: Range < usize >, end); }

View File

@ -6,12 +6,12 @@ LL | is_send(foo(Some(true)));
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` = 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 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(()); LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await LL | bar().await
| ^^^^^^ await occurs here, with `r` maybe used later | ^^^^^ await occurs here, with `r` maybe used later
LL | }; LL | };
| - `r` is later dropped here | - `r` is later dropped here
note: required by a bound in `is_send` 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<()>` = 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 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); LL | (Rc::new(()), bar().await);
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here | ----------- ^^^^^ - `Rc::new(())` is later dropped here
| | | | | |
| | 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` | has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $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<()>` = 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 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(()); LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await; LL | bar().await;
| ^^^^^^ await occurs here, with `r` maybe used later | ^^^^^ await occurs here, with `r` maybe used later
... ...
LL | }; LL | };
| - `r` is later dropped here | - `r` is later dropped here

View File

@ -6,12 +6,12 @@ LL | is_send(foo(Some(true)));
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` = 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 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(()); LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await 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` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $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<()>` = 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 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); 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` | has type `Rc<()>` which is not `Send`
note: required by a bound in `is_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<()>` = 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 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(()); LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await; 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` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $DIR/async-await-let-else.rs:19:15
| |

View File

@ -6,12 +6,12 @@ LL | is_send(foo(Some(true)));
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` = 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 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(()); LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await LL | bar().await
| ^^^^^^ await occurs here, with `r` maybe used later | ^^^^^ await occurs here, with `r` maybe used later
LL | }; LL | };
| - `r` is later dropped here | - `r` is later dropped here
note: required by a bound in `is_send` 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<()>` = 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 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 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` | has type `Rc<()>` which is not `Send`
LL | }; LL | };
@ -50,12 +50,12 @@ LL | is_send(foo3(Some(true)));
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` = 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 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); LL | (Rc::new(()), bar().await);
| ----------- ^^^^^^ - `Rc::new(())` is later dropped here | ----------- ^^^^^ - `Rc::new(())` is later dropped here
| | | | | |
| | 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` | has type `Rc<()>` which is not `Send`
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/async-await-let-else.rs:19:15 --> $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<()>` = 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 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(()); LL | let r = Rc::new(());
| - has type `Rc<()>` which is not `Send` | - has type `Rc<()>` which is not `Send`
LL | bar().await; LL | bar().await;
| ^^^^^^ await occurs here, with `r` maybe used later | ^^^^^ await occurs here, with `r` maybe used later
... ...
LL | }; LL | };
| - `r` is later dropped here | - `r` is later dropped here

View File

@ -14,10 +14,10 @@ LL | let a;
| ^ cannot infer type | ^ cannot infer type
| |
note: the type is part of the `async fn` body because of this `await` 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; LL | get_future().await;
| ^^^^^^ | ^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -14,10 +14,10 @@ LL | let a;
| ^ cannot infer type | ^ cannot infer type
| |
note: the type is part of the `async fn` body because of this `await` 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; LL | get_future().await;
| ^^^^^^ | ^^^^^
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -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<()>` = 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 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()) { LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send` | ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await, 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 | } LL | }
| - `Some(non_send())` is later dropped here | - `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` = 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 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(); LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send` | --------------- has type `Formatter<'_>` which is not `Send`
... ...
LL | fut().await; LL | fut().await;
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later | ^^^^^ await occurs here, with `get_formatter()` maybe used later
LL | } LL | }
LL | } LL | }
| - `get_formatter()` is later dropped here | - `get_formatter()` is later dropped here

View File

@ -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<()>` = 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 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()) { LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send` | ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await, 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` note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24 --> $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` = 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 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(); LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send` | --------------- has type `Formatter<'_>` which is not `Send`
... ...
LL | fut().await; 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` note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24 --> $DIR/async-fn-nonsend.rs:67:24
| |

View File

@ -6,13 +6,13 @@ LL | assert_send(local_dropped_before_await());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>` = 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 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(); LL | let x = non_send();
| - has type `impl Debug` which is not `Send` | - has type `impl Debug` which is not `Send`
LL | drop(x); LL | drop(x);
LL | fut().await; LL | fut().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here
note: required by a bound in `assert_send` 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<()>` = 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 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()) { LL | match Some(non_send()) {
| ---------- has type `impl Debug` which is not `Send` | ---------- has type `impl Debug` which is not `Send`
LL | Some(_) => fut().await, LL | Some(_) => fut().await,
| ^^^^^^ await occurs here, with `non_send()` maybe used later | ^^^^^ await occurs here, with `non_send()` maybe used later
... ...
LL | } LL | }
| - `non_send()` is later dropped here | - `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` = 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 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(); LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send` | --------------- has type `Formatter<'_>` which is not `Send`
... ...
LL | fut().await; LL | fut().await;
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later | ^^^^^ await occurs here, with `get_formatter()` maybe used later
LL | } LL | }
LL | } LL | }
| - `get_formatter()` is later dropped here | - `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` = 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 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!(); LL | let f: &mut std::fmt::Formatter = panic!();
| - has type `&mut Formatter<'_>` which is not `Send` | - has type `&mut Formatter<'_>` which is not `Send`
LL | if non_sync().fmt(f).unwrap() == () { LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await; LL | fut().await;
| ^^^^^^ await occurs here, with `f` maybe used later | ^^^^^ await occurs here, with `f` maybe used later
LL | } LL | }
LL | } LL | }
| - `f` is later dropped here | - `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` = 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 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 {}; LL | let f: &mut std::fmt::Formatter = loop {};
| - has type `&mut Formatter<'_>` which is not `Send` | - has type `&mut Formatter<'_>` which is not `Send`
LL | if non_sync().fmt(f).unwrap() == () { LL | if non_sync().fmt(f).unwrap() == () {
LL | fut().await; LL | fut().await;
| ^^^^^^ await occurs here, with `f` maybe used later | ^^^^^ await occurs here, with `f` maybe used later
LL | } LL | }
LL | } LL | }
| - `f` is later dropped here | - `f` is later dropped here

View File

@ -1,49 +0,0 @@
error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:72:17
|
LL | assert_send(non_send_temporary_in_match());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_send_temporary_in_match` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<()>`
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:36:25
|
LL | match Some(non_send()) {
| ---------------- has type `Option<impl Debug>` which is not `Send`
LL | Some(_) => fut().await,
| ^^^^^^ await occurs here, with `Some(non_send())` maybe used later
...
LL | }
| - `Some(non_send())` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: future cannot be sent between threads safely
--> $DIR/async-fn-nonsend.rs:74:17
|
LL | assert_send(non_sync_with_method_call());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ future returned by `non_sync_with_method_call` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `dyn std::fmt::Write`
note: future is not `Send` as this value is used across an await
--> $DIR/async-fn-nonsend.rs:49:14
|
LL | let f: &mut std::fmt::Formatter = &mut get_formatter();
| --------------- has type `Formatter<'_>` which is not `Send`
...
LL | fut().await;
| ^^^^^^ await occurs here, with `get_formatter()` maybe used later
LL | }
LL | }
| - `get_formatter()` is later dropped here
note: required by a bound in `assert_send`
--> $DIR/async-fn-nonsend.rs:67:24
|
LL | fn assert_send(_: impl Send) {}
| ^^^^ required by this bound in `assert_send`
error: aborting due to 2 previous errors

View File

@ -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<'_>` = 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: `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 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; LL | let cx_ref = &mut cx;
| ------ has type `&mut Context<'_>` which does not implement `UnwindSafe` | ------ has type `&mut Context<'_>` which does not implement `UnwindSafe`
LL | LL |
LL | async {}.await; // this needs an inner await point 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 | }); LL | });
| - `cx_ref` is later dropped here | - `cx_ref` is later dropped here

View File

@ -143,7 +143,7 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
LL | fn foo9() -> Result<(), ()> { LL | fn foo9() -> Result<(), ()> {
| ---- this is not `async` | ---- this is not `async`
LL | let _ = await bar(); 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 error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:57:13 --> $DIR/incorrect-syntax-suggestions.rs:57:13
@ -151,7 +151,7 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
LL | fn foo10() -> Result<(), ()> { LL | fn foo10() -> Result<(), ()> {
| ----- this is not `async` | ----- this is not `async`
LL | let _ = await? bar(); 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 error[E0728]: `await` is only allowed inside `async` functions and blocks
--> $DIR/incorrect-syntax-suggestions.rs:66:14 --> $DIR/incorrect-syntax-suggestions.rs:66:14
@ -159,71 +159,71 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks
LL | fn foo12() -> Result<(), ()> { LL | fn foo12() -> Result<(), ()> {
| ----- this is not `async` | ----- this is not `async`
LL | let _ = (await bar())?; 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 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<(), ()> { LL | fn foo13() -> Result<(), ()> {
| ----- this is not `async` | ----- this is not `async`
LL | let _ = bar().await(); 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 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<(), ()> { LL | fn foo14() -> Result<(), ()> {
| ----- this is not `async` | ----- this is not `async`
LL | let _ = bar().await()?; 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 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<(), ()> { LL | fn foo15() -> Result<(), ()> {
| ----- this is not `async` | ----- this is not `async`
LL | let _ = bar().await; 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 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<(), ()> { LL | fn foo16() -> Result<(), ()> {
| ----- this is not `async` | ----- this is not `async`
LL | let _ = bar().await?; 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 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<(), ()> { LL | fn foo() -> Result<(), ()> {
| --- this is not `async` | --- this is not `async`
LL | let _ = bar().await?; 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 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 = || { LL | let foo = || {
| -- this is not `async` | -- this is not `async`
LL | let _ = bar().await?; 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 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<(), ()> { LL | fn foo() -> Result<(), ()> {
| --- this is not `async` | --- this is not `async`
LL | let _ = await!(bar())?; 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 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 = || { LL | let foo = || {
| -- this is not `async` | -- this is not `async`
LL | let _ = await!(bar())?; 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 error: aborting due to 33 previous errors

View 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() {}

View 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() {}

View 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 await
LL | f.await;
| ^ value used here after move
|
note: `into_future` takes ownership of the receiver `self`, which moves `f`
--> $SRC_DIR/core/src/future/into_future.rs:LL:COL
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | f.clone().await;
| ++++++++
error: aborting due to previous error
For more information about this error, try `rustc --explain E0382`.

View File

@ -5,12 +5,12 @@ LL | None { value: (), ..Default::default() }.await;
| ^^^^^ `Option<_>::None` does not have this field | ^^^^^ `Option<_>::None` does not have this field
error[E0277]: `Option<_>` is not a future 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; LL | None { value: (), ..Default::default() }.await;
| ^^^^^^ | -^^^^^
| | | ||
| `Option<_>` is not a future | |`Option<_>` is not a future
| help: remove the `.await` | help: remove the `.await`
| |
= help: the trait `Future` is not implemented for `Option<_>` = help: the trait `Future` is not implemented for `Option<_>`

View File

@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` = 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 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(); LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send` | -------- has type `InfoResult` which is not `Send`
... ...
LL | let _ = send_element(element).await; 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 | } LL | }
| - `mut info` is later dropped here | - `mut info` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`

View File

@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` = 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 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(); LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send` | -------- has type `InfoResult` which is not `Send`
... ...
LL | let _ = send_element(element).await; 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` note: required by a bound in `assert_send`
--> $DIR/drop-track-field-assign-nonsend.rs:40:19 --> $DIR/drop-track-field-assign-nonsend.rs:40:19
| |

View File

@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` = 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 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(); LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send` | -------- has type `InfoResult` which is not `Send`
... ...
LL | let _ = send_element(element).await; 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 | } LL | }
| - `mut info` is later dropped here | - `mut info` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`

View File

@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` = 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 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(); LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send` | -------- has type `InfoResult` which is not `Send`
... ...
LL | let _ = send_element(element).await; 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 | } LL | }
| - `mut info` is later dropped here | - `mut info` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`

View File

@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` = 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 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(); LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send` | -------- has type `InfoResult` which is not `Send`
... ...
LL | let _ = send_element(element).await; 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` note: required by a bound in `assert_send`
--> $DIR/field-assign-nonsend.rs:40:19 --> $DIR/field-assign-nonsend.rs:40:19
| |

View File

@ -6,13 +6,13 @@ LL | assert_send(agent.handle());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Rc<String>` = 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 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(); LL | let mut info = self.info_result.clone();
| -------- has type `InfoResult` which is not `Send` | -------- has type `InfoResult` which is not `Send`
... ...
LL | let _ = send_element(element).await; 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 | } LL | }
| - `mut info` is later dropped here | - `mut info` is later dropped here
note: required by a bound in `assert_send` note: required by a bound in `assert_send`

View File

@ -1,10 +1,10 @@
error[E0277]: `()` is not a future error[E0277]: `()` is not a future
--> $DIR/issue-101715.rs:11:9 --> $DIR/issue-101715.rs:11:10
| |
LL | .await LL | .await
| ^^^^^^ | -^^^^^
| | | ||
| `()` is not a future | |`()` is not a future
| help: remove the `.await` | help: remove the `.await`
| |
= help: the trait `Future` is not implemented for `()` = help: the trait `Future` is not implemented for `()`

View File

@ -6,12 +6,12 @@ LL | is_sync(bar());
| |
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo` = 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 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; LL | let x = Foo;
| - has type `Foo` which is not `Sync` | - has type `Foo` which is not `Sync`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | drop(x); LL | drop(x);
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here

View File

@ -6,12 +6,12 @@ LL | is_sync(bar());
| |
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo` = 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 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; LL | let x = Foo;
| - has type `Foo` which is not `Sync` | - has type `Foo` which is not `Sync`
LL | baz().await; 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` note: required by a bound in `is_sync`
--> $DIR/issue-64130-1-sync.rs:14:15 --> $DIR/issue-64130-1-sync.rs:14:15
| |

View File

@ -6,12 +6,12 @@ LL | is_sync(bar());
| |
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo` = 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 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; LL | let x = Foo;
| - has type `Foo` which is not `Sync` | - has type `Foo` which is not `Sync`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | drop(x); LL | drop(x);
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here

View File

@ -1,24 +0,0 @@
error: future cannot be shared between threads safely
--> $DIR/issue-64130-1-sync.rs:24:13
|
LL | is_sync(bar());
| ^^^^^ future returned by `bar` is not `Sync`
|
= help: within `impl Future<Output = ()>`, the trait `Sync` is not implemented for `Foo`
note: future is not `Sync` as this value is used across an await
--> $DIR/issue-64130-1-sync.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Sync`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_sync`
--> $DIR/issue-64130-1-sync.rs:14:15
|
LL | fn is_sync<T: Sync>(t: T) { }
| ^^^^ required by this bound in `is_sync`
error: aborting due to previous error

View File

@ -6,12 +6,12 @@ LL | is_send(bar());
| |
= note: the trait bound `Unique<Foo>: Send` is not satisfied = note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await 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); LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send` | - has type `Box<Foo>` which is not `Send`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here
note: required by a bound in `is_send` note: required by a bound in `is_send`

View File

@ -6,12 +6,12 @@ LL | is_send(bar());
| |
= note: the trait bound `Unique<Foo>: Send` is not satisfied = note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await 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); LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send` | - has type `Box<Foo>` which is not `Send`
LL | baz().await; 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` note: required by a bound in `is_send`
--> $DIR/issue-64130-2-send.rs:14:15 --> $DIR/issue-64130-2-send.rs:14:15
| |

View File

@ -6,12 +6,12 @@ LL | is_send(bar());
| |
= note: the trait bound `Unique<Foo>: Send` is not satisfied = note: the trait bound `Unique<Foo>: Send` is not satisfied
note: future is not `Send` as this value is used across an await 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); LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which is not `Send` | - has type `Box<Foo>` which is not `Send`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here
note: required by a bound in `is_send` note: required by a bound in `is_send`

View File

@ -1,24 +0,0 @@
error: future cannot be sent between threads safely
--> $DIR/issue-64130-2-send.rs:24:13
|
LL | is_send(bar());
| ^^^^^ future returned by `bar` is not `Send`
|
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `Foo`
note: future is not `Send` as this value is used across an await
--> $DIR/issue-64130-2-send.rs:18:10
|
LL | let x = Foo;
| - has type `Foo` which is not `Send`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_send`
--> $DIR/issue-64130-2-send.rs:14:15
|
LL | fn is_send<T: Send>(t: T) { }
| ^^^^ required by this bound in `is_send`
error: aborting due to previous error

View File

@ -8,12 +8,12 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` | ^^^^^ 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 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); LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux` | - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here
note: required by a bound in `is_qux` note: required by a bound in `is_qux`

View File

@ -8,12 +8,12 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` | ^^^^^ 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 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); LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux` | - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await; 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` note: required by a bound in `is_qux`
--> $DIR/issue-64130-3-other.rs:17:14 --> $DIR/issue-64130-3-other.rs:17:14
| |

View File

@ -8,12 +8,12 @@ LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo` | ^^^^^ 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 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); LL | let x = Box::new(Foo);
| - has type `Box<Foo>` which does not implement `Qux` | - has type `Box<Foo>` which does not implement `Qux`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later | ^^^^^ await occurs here, with `x` maybe used later
LL | } LL | }
| - `x` is later dropped here | - `x` is later dropped here
note: required by a bound in `is_qux` note: required by a bound in `is_qux`

View File

@ -1,27 +0,0 @@
error[E0277]: the trait bound `Foo: Qux` is not satisfied in `impl Future<Output = ()>`
--> $DIR/issue-64130-3-other.rs:27:12
|
LL | async fn bar() {
| - within this `impl Future<Output = ()>`
...
LL | is_qux(bar());
| ^^^^^ within `impl Future<Output = ()>`, the trait `Qux` is not implemented for `Foo`
|
note: future does not implement `Qux` as this value is used across an await
--> $DIR/issue-64130-3-other.rs:21:10
|
LL | let x = Foo;
| - has type `Foo` which does not implement `Qux`
LL | baz().await;
| ^^^^^^ await occurs here, with `x` maybe used later
LL | }
| - `x` is later dropped here
note: required by a bound in `is_qux`
--> $DIR/issue-64130-3-other.rs:17:14
|
LL | fn is_qux<T: Qux>(t: T) {}
| ^^^ required by this bound in `is_qux`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.

View File

@ -6,13 +6,13 @@ LL | pub fn foo() -> impl Future + Send {
| |
= help: the trait `Sync` is not implemented for `(dyn Any + Send + 'static)` = 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 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() { LL | match client.status() {
| ------ has type `&Client` which is not `Send` | ------ has type `&Client` which is not `Send`
LL | 200 => { LL | 200 => {
LL | let _x = get().await; LL | let _x = get().await;
| ^^^^^^ await occurs here, with `client` maybe used later | ^^^^^ await occurs here, with `client` maybe used later
... ...
LL | } LL | }
| - `client` is later dropped here | - `client` is later dropped here

View File

@ -6,12 +6,12 @@ LL | is_send(foo());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, u32>` = 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 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(); LL | let g = x.lock().unwrap();
| - has type `MutexGuard<'_, u32>` which is not `Send` | - has type `MutexGuard<'_, u32>` which is not `Send`
LL | baz().await; LL | baz().await;
| ^^^^^^ await occurs here, with `g` maybe used later | ^^^^^ await occurs here, with `g` maybe used later
LL | } LL | }
| - `g` is later dropped here | - `g` is later dropped here
note: required by a bound in `is_send` note: required by a bound in `is_send`

View File

@ -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 ()` = 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 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` LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send` | - has type `*mut ()` which is not `Send`
LL | AFuture.await; LL | AFuture.await;
| ^^^^^^ await occurs here, with `a` maybe used later | ^^^^^ await occurs here, with `a` maybe used later
LL | drop(a); LL | drop(a);
LL | }); LL | });
| - `a` is later dropped here | - `a` is later dropped here

View File

@ -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 ()` = 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 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` LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send` | - has type `*mut ()` which is not `Send`
LL | AFuture.await; 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` note: required by a bound in `spawn`
--> $DIR/issue-67252-unnamed-future.rs:9:13 --> $DIR/issue-67252-unnamed-future.rs:9:13
| |

View File

@ -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 ()` = 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 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` LL | let a = std::ptr::null_mut::<()>(); // `*mut ()` is not `Send`
| - has type `*mut ()` which is not `Send` | - has type `*mut ()` which is not `Send`
LL | AFuture.await; LL | AFuture.await;
| ^^^^^^ await occurs here, with `a` maybe used later | ^^^^^ await occurs here, with `a` maybe used later
LL | drop(a); LL | drop(a);
LL | }); LL | });
| - `a` is later dropped here | - `a` is later dropped here

View File

@ -1,10 +1,10 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks 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() { LL | async fn fun() {
| --- this is not `async` | --- this is not `async`
LL | [1; ().await]; 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` error[E0744]: `.await` is not allowed in a `const`
--> $DIR/issue-70594.rs:4:9 --> $DIR/issue-70594.rs:4:9
@ -13,18 +13,18 @@ LL | [1; ().await];
| ^^^^^^^^ | ^^^^^^^^
error[E0744]: `.await` is not allowed in a `const` error[E0744]: `.await` is not allowed in a `const`
--> $DIR/issue-70594.rs:4:11 --> $DIR/issue-70594.rs:4:12
| |
LL | [1; ().await]; LL | [1; ().await];
| ^^^^^^ | ^^^^^
error[E0277]: `()` is not a future error[E0277]: `()` is not a future
--> $DIR/issue-70594.rs:4:11 --> $DIR/issue-70594.rs:4:12
| |
LL | [1; ().await]; LL | [1; ().await];
| ^^^^^^ | -^^^^^
| | | ||
| `()` is not a future | |`()` is not a future
| help: remove the `.await` | help: remove the `.await`
| |
= help: the trait `Future` is not implemented for `()` = help: the trait `Future` is not implemented for `()`

View File

@ -1,18 +0,0 @@
error: future cannot be sent between threads safely
--> $DIR/issue-70818.rs:7:38
|
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
note: captured value is not `Send`
--> $DIR/issue-70818.rs:9:18
|
LL | async { (ty, ty1) }
| ^^^ has type `U` which is not `Send`
help: consider restricting type parameter `U`
|
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
| +++++++++++++++++++
error: aborting due to previous error

View File

@ -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>` = help: the trait `Sync` is not implemented for `Sender<i32>`
note: future is not `Send` as this value is used across an await 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 | baz(|| async{
| _____________- | _____________-
LL | | foo(tx.clone()); LL | | foo(tx.clone());
LL | | }).await; LL | | }).await;
| | - ^^^^^^- the value is later dropped here | | - ^^^^^- the value is later dropped here
| | | | | | | |
| |_________| await occurs here, with the value maybe used later | |_________| 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` | has type `[closure@$DIR/issue-70935-complex-spans.rs:17:13: 17:15]` which is not `Send`
error: aborting due to previous error error: aborting due to previous error

View File

@ -6,12 +6,12 @@ LL | fake_spawn(wrong_mutex());
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, i32>` = 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 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(); LL | let mut guard = m.lock().unwrap();
| --------- has type `MutexGuard<'_, i32>` which is not `Send` | --------- has type `MutexGuard<'_, i32>` which is not `Send`
LL | (async { "right"; }).await; 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 | *guard += 1;
LL | } LL | }
| - `mut guard` is later dropped here | - `mut guard` is later dropped here

View File

@ -1,11 +0,0 @@
error[E0070]: invalid left-hand side of assignment
--> $DIR/issue-73741-type-err-drop-tracking.rs:11:7
|
LL | 1 = 2;
| - ^
| |
| cannot assign to this expression
error: aborting due to previous error
For more information about this error, try `rustc --explain E0070`.

View File

@ -23,10 +23,10 @@ LL | pub struct StructAsync<F: Fn() -> Pin<Box<dyn Future<Output = ()>>>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `StructAsync` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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 = ()>` 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; 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` note: required by a bound in `StructAsync`
--> $DIR/issue-98634.rs:9:35 --> $DIR/issue-98634.rs:9:35

View File

@ -23,10 +23,10 @@ LL | inner::<false>().await
| ^^^^^^^^^^^^^^ cannot infer the value of const parameter `PING` declared on the function `inner` | ^^^^^^^^^^^^^^ 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` 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 LL | inner::<false>().await
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5 --> $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` | ^^^^^^^^^^^^^^ 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` 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 LL | inner::<false>().await
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5 --> $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` | ^^^^^^^^^^^^^^ 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` 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 LL | inner::<false>().await
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5 --> $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` | ^^^^^^^^^^^^^^ 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` 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 LL | inner::<false>().await
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/issue-107280.rs:4:5 --> $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` | ^^^^^^^^^^^^^^ 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` 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 LL | inner::<false>().await
| ^^^^^^ | ^^^^^
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -1,8 +1,8 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks 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; LL | let _gen = || foo().await;
| -- ^^^^^^ only allowed inside `async` functions and blocks | -- ^^^^^ only allowed inside `async` functions and blocks
| | | |
| this is not `async` | this is not `async`

View File

@ -1,11 +1,11 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks 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() { LL | fn main() {
| ---- this is not `async` | ---- this is not `async`
LL | let result = inc(10000); LL | let result = inc(10000);
LL | let finished = result.await; 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 error: aborting due to previous error

View File

@ -1,36 +1,36 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks 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() { LL | fn main() {
| ---- this is not `async` | ---- this is not `async`
LL | async { let (); }.await; 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 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() { LL | fn main() {
| ---- this is not `async` | ---- this is not `async`
... ...
LL | }.await; 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 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() { LL | fn main() {
| ---- this is not `async` | ---- this is not `async`
... ...
LL | (|_| 2333).await; 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 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; 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: remove the `.await`
| |
= help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]` = help: the trait `Future` is not implemented for closure `[closure@$DIR/issue-62009-1.rs:12:6: 12:9]`

View File

@ -1,10 +1,10 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks 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() { LL | fn main() {
| ---- this is not `async` | ---- this is not `async`
LL | (async || 2333)().await; LL | (async || 2333)().await;
| ^^^^^^ only allowed inside `async` functions and blocks | ^^^^^ only allowed inside `async` functions and blocks
error: aborting due to previous error error: aborting due to previous error

View File

@ -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` = 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 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; LL | bar(Foo(std::ptr::null())).await;
| ---------------- ^^^^^^- `std::ptr::null()` is later dropped here | ---------------- ^^^^^- `std::ptr::null()` is later dropped here
| | | | | |
| | await occurs here, with `std::ptr::null()` maybe used later | | await occurs here, with `std::ptr::null()` maybe used later
| has type `*const u8` which is not `Send` | has type `*const u8` which is not `Send`
help: consider moving this into a `let` binding to create a shorter lived borrow help: consider moving this into a `let` binding to create a shorter lived borrow
--> $DIR/issue-65436-raw-ptr-not-send.rs:19:13 --> $DIR/issue-65436-raw-ptr-not-send.rs:19:13

View File

@ -6,12 +6,12 @@ LL | g(issue_67893::run())
| |
= help: within `impl Future<Output = ()>`, the trait `Send` is not implemented for `MutexGuard<'_, ()>` = 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 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; LL | f(*x.lock().unwrap()).await;
| ----------------- ^^^^^^- `x.lock().unwrap()` is later dropped here | ----------------- ^^^^^- `x.lock().unwrap()` is later dropped here
| | | | | |
| | await occurs here, with `x.lock().unwrap()` maybe used later | | await occurs here, with `x.lock().unwrap()` maybe used later
| has type `MutexGuard<'_, ()>` which is not `Send` | has type `MutexGuard<'_, ()>` which is not `Send`
note: required by a bound in `g` note: required by a bound in `g`
--> $DIR/issue-67893.rs:6:14 --> $DIR/issue-67893.rs:6:14

View File

@ -1,11 +1,11 @@
error[E0728]: `await` is only allowed inside `async` functions and blocks 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() { LL | fn main() {
| ---- this is not `async` | ---- this is not `async`
LL | let x = move || {}; LL | let x = move || {};
LL | let y = do_the_thing().await; 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 error: aborting due to previous error

View File

@ -1,21 +0,0 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/mutually-recursive-async-impl-trait-type.rs:9:18
|
LL | async fn rec_1() {
| ^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/mutually-recursive-async-impl-trait-type.rs:13:18
|
LL | async fn rec_2() {
| ^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0733`.

View File

@ -1,12 +0,0 @@
error[E0733]: recursion in an `async fn` requires boxing
--> $DIR/recursive-async-impl-trait-type.rs:8:40
|
LL | async fn recursive_async_function() -> () {
| ^^ recursive `async fn`
|
= note: a recursive `async fn` must be rewritten to return a boxed `dyn Future`
= note: consider using the `async_recursion` crate: https://crates.io/crates/async_recursion
error: aborting due to previous error
For more information about this error, try `rustc --explain E0733`.

View File

@ -11,4 +11,24 @@ async fn baz() -> std::io::Result<()> {
std::io::Result::Ok(()) std::io::Result::Ok(())
} }
macro_rules! e {
() => {
()
};
}
macro_rules! f {
($expr:expr) => {
$expr.await
//~^ ERROR `()` is not a future
};
}
async fn with_macros() {
e!().await;
//~^ ERROR `()` is not a future
f!(());
}
fn main() {} fn main() {}

View File

@ -1,8 +1,8 @@
error[E0277]: `()` is not a future error[E0277]: `()` is not a future
--> $DIR/unnecessary-await.rs:9:10 --> $DIR/unnecessary-await.rs:9:11
| |
LL | boo().await; LL | boo().await;
| -----^^^^^^ `()` is not a future | ----- ^^^^^ `()` is not a future
| | | |
| this call returns `()` | this call returns `()`
| |
@ -19,6 +19,36 @@ help: alternatively, consider making `fn boo` asynchronous
LL | async fn boo() {} LL | async fn boo() {}
| +++++ | +++++
error: aborting due to previous error error[E0277]: `()` is not a future
--> $DIR/unnecessary-await.rs:28:10
|
LL | e!().await;
| -^^^^^
| ||
| |`()` is not a future
| help: remove the `.await`
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
= note: required for `()` to implement `IntoFuture`
error[E0277]: `()` is not a future
--> $DIR/unnecessary-await.rs:22:15
|
LL | $expr.await
| ^^^^^
| |
| `()` is not a future
| remove the `.await`
...
LL | f!(());
| ------ in this macro invocation
|
= help: the trait `Future` is not implemented for `()`
= note: () must be a future or must implement `IntoFuture` to be awaited
= note: required for `()` to implement `IntoFuture`
= note: this error originates in the macro `f` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0277`. For more information about this error, try `rustc --explain E0277`.

View File

@ -5,10 +5,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5 --> $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` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5 --> $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` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View File

@ -5,10 +5,10 @@ LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5 --> $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` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5 --> $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` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5 --> $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` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async fn` body must be known in this context error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:12:5 --> $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` | ^^^ 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` 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; LL | bar().await;
| ^^^^^^ | ^^^^^
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View File

@ -1,39 +0,0 @@
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error[E0698]: type inside `async fn` body must be known in this context
--> $DIR/unresolved_type_param.rs:13:5
|
LL | bar().await;
| ^^^ cannot infer type for type parameter `T` declared on the function `bar`
|
note: the type is part of the `async fn` body because of this `await`
--> $DIR/unresolved_type_param.rs:13:10
|
LL | bar().await;
| ^^^^^^
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0698`.

View File

@ -0,0 +1,21 @@
// Test precise capture of a multi-variant enum (when remaining variants are
// visibly uninhabited).
// edition:2021
// run-pass
#![feature(exhaustive_patterns)]
#![feature(never_type)]
pub fn main() {
let mut r = Result::<!, (u32, u32)>::Err((0, 0));
let mut f = || {
let Err((ref mut a, _)) = r;
*a = 1;
};
let mut g = || {
let Err((_, ref mut b)) = r;
*b = 2;
};
f();
g();
assert_eq!(r, Err((1, 2)));
}

View File

@ -1,31 +0,0 @@
error[E0597]: `a` does not live long enough
--> $DIR/borrowing.rs:13:33
|
LL | let _b = {
| -- borrow later stored here
LL | let a = 3;
LL | Pin::new(&mut || yield &a).resume(())
| -- ^ borrowed value does not live long enough
| |
| value captured here by generator
LL |
LL | };
| - `a` dropped here while still borrowed
error[E0597]: `a` does not live long enough
--> $DIR/borrowing.rs:20:20
|
LL | let _b = {
| -- borrow later stored here
LL | let a = 3;
LL | || {
| -- value captured here by generator
LL | yield &a
| ^ borrowed value does not live long enough
...
LL | };
| - `a` dropped here while still borrowed
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0597`.

View File

@ -1,13 +0,0 @@
error[E0499]: cannot borrow `thing` as mutable more than once at a time
--> $DIR/retain-resume-ref.rs:27:25
|
LL | gen.as_mut().resume(&mut thing);
| ---------- first mutable borrow occurs here
LL | gen.as_mut().resume(&mut thing);
| ------ ^^^^^^^^^^ second mutable borrow occurs here
| |
| first borrow later used by call
error: aborting due to previous error
For more information about this error, try `rustc --explain E0499`.

View File

@ -1,10 +1,10 @@
error[E0277]: `[(); _]` is not a future 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; LL | let s = std::array::from_fn(|_| ()).await;
| ---------------------------^^^^^^ | ----------------------------^^^^^
| | | | | ||
| | `[(); _]` is not a future | | |`[(); _]` is not a future
| | help: remove the `.await` | | help: remove the `.await`
| this call returns `[(); _]` | 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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var-drop-tracking.rs:7:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -1,10 +1,10 @@
error[E0277]: `[(); _]` is not a future 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; LL | let s = std::array::from_fn(|_| ()).await;
| ---------------------------^^^^^^ | ----------------------------^^^^^
| | | | | ||
| | `[(); _]` is not a future | | |`[(); _]` is not a future
| | help: remove the `.await` | | help: remove the `.await`
| this call returns `[(); _]` | 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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error[E0698]: type inside `async` block must be known in this context error[E0698]: type inside `async` block must be known in this context
--> $DIR/unresolved-ct-var.rs:6:17 --> $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` | ^^^^^^^^^^^^^^^^^^^ 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` 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; LL | let s = std::array::from_fn(|_| ()).await;
| ^^^^^^ | ^^^^^
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View File

@ -4,7 +4,7 @@ error: boxed `Umm` held across a suspend point, but should not be
LL | let _guard = bar(); LL | let _guard = bar();
| ^^^^^^ | ^^^^^^
LL | other().await; 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? note: You gotta use Umm's, ya know?
--> $DIR/boxed.rs:20:9 --> $DIR/boxed.rs:20:9

View File

@ -4,7 +4,7 @@ error: `No` held across a suspend point, but should not be
LL | let no = No {}; LL | let no = No {};
| ^^ | ^^
LL | wheeee(&no).await; 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 help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:9 --> $DIR/dedup.rs:19:9

View File

@ -4,7 +4,7 @@ error: `No` held across a suspend point, but should not be
LL | let no = No {}; LL | let no = No {};
| ^^ | ^^
LL | wheeee(&no).await; 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 help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:9 --> $DIR/dedup.rs:19:9

View File

@ -4,7 +4,7 @@ error: `No` held across a suspend point, but should not be
LL | let no = No {}; LL | let no = No {};
| ^^ | ^^
LL | wheeee(&no).await; 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 help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:9 --> $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 --> $DIR/dedup.rs:20:13
| |
LL | wheeee(&no).await; 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 help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:20:13 --> $DIR/dedup.rs:20:13

View File

@ -1,19 +0,0 @@
error: `No` held across a suspend point, but should not be
--> $DIR/dedup.rs:19:13
|
LL | wheeee(&No {}).await;
| ^^^^^ ------ the value is held across this suspend point
|
help: consider using a block (`{ ... }`) to shrink the value's scope, ending before the suspend point
--> $DIR/dedup.rs:19:13
|
LL | wheeee(&No {}).await;
| ^^^^^
note: the lint level is defined here
--> $DIR/dedup.rs:6:9
|
LL | #![deny(must_not_suspend)]
| ^^^^^^^^^^^^^^^^
error: aborting due to previous error

Some files were not shown because too many files have changed in this diff Show More