]> git.lizzy.rs Git - rust.git/blob - tests/ui/vec_box_sized.rs
Auto merge of #4314 - chansuke:add-negation-to-is_empty, r=flip1995
[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
8 /// The following should trigger the lint
9 mod should_trigger {
10     use super::SizedStruct;
11
12     struct StructWithVecBox {
13         sized_type: Vec<Box<SizedStruct>>,
14     }
15
16     struct A(Vec<Box<SizedStruct>>);
17     struct B(Vec<Vec<Box<(u32)>>>);
18 }
19
20 /// The following should not trigger the lint
21 mod should_not_trigger {
22     use super::UnsizedStruct;
23
24     struct C(Vec<Box<UnsizedStruct>>);
25
26     struct StructWithVecBoxButItsUnsized {
27         unsized_type: Vec<Box<UnsizedStruct>>,
28     }
29
30     struct TraitVec<T: ?Sized> {
31         // Regression test for #3720. This was causing an ICE.
32         inner: Vec<Box<T>>,
33     }
34 }
35
36 fn main() {}