]> git.lizzy.rs Git - rust.git/blob - tests/ui/box_vec.rs
rustup and compile-fail -> ui test move
[rust.git] / tests / ui / box_vec.rs
1 #![feature(plugin)]
2 #![plugin(clippy)]
3
4 #![deny(clippy)]
5 #![allow(boxed_local)]
6 #![allow(blacklisted_name)]
7
8 macro_rules! boxit {
9     ($init:expr, $x:ty) => {
10         let _: Box<$x> = Box::new($init);
11     }
12 }
13
14 fn test_macro() {
15     boxit!(Vec::new(), Vec<u8>);
16 }
17 pub fn test(foo: Box<Vec<bool>>) { //~ ERROR you seem to be trying to use `Box<Vec<T>>`
18     println!("{:?}", foo.get(0))
19 }
20
21 pub fn test2(foo: Box<Fn(Vec<u32>)>) { // pass if #31 is fixed
22     foo(vec![1, 2, 3])
23 }
24
25 fn main(){
26     test(Box::new(Vec::new()));
27     test2(Box::new(|v| println!("{:?}", v)));
28     test_macro();
29 }