Skip to content

Commit 23c76ff

Browse files
author
Daniel Henry-Mantilla
committed
Added warning around code with reference to uninit bytes
1 parent 815dec9 commit 23c76ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libstd/io/mod.rs

+8
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ where
371371
loop {
372372
if g.len == g.buf.len() {
373373
unsafe {
374+
// FIXME(danielhenrymantilla): #42788
375+
//
376+
// - This creates a (mut) reference to a slice of
377+
// _uninitialized integers_.
378+
//
379+
// - This having defined behavior is **unstable**:
380+
// it could become UB in the future,
381+
// at which point it would have be changed.
374382
g.buf.reserve(reservation_size(r));
375383
let capacity = g.buf.capacity();
376384
g.buf.set_len(capacity);

0 commit comments

Comments
 (0)