Skip to content

Commit 5d9abbc

Browse files
committed
---
yaml --- r: 28585 b: refs/heads/try c: 2906f2d h: refs/heads/master i: 28583: 9a1504a v: v3
1 parent 6db9c61 commit 5d9abbc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+219
-219
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 77480e8e44d9c5a6858172faeb291496314cf739
5+
refs/heads/try: 2906f2de31d3a4709a2e028c5cefe3274df1edd2
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libcore/at_vec.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extern mod rusti {
2929
pure fn capacity<T>(&&v: @[const T]) -> uint {
3030
unsafe {
3131
let repr: **raw::VecRepr =
32-
::unsafe::reinterpret_cast(&addr_of(v));
32+
::cast::reinterpret_cast(&addr_of(v));
3333
(**repr).unboxed.alloc / sys::size_of::<T>()
3434
}
3535
}
@@ -154,13 +154,13 @@ mod raw {
154154
*/
155155
#[inline(always)]
156156
unsafe fn set_len<T>(&&v: @[const T], new_len: uint) {
157-
let repr: **VecRepr = ::unsafe::reinterpret_cast(&addr_of(v));
157+
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
158158
(**repr).unboxed.fill = new_len * sys::size_of::<T>();
159159
}
160160

161161
#[inline(always)]
162162
unsafe fn push<T>(&v: @[const T], +initval: T) {
163-
let repr: **VecRepr = ::unsafe::reinterpret_cast(&addr_of(v));
163+
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
164164
let fill = (**repr).unboxed.fill;
165165
if (**repr).unboxed.alloc > fill {
166166
push_fast(v, move initval);
@@ -172,7 +172,7 @@ mod raw {
172172
// This doesn't bother to make sure we have space.
173173
#[inline(always)] // really pretty please
174174
unsafe fn push_fast<T>(&v: @[const T], +initval: T) {
175-
let repr: **VecRepr = ::unsafe::reinterpret_cast(&addr_of(v));
175+
let repr: **VecRepr = ::cast::reinterpret_cast(&addr_of(v));
176176
let fill = (**repr).unboxed.fill;
177177
(**repr).unboxed.fill += sys::size_of::<T>();
178178
let p = ptr::addr_of((**repr).unboxed.data);
File renamed without changes.

branches/try/src/libcore/cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use libc::{c_char, c_void, intptr_t, uintptr_t};
22
use ptr::{mut_null, null, to_unsafe_ptr};
33
use repr::BoxRepr;
44
use sys::TypeDesc;
5-
use unsafe::transmute;
5+
use cast::transmute;
66

77
export annihilate;
88

branches/try/src/libcore/comm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ fn send<T: Send>(ch: Chan<T>, +data: T) {
181181
let res = rustrt::rust_port_id_send(p, data_ptr);
182182
if res != 0 unsafe {
183183
// Data sent successfully
184-
unsafe::forget(move data);
184+
cast::forget(move data);
185185
}
186186
task::yield();
187187
}

branches/try/src/libcore/core.rc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export uint, u8, u16, u32, u64;
4141
export float, f32, f64;
4242
export box, char, str, ptr, vec, at_vec, bool;
4343
export either, option, result, iter;
44-
export gc, io, libc, os, run, rand, sys, unsafe, logging;
44+
export gc, io, libc, os, run, rand, sys, cast, logging;
4545
export comm, task, future, pipes;
4646
export extfmt;
4747
// The test harness links against core, so don't include runtime in tests.
@@ -228,7 +228,7 @@ mod path;
228228
mod rand;
229229
mod run;
230230
mod sys;
231-
mod unsafe;
231+
mod cast;
232232
mod mutable;
233233
mod flate;
234234
mod repr;

branches/try/src/libcore/dvec.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//
1010
// Note that recursive use is not permitted.
1111

12-
use unsafe::reinterpret_cast;
12+
use cast::reinterpret_cast;
1313
use ptr::null;
1414

1515
export DVec;
@@ -81,7 +81,7 @@ fn unwrap<A>(+d: DVec<A>) -> ~[A] {
8181
priv impl<A> DVec<A> {
8282
pure fn check_not_borrowed() {
8383
unsafe {
84-
let data: *() = unsafe::reinterpret_cast(&self.data);
84+
let data: *() = cast::reinterpret_cast(&self.data);
8585
if data.is_null() {
8686
fail ~"Recursive use of dvec";
8787
}
@@ -91,9 +91,9 @@ priv impl<A> DVec<A> {
9191
#[inline(always)]
9292
fn check_out<B>(f: fn(-~[A]) -> B) -> B {
9393
unsafe {
94-
let mut data = unsafe::reinterpret_cast(&null::<()>());
94+
let mut data = cast::reinterpret_cast(&null::<()>());
9595
data <-> self.data;
96-
let data_ptr: *() = unsafe::reinterpret_cast(&data);
96+
let data_ptr: *() = cast::reinterpret_cast(&data);
9797
if data_ptr.is_null() { fail ~"Recursive use of dvec"; }
9898
return f(move data);
9999
}
@@ -168,9 +168,9 @@ impl<A> DVec<A> {
168168
/// Insert a single item at the front of the list
169169
fn unshift(-t: A) {
170170
unsafe {
171-
let mut data = unsafe::reinterpret_cast(&null::<()>());
171+
let mut data = cast::reinterpret_cast(&null::<()>());
172172
data <-> self.data;
173-
let data_ptr: *() = unsafe::reinterpret_cast(&data);
173+
let data_ptr: *() = cast::reinterpret_cast(&data);
174174
if data_ptr.is_null() { fail ~"Recursive use of dvec"; }
175175
log(error, ~"a");
176176
self.data <- ~[move t];

branches/try/src/libcore/future.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use either::Either;
1919
use pipes::recv;
20-
use unsafe::copy_lifetime;
20+
use cast::copy_lifetime;
2121

2222
export Future;
2323
export extensions;

branches/try/src/libcore/gc.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ extern mod rustrt {
5555
}
5656

5757
unsafe fn bump<T, U>(ptr: *T, count: uint) -> *U {
58-
return unsafe::reinterpret_cast(&ptr::offset(ptr, count));
58+
return cast::reinterpret_cast(&ptr::offset(ptr, count));
5959
}
6060

6161
unsafe fn align_to_pointer<T>(ptr: *T) -> *T {
6262
let align = sys::min_align_of::<*T>();
63-
let ptr: uint = unsafe::reinterpret_cast(&ptr);
63+
let ptr: uint = cast::reinterpret_cast(&ptr);
6464
let ptr = (ptr + (align - 1)) & -align;
65-
return unsafe::reinterpret_cast(&ptr);
65+
return cast::reinterpret_cast(&ptr);
6666
}
6767

6868
unsafe fn get_safe_point_count() -> uint {
@@ -101,8 +101,8 @@ type Visitor = fn(root: **Word, tydesc: *Word) -> bool;
101101
// Walks the list of roots for the given safe point, and calls visitor
102102
// on each root.
103103
unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) {
104-
let fp_bytes: *u8 = unsafe::reinterpret_cast(&fp);
105-
let sp_meta: *u32 = unsafe::reinterpret_cast(&sp.sp_meta);
104+
let fp_bytes: *u8 = cast::reinterpret_cast(&fp);
105+
let sp_meta: *u32 = cast::reinterpret_cast(&sp.sp_meta);
106106

107107
let num_stack_roots = *sp_meta as uint;
108108
let num_reg_roots = *ptr::offset(sp_meta, 1) as uint;
@@ -143,9 +143,9 @@ unsafe fn walk_safe_point(fp: *Word, sp: SafePoint, visitor: Visitor) {
143143

144144
// Is fp contained in segment?
145145
unsafe fn is_frame_in_segment(fp: *Word, segment: *StackSegment) -> bool {
146-
let begin: Word = unsafe::reinterpret_cast(&segment);
147-
let end: Word = unsafe::reinterpret_cast(&(*segment).end);
148-
let frame: Word = unsafe::reinterpret_cast(&fp);
146+
let begin: Word = cast::reinterpret_cast(&segment);
147+
let end: Word = cast::reinterpret_cast(&(*segment).end);
148+
let frame: Word = cast::reinterpret_cast(&fp);
149149

150150
return begin <= frame && frame <= end;
151151
}
@@ -315,7 +315,7 @@ fn cleanup_stack_for_failure() {
315315
// own stack roots on the stack anyway.
316316
let sentinel_box = ~0;
317317
let sentinel: **Word = if expect_sentinel() {
318-
unsafe::reinterpret_cast(&ptr::addr_of(sentinel_box))
318+
cast::reinterpret_cast(&ptr::addr_of(sentinel_box))
319319
} else {
320320
ptr::null()
321321
};

branches/try/src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ fn with_str_writer(f: fn(Writer)) -> ~str {
721721
vec::push(v, 0);
722722
assert str::is_utf8(v);
723723
724-
unsafe { move ::unsafe::transmute(v) }
724+
unsafe { move ::cast::transmute(v) }
725725
}
726726
727727
// Utility functions

branches/try/src/libcore/mutable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mutation when the data structure should be immutable.
1313
#[forbid(deprecated_pattern)];
1414

1515
use util::with;
16-
use unsafe::transmute_immut;
16+
use cast::transmute_immut;
1717

1818
export Mut;
1919

branches/try/src/libcore/os.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ mod global_env {
222222
fn getenv(n: &str) -> Option<~str> {
223223
unsafe {
224224
let s = str::as_c_str(n, libc::getenv);
225-
return if ptr::null::<u8>() == unsafe::reinterpret_cast(&s) {
225+
return if ptr::null::<u8>() == cast::reinterpret_cast(&s) {
226226
option::None::<~str>
227227
} else {
228-
let s = unsafe::reinterpret_cast(&s);
228+
let s = cast::reinterpret_cast(&s);
229229
option::Some::<~str>(str::raw::from_buf(s))
230230
};
231231
}

branches/try/src/libcore/pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ bounded and unbounded protocols allows for less code duplication.
7777
#[forbid(deprecated_pattern)];
7878

7979
use cmp::Eq;
80-
use unsafe::{forget, reinterpret_cast, transmute};
80+
use cast::{forget, reinterpret_cast, transmute};
8181
use either::{Either, Left, Right};
8282
use option::unwrap;
8383

0 commit comments

Comments
 (0)