forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
88 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,78 @@ | ||
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values | ||
--> $DIR/uninit_vec.rs:9:9 | ||
--> $DIR/uninit_vec.rs:12:5 | ||
| | ||
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | unsafe { | ||
LL | vec.set_len(200); | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `-D clippy::uninit-vec` implied by `-D warnings` | ||
note: the buffer is reserved here | ||
--> $DIR/uninit_vec.rs:7:5 | ||
| | ||
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= help: initialize the buffer or wrap the content in `MaybeUninit` | ||
|
||
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values | ||
--> $DIR/uninit_vec.rs:15:9 | ||
--> $DIR/uninit_vec.rs:18:5 | ||
| | ||
LL | vec.reserve(1000); | ||
| ^^^^^^^^^^^^^^^^^^ | ||
LL | unsafe { | ||
LL | vec.set_len(200); | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
note: the buffer is reserved here | ||
--> $DIR/uninit_vec.rs:13:5 | ||
| | ||
LL | vec.reserve(1000); | ||
| ^^^^^^^^^^^^^^^^^^ | ||
= help: initialize the buffer or wrap the content in `MaybeUninit` | ||
|
||
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values | ||
--> $DIR/uninit_vec.rs:21:9 | ||
--> $DIR/uninit_vec.rs:32:5 | ||
| | ||
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
... | ||
LL | vec.set_len(200); | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
note: the buffer is reserved here | ||
--> $DIR/uninit_vec.rs:20:9 | ||
= help: initialize the buffer or wrap the content in `MaybeUninit` | ||
|
||
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values | ||
--> $DIR/uninit_vec.rs:41:5 | ||
| | ||
LL | my_vec.vec.reserve(1000); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | unsafe { | ||
LL | my_vec.vec.set_len(200); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
= help: initialize the buffer or wrap the content in `MaybeUninit` | ||
|
||
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values | ||
--> $DIR/uninit_vec.rs:46:5 | ||
| | ||
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 | ||
--> $DIR/uninit_vec.rs:24:9 | ||
--> $DIR/uninit_vec.rs:25:9 | ||
| | ||
LL | let mut vec: Vec<u8> = Vec::with_capacity(1000); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
LL | vec.set_len(200); | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
note: the buffer is reserved here | ||
--> $DIR/uninit_vec.rs:23:9 | ||
= help: initialize the buffer or wrap the content in `MaybeUninit` | ||
|
||
error: calling `set_len()` immediately after reserving a buffer creates uninitialized values | ||
--> $DIR/uninit_vec.rs:28:9 | ||
| | ||
LL | vec.reserve(1000); | ||
| ^^^^^^^^^^^^^^^^^^ | ||
LL | vec.set_len(200); | ||
| ^^^^^^^^^^^^^^^^ | ||
| | ||
= help: initialize the buffer or wrap the content in `MaybeUninit` | ||
|
||
error: aborting due to 4 previous errors | ||
error: aborting due to 7 previous errors | ||
|