Skip to content

Commit 140e793

Browse files
committed
Auto merge of #29131 - apasel422:transmute, r=bluss
2 parents 3f2ad61 + 6031a58 commit 140e793

File tree

5 files changed

+5
-20
lines changed

5 files changed

+5
-20
lines changed

src/liballoc/boxed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ pub struct IntermediateBox<T: ?Sized> {
137137

138138
impl<T> Place<T> for IntermediateBox<T> {
139139
fn pointer(&mut self) -> *mut T {
140-
unsafe { ::core::mem::transmute(self.ptr) }
140+
self.ptr as *mut T
141141
}
142142
}
143143

src/librbml/lib.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -932,15 +932,6 @@ pub mod writer {
932932
}
933933
}
934934

935-
/// FIXME(pcwalton): Workaround for badness in trans. DO NOT USE ME.
936-
pub unsafe fn unsafe_clone(&self) -> Encoder<'a> {
937-
Encoder {
938-
writer: mem::transmute_copy(&self.writer),
939-
size_positions: self.size_positions.clone(),
940-
relax_limit: self.relax_limit,
941-
}
942-
}
943-
944935
pub fn start_tag(&mut self, tag_id: usize) -> EncodeResult {
945936
debug!("Start tag {:?}", tag_id);
946937
assert!(tag_id >= NUM_IMPLICIT_TAGS);

src/librustc_llvm/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub use self::DLLStorageClassTypes::*;
6060

6161
use std::ffi::CString;
6262
use std::cell::RefCell;
63-
use std::{slice, mem};
63+
use std::slice;
6464
use libc::{c_uint, c_ushort, uint64_t, c_int, size_t, c_char};
6565
use libc::{c_longlong, c_ulonglong, c_void};
6666
use debuginfo::{DIBuilderRef, DIDescriptor,
@@ -2307,7 +2307,7 @@ pub unsafe extern "C" fn rust_llvm_string_write_impl(sr: RustStringRef,
23072307
size: size_t) {
23082308
let slice = slice::from_raw_parts(ptr as *const u8, size as usize);
23092309

2310-
let sr: RustStringRepr = mem::transmute(sr);
2310+
let sr = sr as RustStringRepr;
23112311
(*sr).borrow_mut().push_all(slice);
23122312
}
23132313

src/librustc_trans/trans/base.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ use libc::c_uint;
8989
use std::ffi::{CStr, CString};
9090
use std::cell::{Cell, RefCell};
9191
use std::collections::{HashMap, HashSet};
92-
use std::mem;
9392
use std::str;
9493
use std::{i8, i16, i32, i64};
9594
use syntax::abi::{Rust, RustCall, RustIntrinsic, PlatformIntrinsic, Abi};
@@ -2664,11 +2663,7 @@ impl Iterator for ValueIter {
26642663
fn next(&mut self) -> Option<ValueRef> {
26652664
let old = self.cur;
26662665
if !old.is_null() {
2667-
self.cur = unsafe {
2668-
let step: unsafe extern "C" fn(ValueRef) -> ValueRef =
2669-
mem::transmute_copy(&self.step);
2670-
step(old)
2671-
};
2666+
self.cur = unsafe { (self.step)(old) };
26722667
Some(old)
26732668
} else {
26742669
None

src/libstd/dynamic_lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use prelude::v1::*;
2222

2323
use env;
2424
use ffi::{CString, OsString};
25-
use mem;
2625
use path::{Path, PathBuf};
2726

2827
pub struct DynamicLibrary {
@@ -114,7 +113,7 @@ impl DynamicLibrary {
114113
// the destructor does not run.
115114
match maybe_symbol_value {
116115
Err(err) => Err(err),
117-
Ok(symbol_value) => Ok(mem::transmute(symbol_value))
116+
Ok(symbol_value) => Ok(symbol_value as *mut T)
118117
}
119118
}
120119
}

0 commit comments

Comments
 (0)