2021-10-21 06:11:36 -05:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:17:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
2022-09-22 11:04:22 -05:00
|
|
|
= note: `-D clippy::uninit-vec` implied by `-D warnings`
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:23:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:29:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:35:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:40:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:54:5
|
2021-10-21 06:11:36 -05: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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:63:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:68:5
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:47:9
|
2021-10-21 06:11:36 -05: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
|
2023-03-18 17:22:04 -05:00
|
|
|
--> $DIR/uninit_vec.rs:50:9
|
2021-10-21 06:11:36 -05:00
|
|
|
|
|
|
|
|
LL | vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
2023-03-18 17:22:04 -05:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
|
|
|
--> $DIR/uninit_vec.rs:122:9
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<T> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
|
|
|
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 06:11:36 -05:00
|
|
|
|