rust/tests/ui/try-block/try-block-heterogeneous.rs
Scott McMurray 4033d19b79 Experimentally add *heterogeneous* try blocks
148725 moved the default to being homogeneous; this adds heterogeneous ones back under an obvious-bikeshed syntax so people can experiment with that as well.

Essentially resolves 149025 by letting them move to this syntax instead.
2025-12-09 20:18:43 -08:00

19 lines
304 B
Rust

//@ check-pass
//@ edition: 2018
#![feature(try_blocks_heterogeneous)]
fn foo() -> Result<(), u16> { Ok(()) }
fn bar() -> Result<(), u32> { Ok(()) }
fn whatever() -> Result<(), String> {
try bikeshed _ {}
}
fn main() {
try bikeshed Result<(), u64> {
foo()?;
bar()?;
};
}