2021-10-21 11:11:36 +00:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:17:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
2022-09-22 16:04:22 +00:00
|
|
|
= note: `-D clippy::uninit-vec` implied by `-D warnings`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::uninit_vec)]`
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:24:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:31:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::new();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:38:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Default::default();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:44:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::default();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:61:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:71:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | my_vec.vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:77:5
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | my_vec.vec = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2021-10-21 11:11:36 +00:00
|
|
|
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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:52:9
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL |
|
2021-10-21 11:11:36 +00:00
|
|
|
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
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:56:9
|
2021-10-21 11:11:36 +00:00
|
|
|
|
|
|
|
|
LL | vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
LL |
|
2021-10-21 11:11:36 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
2023-03-24 13:04:35 +00:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2024-02-17 12:16:29 +00:00
|
|
|
--> tests/ui/uninit_vec.rs:132:9
|
2023-03-24 13:04:35 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<T> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 19:32:12 +00:00
|
|
|
...
|
2023-03-24 13:04:35 +00:00
|
|
|
LL | vec.set_len(10);
|
|
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
|
|
error: aborting due to 11 previous errors
|
2021-10-21 11:11:36 +00:00
|
|
|
|