]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass-valgrind/coerce-match.rs
Rollup merge of #80945 - sdroege:downcast-send-sync, r=m-ou-se
[rust.git] / src / test / run-pass-valgrind / coerce-match.rs
1 // Check that coercions are propagated through match and if expressions.
2
3 // pretty-expanded FIXME #23616
4
5 #![feature(box_syntax)]
6
7 pub fn main() {
8     let _: Box<[isize]> =
9         if true { let b: Box<_> = box [1, 2, 3]; b } else { let b: Box<_> = box [1]; b };
10
11     let _: Box<[isize]> = match true {
12         true => { let b: Box<_> = box [1, 2, 3]; b }
13         false => { let b: Box<_> = box [1]; b }
14     };
15
16     // Check we don't get over-keen at propagating coercions in the case of casts.
17     let x = if true { 42 } else { 42u8 } as u16;
18     let x = match true { true => 42, false => 42u8 } as u16;
19 }