2021-09-17 06:55:26 +00:00
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2021-09-20 19:32:53 +00:00
|
|
|
--> $DIR/uninit_vec.rs:12:5
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
2021-09-17 06:55:26 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= note: `-D clippy::uninit-vec` implied by `-D warnings`
|
2021-09-20 19:32:53 +00:00
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2021-09-20 19:32:53 +00:00
|
|
|
--> $DIR/uninit_vec.rs:18:5
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
LL | vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
2021-09-17 06:55:26 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
2021-09-17 06:55:26 +00:00
|
|
|
|
2021-10-07 15:53:08 +00:00
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:24:5
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Vec::new();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-07 15:53:08 +00:00
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:30:5
|
|
|
|
|
|
|
|
|
LL | let mut vec: Vec<u8> = Default::default();
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-10-07 15:53:08 +00:00
|
|
|
error: calling `set_len()` on empty `Vec` creates out-of-bound values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:35:5
|
|
|
|
|
|
|
|
|
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
|
|
|
|
--> $DIR/uninit_vec.rs:49:5
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
...
|
2021-09-17 06:55:26 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:58:5
|
2021-09-20 19:32:53 +00:00
|
|
|
|
|
|
|
|
LL | my_vec.vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
LL | unsafe {
|
|
|
|
LL | my_vec.vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:63:5
|
2021-09-20 19:32:53 +00: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`
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:42:9
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-09-17 06:55:26 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
2021-09-20 19:32:53 +00:00
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
|
|
|
|
|
|
|
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values
|
2021-10-07 15:18:01 +00:00
|
|
|
--> $DIR/uninit_vec.rs:45:9
|
2021-09-17 06:55:26 +00:00
|
|
|
|
|
|
|
|
LL | vec.reserve(1000);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
2021-09-20 19:32:53 +00:00
|
|
|
LL | vec.set_len(200);
|
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
= help: initialize the buffer or wrap the content in `MaybeUninit`
|
2021-09-17 06:55:26 +00:00
|
|
|
|
2021-10-07 15:18:01 +00:00
|
|
|
error: aborting due to 10 previous errors
|
2021-09-17 06:55:26 +00:00
|
|
|
|