|
1 | 1 | error: calling `set_len()` immediately after reserving a buffer creates uninitialized values |
2 | | - --> $DIR/uninit_vec.rs:9:9 |
| 2 | + --> $DIR/uninit_vec.rs:12:5 |
3 | 3 | | |
| 4 | +LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); |
| 5 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | +LL | unsafe { |
4 | 7 | LL | vec.set_len(200); |
5 | 8 | | ^^^^^^^^^^^^^^^^ |
6 | 9 | | |
7 | 10 | = note: `-D clippy::uninit-vec` implied by `-D warnings` |
8 | | -note: the buffer is reserved here |
9 | | - --> $DIR/uninit_vec.rs:7:5 |
10 | | - | |
11 | | -LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); |
12 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 11 | + = help: initialize the buffer or wrap the content in `MaybeUninit` |
13 | 12 |
|
14 | 13 | error: calling `set_len()` immediately after reserving a buffer creates uninitialized values |
15 | | - --> $DIR/uninit_vec.rs:15:9 |
| 14 | + --> $DIR/uninit_vec.rs:18:5 |
16 | 15 | | |
| 16 | +LL | vec.reserve(1000); |
| 17 | + | ^^^^^^^^^^^^^^^^^^ |
| 18 | +LL | unsafe { |
17 | 19 | LL | vec.set_len(200); |
18 | 20 | | ^^^^^^^^^^^^^^^^ |
19 | 21 | | |
20 | | -note: the buffer is reserved here |
21 | | - --> $DIR/uninit_vec.rs:13:5 |
22 | | - | |
23 | | -LL | vec.reserve(1000); |
24 | | - | ^^^^^^^^^^^^^^^^^^ |
| 22 | + = help: initialize the buffer or wrap the content in `MaybeUninit` |
25 | 23 |
|
26 | 24 | error: calling `set_len()` immediately after reserving a buffer creates uninitialized values |
27 | | - --> $DIR/uninit_vec.rs:21:9 |
| 25 | + --> $DIR/uninit_vec.rs:32:5 |
28 | 26 | | |
| 27 | +LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); |
| 28 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 29 | +... |
29 | 30 | LL | vec.set_len(200); |
30 | 31 | | ^^^^^^^^^^^^^^^^ |
31 | 32 | | |
32 | | -note: the buffer is reserved here |
33 | | - --> $DIR/uninit_vec.rs:20:9 |
| 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:41:5 |
| 37 | + | |
| 38 | +LL | my_vec.vec.reserve(1000); |
| 39 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 40 | +LL | unsafe { |
| 41 | +LL | my_vec.vec.set_len(200); |
| 42 | + | ^^^^^^^^^^^^^^^^^^^^^^^ |
34 | 43 | | |
35 | | -LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); |
36 | | - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 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:46:5 |
| 48 | + | |
| 49 | +LL | my_vec.vec = Vec::with_capacity(1000); |
| 50 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 51 | +LL | unsafe { |
| 52 | +LL | my_vec.vec.set_len(200); |
| 53 | + | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 54 | + | |
| 55 | + = help: initialize the buffer or wrap the content in `MaybeUninit` |
37 | 56 |
|
38 | 57 | error: calling `set_len()` immediately after reserving a buffer creates uninitialized values |
39 | | - --> $DIR/uninit_vec.rs:24:9 |
| 58 | + --> $DIR/uninit_vec.rs:25:9 |
40 | 59 | | |
| 60 | +LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); |
| 61 | + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
41 | 62 | LL | vec.set_len(200); |
42 | 63 | | ^^^^^^^^^^^^^^^^ |
43 | 64 | | |
44 | | -note: the buffer is reserved here |
45 | | - --> $DIR/uninit_vec.rs:23:9 |
| 65 | + = help: initialize the buffer or wrap the content in `MaybeUninit` |
| 66 | + |
| 67 | +error: calling `set_len()` immediately after reserving a buffer creates uninitialized values |
| 68 | + --> $DIR/uninit_vec.rs:28:9 |
46 | 69 | | |
47 | 70 | LL | vec.reserve(1000); |
48 | 71 | | ^^^^^^^^^^^^^^^^^^ |
| 72 | +LL | vec.set_len(200); |
| 73 | + | ^^^^^^^^^^^^^^^^ |
| 74 | + | |
| 75 | + = help: initialize the buffer or wrap the content in `MaybeUninit` |
49 | 76 |
|
50 | | -error: aborting due to 4 previous errors |
| 77 | +error: aborting due to 7 previous errors |
51 | 78 |
|
0 commit comments