1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 #![allow(unknown_features)]
12 #![feature(box_syntax)]
16 // Check that coercions apply at the pointer level and don't cause
17 // rvalue expressions to be unsized. See #20169 for more information.
20 let _: Box<[int]> = box { [1, 2, 3] };
21 let _: Box<[int]> = box if true { [1, 2, 3] } else { [1, 3, 4] };
22 let _: Box<[int]> = box match true { true => [1, 2, 3], false => [1, 3, 4] };
23 let _: Box<Fn(int) -> _> = box { |x| (x as u8) };
24 let _: Box<Show> = box if true { false } else { true };
25 let _: Box<Show> = box match true { true => 'a', false => 'b' };
27 let _: &[int] = &{ [1, 2, 3] };
28 let _: &[int] = &if true { [1, 2, 3] } else { [1, 3, 4] };
29 let _: &[int] = &match true { true => [1, 2, 3], false => [1, 3, 4] };
30 let _: &Fn(int) -> _ = &{ |x| (x as u8) };
31 let _: &Show = &if true { false } else { true };
32 let _: &Show = &match true { true => 'a', false => 'b' };