about summary refs log tree commit diff
path: root/src/libnative
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-05-05 16:51:30 -0700
committerbors <bors@rust-lang.org>2014-05-05 16:51:30 -0700
commitbd3fb81e5e7cd19fe3a2812efffc750007d43852 (patch)
treef37362d5d982408e05b5167163c88da33bbb098d /src/libnative
parent7583544fb541b9822dd658e5bf7aae1233cb5794 (diff)
parentedd9bad4eeb1367464e190d63113600fca0ef25a (diff)
downloadrust-bd3fb81e5e7cd19fe3a2812efffc750007d43852.tar.gz
rust-bd3fb81e5e7cd19fe3a2812efffc750007d43852.zip
auto merge of #13934 : huonw/rust/transmute-mut, r=alexcrichton
Turning a `&T` into an `&mut T` is undefined behaviour, and needs to be
done very very carefully. Providing a convenience function for exactly
this task is a bad idea, just tempting people into doing the wrong
thing.

(The right thing is to use types like `Cell`, `RefCell` or `Unsafe`.)

cc https://github.com/mozilla/rust/issues/13933
Diffstat (limited to 'src/libnative')
-rw-r--r--src/libnative/io/file_win32.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libnative/io/file_win32.rs b/src/libnative/io/file_win32.rs
index 88ba6dcbc7e..aae15a86614 100644
--- a/src/libnative/io/file_win32.rs
+++ b/src/libnative/io/file_win32.rs
@@ -174,7 +174,8 @@ impl rtio::RtioFileStream for FileDesc {
     fn tell(&self) -> Result<u64, IoError> {
         // This transmute is fine because our seek implementation doesn't
         // actually use the mutable self at all.
-        unsafe { cast::transmute_mut(self).seek(0, io::SeekCur) }
+        // FIXME #13933: Remove/justify all `&T` to `&mut T` transmutes
+        unsafe { cast::transmute::<&_, &mut FileDesc>(self).seek(0, io::SeekCur) }
     }
 
     fn fsync(&mut self) -> Result<(), IoError> {