]> git.lizzy.rs Git - rust.git/blob - tests/ui/try-block/try-block-type-error.rs
Rollup merge of #105172 - alexs-sh:issue-98861-fix-next, r=scottmcm
[rust.git] / tests / 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 }