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