]>
git.proxmox.com Git - rustc.git/blob - src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs
1 // Copyright 2017 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 #![feature(universal_impl_trait)]
12 use std
::fmt
::Display
;
14 fn check_display_eq(iter
: &Vec
<impl Display
>) {
15 let mut collected
= String
::new();
17 let disp
= format
!("{} ", it
);
18 collected
.push_str(&disp
);
20 assert_eq
!("0 3 27 823 4891 1 0", collected
.trim());
24 let i32_list_vec
= vec
![0i32, 3, 27, 823, 4891, 1, 0];
25 let u32_list_vec
= vec
![0u32, 3, 27, 823, 4891, 1, 0];
26 let str_list_vec
= vec
!["0", "3", "27", "823", "4891", "1", "0"];
28 check_display_eq(&i32_list_vec
);
29 check_display_eq(&u32_list_vec
);
30 check_display_eq(&str_list_vec
);