about summary refs log tree commit diff
path: root/src/libstd/sys.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys.rs')
-rw-r--r--src/libstd/sys.rs20
1 files changed, 6 insertions, 14 deletions
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs
index 0c497ecef27..28cd2345aab 100644
--- a/src/libstd/sys.rs
+++ b/src/libstd/sys.rs
@@ -123,13 +123,9 @@ pub trait FailWithCause {
 
 impl FailWithCause for ~str {
     fn fail_with(cause: ~str, file: &'static str, line: uint) -> ! {
-        do cause.as_buf |msg_buf, _msg_len| {
-            do file.as_buf |file_buf, _file_len| {
-                unsafe {
-                    let msg_buf = cast::transmute(msg_buf);
-                    let file_buf = cast::transmute(file_buf);
-                    begin_unwind_(msg_buf, file_buf, line as libc::size_t)
-                }
+        do cause.as_c_str |msg_buf| {
+            do file.as_c_str |file_buf| {
+                begin_unwind_(msg_buf, file_buf, line as libc::size_t)
             }
         }
     }
@@ -137,13 +133,9 @@ impl FailWithCause for ~str {
 
 impl FailWithCause for &'static str {
     fn fail_with(cause: &'static str, file: &'static str, line: uint) -> ! {
-        do cause.as_buf |msg_buf, _msg_len| {
-            do file.as_buf |file_buf, _file_len| {
-                unsafe {
-                    let msg_buf = cast::transmute(msg_buf);
-                    let file_buf = cast::transmute(file_buf);
-                    begin_unwind_(msg_buf, file_buf, line as libc::size_t)
-                }
+        do cause.as_c_str |msg_buf| {
+            do file.as_c_str |file_buf| {
+                begin_unwind_(msg_buf, file_buf, line as libc::size_t)
             }
         }
     }