about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Henry-Mantilla <daniel.henrymantilla@gatewatcher.com>2019-09-03 12:17:03 +0200
committerDaniel Henry-Mantilla <daniel.henrymantilla@gatewatcher.com>2019-09-03 12:18:09 +0200
commit23c76ff7b912f16f6fdbde167306b08e59353427 (patch)
tree8ec65bbd78d768792d3193caa306253430d0a380
parent815dec9db156284b4f57a4ec34182ffc89218242 (diff)
downloadrust-23c76ff7b912f16f6fdbde167306b08e59353427.tar.gz
rust-23c76ff7b912f16f6fdbde167306b08e59353427.zip
Added warning around code with reference to uninit bytes
-rw-r--r--src/libstd/io/mod.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 5060f368229..495c0c8d172 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -371,6 +371,14 @@ where
     loop {
         if g.len == g.buf.len() {
             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));
                 let capacity = g.buf.capacity();
                 g.buf.set_len(capacity);