Added warning around code with reference to uninit bytes
This commit is contained in:
parent
815dec9db1
commit
23c76ff7b9
1 changed files with 8 additions and 0 deletions
|
@ -371,6 +371,14 @@ where
|
||||||
loop {
|
loop {
|
||||||
if g.len == g.buf.len() {
|
if g.len == g.buf.len() {
|
||||||
unsafe {
|
unsafe {
|
||||||
|
// FIXME(danielhenrymantilla): #42788
|
||||||
|
//
|
||||||
|
// - This creates a (mut) reference to a slice of
|
||||||
|
// _uninitialized integers_.
|
||||||
|
//
|
||||||
|
// - This having defined behavior is **unstable**:
|
||||||
|
// it could become UB in the future,
|
||||||
|
// at which point it would have be changed.
|
||||||
g.buf.reserve(reservation_size(r));
|
g.buf.reserve(reservation_size(r));
|
||||||
let capacity = g.buf.capacity();
|
let capacity = g.buf.capacity();
|
||||||
g.buf.set_len(capacity);
|
g.buf.set_len(capacity);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue