summaryrefslogtreecommitdiffstats
path: root/src/tools/clippy/tests/ui/uninit_vec.stderr
blob: 520bfb26b62e1b7c23c521cb859113fb31aa540e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:12:5
   |
LL |     let mut vec: Vec<u8> = Vec::with_capacity(1000);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^
   |
   = note: `-D clippy::uninit-vec` implied by `-D warnings`
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:18:5
   |
LL |     vec.reserve(1000);
   |     ^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^
   |
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: calling `set_len()` on empty `Vec` creates out-of-bound values
  --> $DIR/uninit_vec.rs:24:5
   |
LL |     let mut vec: Vec<u8> = Vec::new();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^

error: calling `set_len()` on empty `Vec` creates out-of-bound values
  --> $DIR/uninit_vec.rs:30:5
   |
LL |     let mut vec: Vec<u8> = Default::default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^

error: calling `set_len()` on empty `Vec` creates out-of-bound values
  --> $DIR/uninit_vec.rs:35:5
   |
LL |     let mut vec: Vec<u8> = Vec::default();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:49:5
   |
LL |     let mut vec: Vec<u8> = Vec::with_capacity(1000);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^
   |
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:58:5
   |
LL |     my_vec.vec.reserve(1000);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         my_vec.vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:63:5
   |
LL |     my_vec.vec = Vec::with_capacity(1000);
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |     unsafe {
LL |         my_vec.vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:42:9
   |
LL |         let mut vec: Vec<u8> = Vec::with_capacity(1000);
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^
   |
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
  --> $DIR/uninit_vec.rs:45:9
   |
LL |         vec.reserve(1000);
   |         ^^^^^^^^^^^^^^^^^^
LL |         vec.set_len(200);
   |         ^^^^^^^^^^^^^^^^
   |
   = help: initialize the buffer or wrap the content in `MaybeUninit`

error: aborting due to 10 previous errors