]> git.lizzy.rs Git - rust.git/blob - src/test/ui/try-block/try-block-type-error.rs
Rollup merge of #99064 - lyming2007:issue-97687-fix, r=estebank
[rust.git] / src / test / ui / try-block / try-block-type-error.rs
1 // compile-flags: --edition 2018
2
3 #![feature(try_blocks)]
4
5 fn foo() -> Option<()> { Some(()) }
6
7 fn main() {
8     let _: Option<f32> = try {
9         foo()?;
10         42
11         //~^ ERROR type mismatch
12     };
13
14     let _: Option<i32> = try {
15         foo()?;
16     };
17     //~^ ERROR type mismatch
18 }