diff options
| author | bors <bors@rust-lang.org> | 2015-08-10 18:46:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-10 18:46:21 +0000 |
| commit | 3d69bec88119e0471a98cd2075fcf53c43ebca3e (patch) | |
| tree | b84fecb519b6883f4d75d521a90f9d476782e4cb /src/libstd/sys | |
| parent | 96a1f40402cdd05d29d1f1c0b62001254db8dcf6 (diff) | |
| parent | 33af24ca4c2a6edaed0509a5b9ac3fde964a2847 (diff) | |
| download | rust-3d69bec88119e0471a98cd2075fcf53c43ebca3e.tar.gz rust-3d69bec88119e0471a98cd2075fcf53c43ebca3e.zip | |
Auto merge of #27252 - tbu-:pr_less_transmutes, r=alexcrichton
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`. This builds upon #27233.
Diffstat (limited to 'src/libstd/sys')
| -rw-r--r-- | src/libstd/sys/unix/backtrace.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs index ae8bfb07aaf..4128431ee64 100644 --- a/src/libstd/sys/unix/backtrace.rs +++ b/src/libstd/sys/unix/backtrace.rs @@ -90,7 +90,6 @@ use io::prelude::*; use ffi::CStr; use io; use libc; -use mem; use str; use sync::StaticMutex; @@ -168,7 +167,7 @@ pub fn write(w: &mut Write) -> io::Result<()> { extern fn trace_fn(ctx: *mut uw::_Unwind_Context, arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code { - let cx: &mut Context = unsafe { mem::transmute(arg) }; + let cx: &mut Context = unsafe { &mut *(arg as *mut Context) }; let mut ip_before_insn = 0; let mut ip = unsafe { uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void |
