]> git.lizzy.rs Git - rust.git/blob - src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs
Auto merge of #74410 - mati865:mingw-no-self-contained-when-cross-compiling, r=petroc...
[rust.git] / src / test / ui / point-to-type-err-cause-on-impl-trait-return.rs
1 fn foo() -> impl std::fmt::Display {
2     if false {
3         return 0i32;
4     }
5     1u32
6     //~^ ERROR mismatched types
7 }
8
9 fn bar() -> impl std::fmt::Display {
10     if false {
11         return 0i32;
12     } else {
13         return 1u32;
14         //~^ ERROR mismatched types
15     }
16 }
17
18 fn baz() -> impl std::fmt::Display {
19     if false {
20         return 0i32;
21     } else {
22         1u32
23         //~^ ERROR mismatched types
24     }
25 }
26
27 fn qux() -> impl std::fmt::Display {
28     if false {
29         0i32
30     } else {
31         1u32
32         //~^ ERROR `if` and `else` have incompatible types
33     }
34 }
35
36 fn bat() -> impl std::fmt::Display {
37     match 13 {
38         0 => return 0i32,
39         _ => 1u32,
40         //~^ ERROR mismatched types
41     }
42 }
43
44 fn can() -> impl std::fmt::Display {
45     match 13 {
46     //~^ ERROR mismatched types
47         0 => return 0i32,
48         1 => 1u32,
49         _ => 2u32,
50     }
51 }
52
53 fn cat() -> impl std::fmt::Display {
54     match 13 {
55         0 => {
56             return 0i32;
57         }
58         _ => {
59             1u32
60             //~^ ERROR mismatched types
61         }
62     }
63 }
64
65 fn main() {}