]> git.lizzy.rs Git - rust.git/blob - tests/ui/vec_box_sized.rs
iterate List by value
[rust.git] / tests / ui / vec_box_sized.rs
1 // run-rustfix
2
3 #![allow(dead_code)]
4
5 struct SizedStruct(i32);
6 struct UnsizedStruct([i32]);
7 struct BigStruct([i32; 10000]);
8
9 /// The following should trigger the lint
10 mod should_trigger {
11     use super::SizedStruct;
12
13     struct StructWithVecBox {
14         sized_type: Vec<Box<SizedStruct>>,
15     }
16
17     struct A(Vec<Box<SizedStruct>>);
18     struct B(Vec<Vec<Box<(u32)>>>);
19 }
20
21 /// The following should not trigger the lint
22 mod should_not_trigger {
23     use super::{BigStruct, UnsizedStruct};
24
25     struct C(Vec<Box<UnsizedStruct>>);
26     struct D(Vec<Box<BigStruct>>);
27
28     struct StructWithVecBoxButItsUnsized {
29         unsized_type: Vec<Box<UnsizedStruct>>,
30     }
31
32     struct TraitVec<T: ?Sized> {
33         // Regression test for #3720. This was causing an ICE.
34         inner: Vec<Box<T>>,
35     }
36 }
37
38 fn main() {}