makepad/libs/relax/compiler/tests/async_diverging_block.rs
Admin cd658a30ef makepad run / Relax: solver and typeck fixes
- async closure Output deduction, solver cycle step kinds from the goal source,
  object supertrait projections, impl candidate merging, trait supertrait
  well-formedness, E0282 for casts and method calls on diverging variables,
  the (..) tuple pattern

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 07:46:04 +02:00

15 lines
510 B
Rust

// An async block whose body only diverges has a return type variable that falls back
// like any variable a `!` flowed into (it used to report E0282).
use std::future::Future;
fn block_on_never<F: Future>(_f: F) -> F::Output { loop {} }
#[allow(dead_code, unreachable_code)]
fn never_bodies() {
let _a = async move { unimplemented!() };
let _b = || async move { unimplemented!() };
let _c = block_on_never(async move { (move || async move { unimplemented!() })() });
}
#[test]
fn compiles() {}