]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-29071-2.rs
Require Drop impls to have the same constness on its bounds as the bounds on the...
[rust.git] / src / test / ui / issues / issue-29071-2.rs
1 // run-pass
2 #![allow(dead_code)]
3 fn t1() -> u32 {
4     let x;
5     x = if true { [1, 2, 3] } else { [2, 3, 4] }[0];
6     x
7 }
8
9 fn t2() -> [u32; 1] {
10     if true { [1, 2, 3]; } else { [2, 3, 4]; }
11     [0]
12 }
13
14 fn t3() -> u32 {
15     let x;
16     x = if true { i1 as F } else { i2 as F }();
17     x
18 }
19
20 fn t4() -> () {
21     if true { i1 as F; } else { i2 as F; }
22     ()
23 }
24
25 type F = fn() -> u32;
26 fn i1() -> u32 { 1 }
27 fn i2() -> u32 { 2 }
28
29 fn main() {
30     assert_eq!(t1(), 1);
31     assert_eq!(t3(), 1);
32 }