diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-18 17:34:08 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-18 19:36:25 -0700 |
| commit | 2906f2de31d3a4709a2e028c5cefe3274df1edd2 (patch) | |
| tree | 608d302d2da9538bc12cdf286437a6cd654c7535 /src/libstd | |
| parent | 77480e8e44d9c5a6858172faeb291496314cf739 (diff) | |
| download | rust-2906f2de31d3a4709a2e028c5cefe3274df1edd2.tar.gz rust-2906f2de31d3a4709a2e028c5cefe3274df1edd2.zip | |
core: Rename 'unsafe' mod to 'cast'
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/arc.rs | 4 | ||||
| -rw-r--r-- | src/libstd/arena.rs | 2 | ||||
| -rw-r--r-- | src/libstd/dbg.rs | 2 | ||||
| -rw-r--r-- | src/libstd/par.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rope.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sync.rs | 4 |
6 files changed, 10 insertions, 10 deletions
diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index 79c407e1b99..a50e897358c 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -359,7 +359,7 @@ impl<T: Const Send> &RWARC<T> { // Whatever region the input reference had, it will be safe to use // the same region for the output reference. (The only 'unsafe' part // of this cast is removing the mutability.) - let new_data = unsafe { unsafe::transmute_immut(data) }; + let new_data = unsafe { cast::transmute_immut(data) }; // Downgrade ensured the token belonged to us. Just a sanity check. assert ptr::ref_eq(&state.data, new_data); // Produce new token @@ -390,7 +390,7 @@ fn unwrap_rw_arc<T: Const Send>(+arc: RWARC<T>) -> T { // field is never overwritten; only 'failed' and 'data'. #[doc(hidden)] fn borrow_rwlock<T: Const Send>(state: &r/mut RWARCInner<T>) -> &r/RWlock { - unsafe { unsafe::transmute_immut(&mut state.lock) } + unsafe { cast::transmute_immut(&mut state.lock) } } // FIXME (#3154) ice with struct/&<T> prevents these from being structs. diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index 73a3b2c7511..37fdf4189c9 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -25,7 +25,7 @@ export Arena, arena_with_size; use list::{List, Cons, Nil}; -use unsafe::reinterpret_cast; +use cast::reinterpret_cast; use sys::TypeDesc; use libc::size_t; diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs index 68bd363f416..01136341571 100644 --- a/src/libstd/dbg.rs +++ b/src/libstd/dbg.rs @@ -2,7 +2,7 @@ #[forbid(deprecated_pattern)]; //! Unsafe debugging functions for inspecting values. -use unsafe::reinterpret_cast; +use cast::reinterpret_cast; export debug_tydesc; export debug_opaque; diff --git a/src/libstd/par.rs b/src/libstd/par.rs index a587ad5a4cc..ae2590f9f8b 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -48,7 +48,7 @@ fn map_slices<A: Copy Send, B: Copy Send>( len * sys::size_of::<A>()); log(info, fmt!("pre-slice: %?", (base, slice))); let slice : &[A] = - unsafe::reinterpret_cast(&slice); + cast::reinterpret_cast(&slice); log(info, fmt!("slice: %?", (base, vec::len(slice), end - base))); assert(vec::len(slice) == end - base); diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index 4e7eaeccf9d..30698b8db67 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -807,18 +807,18 @@ mod node { option::Some(x) => { //FIXME (#2744): Replace with memcpy or something similar let mut local_buf: ~[u8] = - unsafe::reinterpret_cast(&*x.content); + cast::reinterpret_cast(&*x.content); let mut i = x.byte_offset; while i < x.byte_len { buf[offset] = local_buf[i]; offset += 1u; i += 1u; } - unsafe::forget(move local_buf); + cast::forget(move local_buf); } } } - return unsafe::transmute(move buf); + return cast::transmute(move buf); } /** diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index 68e9f24a863..f5528f7a79c 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -779,7 +779,7 @@ mod tests { let ptr = ptr::addr_of(*sharedstate); do task::spawn { let sharedstate: &mut int = - unsafe { unsafe::reinterpret_cast(&ptr) }; + unsafe { cast::reinterpret_cast(&ptr) }; access_shared(sharedstate, m2, 10); c.send(()); @@ -1051,7 +1051,7 @@ mod tests { let ptr = ptr::addr_of(*sharedstate); do task::spawn { let sharedstate: &mut int = - unsafe { unsafe::reinterpret_cast(&ptr) }; + unsafe { cast::reinterpret_cast(&ptr) }; access_shared(sharedstate, x2, mode1, 10); c.send(()); } |
