2021-10-21 13:11:36 +02:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2024-08-06 01:53:50 +02:00
|
|
|
--> tests/ui/uninit_vec.rs:18:5
|
|
|
|
|
|
|
|
|
|
|
LL | let mut vec = Vec::<UnsafeCell<*mut S>>::with_capacity(1);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2025-02-11 17:57:08 +01:00
|
|
|
LL |
|
2024-08-06 01:53:50 +02:00
|
|
|
LL | vec.set_len(1);
|
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
= note: `-D clippy::uninit-vec` implied by `-D warnings`
|
|
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::uninit_vec)]`
|
|
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:25:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02: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
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:33:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | vec.reserve(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02: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
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:41:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::new();
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:49:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Default::default();
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:56:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::default();
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:76:5
|
2021-10-21 13:11:36 +02: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
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:87:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | my_vec.vec.reserve(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02: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
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:94:5
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | my_vec.vec = Vec::with_capacity(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2021-10-21 13:11:36 +02: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
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:65:9
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2025-02-11 17:57:08 +01:00
|
|
|
...
|
2021-10-21 13:11:36 +02: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
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:70:9
|
2021-10-21 13:11:36 +02:00
|
|
|
|
|
|
|
|
|
LL | vec.reserve(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2025-02-11 17:57:08 +01:00
|
|
|
...
|
2021-10-21 13:11:36 +02:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
2023-03-24 14:04:35 +01:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:150:9
|
2023-03-24 14:04:35 +01:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<T> = Vec::with_capacity(1000);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2023-08-24 21:32:12 +02:00
|
|
|
...
|
2023-03-24 14:04:35 +01:00
|
|
|
LL | vec.set_len(10);
|
|
|
|
|
| ^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
2024-09-07 17:06:32 +02:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:178:9
|
2024-09-07 17:06:32 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<Recursive<T>> = Vec::with_capacity(1);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
...
|
|
|
|
|
LL | vec.set_len(1);
|
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2025-02-11 17:57:08 +01:00
|
|
|
--> tests/ui/uninit_vec.rs:192:9
|
2024-09-07 17:06:32 +02:00
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<Enum<T>> = Vec::with_capacity(1);
|
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
...
|
|
|
|
|
LL | vec.set_len(1);
|
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
|
|
|
|
error: aborting due to 14 previous errors
|
2021-10-21 13:11:36 +02:00
|
|
|
|