Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions compiler/rustc_ast_lowering/src/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,7 @@ fn may_contain_yield_point(e: &ast::Expr) -> bool {
if let ast::ExprKind::Await(_, _) | ast::ExprKind::Yield(_) = e.kind {
ControlFlow::Break(())
} else {
visit::walk_expr(self, e);
ControlFlow::Continue(())
visit::walk_expr(self, e)
}
}

Expand Down
22 changes: 22 additions & 0 deletions tests/ui/fmt/nested-awaits-issue-122674.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Non-regression test for issue #122674: a change in the format args visitor missed nested awaits.

//@ edition: 2021
//@ check-pass

pub fn f1() -> impl std::future::Future<Output = Result<(), String>> + Send {
async {
should_work().await?;
Ok(())
}
}

async fn should_work() -> Result<String, String> {
let x = 1;
Err(format!("test: {}: {}", x, inner().await?))
}

async fn inner() -> Result<String, String> {
Ok("test".to_string())
}

fn main() {}