]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/vec_box_sized.fixed
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / vec_box_sized.fixed
CommitLineData
f20569fa
XL
1// run-rustfix
2
3#![allow(dead_code)]
4
5struct SizedStruct(i32);
6struct UnsizedStruct([i32]);
7struct BigStruct([i32; 10000]);
8
9/// The following should trigger the lint
10mod should_trigger {
11 use super::SizedStruct;
12
13 struct StructWithVecBox {
14 sized_type: Vec<SizedStruct>,
15 }
16
17 struct A(Vec<SizedStruct>);
18 struct B(Vec<Vec<u32>>);
19}
20
21/// The following should not trigger the lint
22mod 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
38mod inner_mod {
39 mod inner {
40 pub struct S;
41 }
42
43 mod inner2 {
44 use super::inner::S;
45
46 pub fn f() -> Vec<S> {
47 vec![]
48 }
49 }
50}
51
52fn main() {}