diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-12 17:45:23 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-12 17:45:36 -0700 |
| commit | ff54ac8e598bfc71e827c0b60e392c5f0fbd4d7e (patch) | |
| tree | c5c20cafe2c415f1f3aecbc2fa60770e3ca9f1e3 /src | |
| parent | 37cf649311bcf6fec2d9096b483ac4be81b70732 (diff) | |
| download | rust-ff54ac8e598bfc71e827c0b60e392c5f0fbd4d7e.tar.gz rust-ff54ac8e598bfc71e827c0b60e392c5f0fbd4d7e.zip | |
Rename vec::unsafe to vec::raw
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/at_vec.rs | 6 | ||||
| -rw-r--r-- | src/libcore/flate.rs | 4 | ||||
| -rw-r--r-- | src/libcore/io.rs | 6 | ||||
| -rw-r--r-- | src/libcore/ptr.rs | 12 | ||||
| -rw-r--r-- | src/libcore/str.rs | 14 | ||||
| -rw-r--r-- | src/libcore/uint-template.rs | 2 | ||||
| -rw-r--r-- | src/libcore/vec.rs | 66 | ||||
| -rw-r--r-- | src/libstd/arena.rs | 6 | ||||
| -rw-r--r-- | src/libstd/net_tcp.rs | 4 | ||||
| -rw-r--r-- | src/libstd/uv_ll.rs | 10 | ||||
| -rw-r--r-- | src/rustc/lib/llvm.rs | 6 | ||||
| -rw-r--r-- | src/rustc/metadata/loader.rs | 4 | ||||
| -rw-r--r-- | src/rustc/middle/trans/base.rs | 2 | ||||
| -rw-r--r-- | src/rustc/middle/trans/build.rs | 20 | ||||
| -rw-r--r-- | src/rustc/middle/trans/common.rs | 10 | ||||
| -rw-r--r-- | src/rustc/middle/trans/debuginfo.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass/foreign-fn-linkname.rs | 2 |
17 files changed, 88 insertions, 88 deletions
diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index e2749a5bd57..4fbc05821f8 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -15,7 +15,7 @@ export unsafe; #[abi = "cdecl"] extern mod rustrt { fn vec_reserve_shared_actual(++t: *sys::TypeDesc, - ++v: **vec::unsafe::VecRepr, + ++v: **vec::raw::VecRepr, ++n: libc::size_t); } @@ -142,8 +142,8 @@ impl<T: Copy> @[T]: Add<&[const T],@[T]> { mod unsafe { - type VecRepr = vec::unsafe::VecRepr; - type SliceRepr = vec::unsafe::SliceRepr; + type VecRepr = vec::raw::VecRepr; + type SliceRepr = vec::raw::SliceRepr; /** * Sets the length of a vector diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index fbd6e731e3b..836ffabd0fc 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -28,7 +28,7 @@ fn deflate_buf(buf: &[const u8]) -> ~[u8] { ptr::addr_of(outsz), lz_norm); assert res as int != 0; - let out = vec::unsafe::from_buf(res as *u8, + let out = vec::raw::from_buf(res as *u8, outsz as uint); libc::free(res); move out @@ -46,7 +46,7 @@ fn inflate_buf(buf: &[const u8]) -> ~[u8] { ptr::addr_of(outsz), 0); assert res as int != 0; - let out = vec::unsafe::from_buf(res as *u8, + let out = vec::raw::from_buf(res as *u8, outsz as uint); libc::free(res); move out diff --git a/src/libcore/io.rs b/src/libcore/io.rs index 9d4176ea40b..5f96345d783 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -53,11 +53,11 @@ impl<T: Reader> T : ReaderUtil { fn read_bytes(len: uint) -> ~[u8] { let mut buf = ~[mut]; vec::reserve(buf, len); - unsafe { vec::unsafe::set_len(buf, len); } + unsafe { vec::raw::set_len(buf, len); } let count = self.read(buf, len); - unsafe { vec::unsafe::set_len(buf, count); } + unsafe { vec::raw::set_len(buf, count); } vec::from_mut(move buf) } fn read_line() -> ~str { @@ -682,7 +682,7 @@ impl MemBuffer: Writer { let count = uint::max(buf_len, self.pos + v_len); vec::reserve(buf, count); - unsafe { vec::unsafe::set_len(buf, count); } + unsafe { vec::raw::set_len(buf, count); } vec::u8::memcpy(vec::mut_view(buf, self.pos, count), v, v_len); diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 79ec6fea668..c95e2aa6c7c 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -265,14 +265,14 @@ fn test() { let mut v0 = ~[32000u16, 32001u16, 32002u16]; let mut v1 = ~[0u16, 0u16, 0u16]; - ptr::memcpy(ptr::mut_offset(vec::unsafe::to_mut_ptr(v1), 1u), - ptr::offset(vec::unsafe::to_ptr(v0), 1u), 1u); + ptr::memcpy(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 1u), + ptr::offset(vec::raw::to_ptr(v0), 1u), 1u); assert (v1[0] == 0u16 && v1[1] == 32001u16 && v1[2] == 0u16); - ptr::memcpy(vec::unsafe::to_mut_ptr(v1), - ptr::offset(vec::unsafe::to_ptr(v0), 2u), 1u); + ptr::memcpy(vec::raw::to_mut_ptr(v1), + ptr::offset(vec::raw::to_ptr(v0), 2u), 1u); assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 0u16); - ptr::memcpy(ptr::mut_offset(vec::unsafe::to_mut_ptr(v1), 2u), - vec::unsafe::to_ptr(v0), 1u); + ptr::memcpy(ptr::mut_offset(vec::raw::to_mut_ptr(v1), 2u), + vec::raw::to_ptr(v0), 1u); assert (v1[0] == 32002u16 && v1[1] == 32001u16 && v1[2] == 32000u16); } } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 88858e2b1ab..88eb4a8d87d 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -439,7 +439,7 @@ Section: Transforming strings */ pure fn to_bytes(s: &str) -> ~[u8] unsafe { let mut v: ~[u8] = ::unsafe::transmute(from_slice(s)); - vec::unsafe::set_len(v, len(s)); + vec::raw::set_len(v, len(s)); move v } @@ -447,7 +447,7 @@ pure fn to_bytes(s: &str) -> ~[u8] unsafe { #[inline(always)] pure fn byte_slice<T>(s: &str, f: fn(v: &[u8]) -> T) -> T { do as_buf(s) |p,n| { - unsafe { vec::unsafe::form_slice(p, n-1u, f) } + unsafe { vec::raw::form_slice(p, n-1u, f) } } } @@ -1996,7 +1996,7 @@ mod unsafe { let vbuf = ::unsafe::transmute_mut_unsafe(vbuf); ptr::memcpy(vbuf, buf as *u8, len) }); - vec::unsafe::set_len(v, len); + vec::raw::set_len(v, len); vec::push(v, 0u8); assert is_utf8(v); @@ -2054,7 +2054,7 @@ mod unsafe { let src = ptr::offset(sbuf, begin); ptr::memcpy(vbuf, src, end - begin); } - vec::unsafe::set_len(v, end - begin); + vec::raw::set_len(v, end - begin); vec::push(v, 0u8); ::unsafe::transmute(move v) } @@ -2118,7 +2118,7 @@ mod unsafe { /// Sets the length of the string and adds the null terminator unsafe fn set_len(&v: ~str, new_len: uint) { - let repr: *vec::unsafe::VecRepr = ::unsafe::reinterpret_cast(&v); + let repr: *vec::raw::VecRepr = ::unsafe::reinterpret_cast(&v); (*repr).fill = new_len + 1u; let null = ptr::mut_offset(ptr::mut_addr_of((*repr).data), new_len); *null = 0u8; @@ -2128,7 +2128,7 @@ mod unsafe { fn test_from_buf_len() { unsafe { let a = ~[65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8]; - let b = vec::unsafe::to_ptr(a); + let b = vec::raw::to_ptr(a); let c = from_buf_len(b, 3u); assert (c == ~"AAA"); } @@ -2940,7 +2940,7 @@ mod tests { fn test_from_buf() { unsafe { let a = ~[65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 65u8, 0u8]; - let b = vec::unsafe::to_ptr(a); + let b = vec::raw::to_ptr(a); let c = unsafe::from_buf(b); assert (c == ~"AAAAAAA"); } diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 1da46d780be..879ba684698 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -239,7 +239,7 @@ pure fn to_str_bytes<U>(neg: bool, num: T, radix: uint, *ptr::mut_offset(mp, i) = '-' as u8; } - vec::unsafe::form_slice(ptr::offset(p, i), + vec::raw::form_slice(ptr::offset(p, i), len - i, f) } } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 62cc5ce6f60..626cb886fb3 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -87,7 +87,7 @@ export windowed; export as_buf; export as_mut_buf; export as_const_buf; -export unsafe; +export raw; export u8; export extensions; export ConstVector; @@ -101,7 +101,7 @@ export vec_concat; #[abi = "cdecl"] extern mod rustrt { fn vec_reserve_shared(++t: *sys::TypeDesc, - ++v: **unsafe::VecRepr, + ++v: **raw::VecRepr, ++n: libc::size_t); } @@ -139,7 +139,7 @@ pure fn same_length<T, U>(xs: &[const T], ys: &[const U]) -> bool { fn reserve<T>(&v: ~[const T], n: uint) { // Only make the (slow) call into the runtime if we have to if capacity(v) < n { - let ptr = ptr::addr_of(v) as **unsafe::VecRepr; + let ptr = ptr::addr_of(v) as **raw::VecRepr; rustrt::vec_reserve_shared(sys::get_type_desc::<T>(), ptr, n as size_t); } @@ -168,7 +168,7 @@ fn reserve_at_least<T>(&v: ~[const T], n: uint) { #[inline(always)] pure fn capacity<T>(&&v: ~[const T]) -> uint { unsafe { - let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(&addr_of(v)); + let repr: **raw::VecRepr = ::unsafe::reinterpret_cast(&addr_of(v)); (**repr).alloc / sys::size_of::<T>() } } @@ -189,8 +189,8 @@ pure fn from_fn<T>(n_elts: uint, op: iter::InitOp<T>) -> ~[T] { let mut v = ~[]; unchecked{reserve(v, n_elts);} let mut i: uint = 0u; - while i < n_elts unsafe { unsafe::set(v, i, op(i)); i += 1u; } - unsafe { unsafe::set_len(v, n_elts); } + while i < n_elts unsafe { raw::set(v, i, op(i)); i += 1u; } + unsafe { raw::set_len(v, n_elts); } move v } @@ -205,8 +205,8 @@ pure fn from_elem<T: Copy>(n_elts: uint, t: T) -> ~[T] { unchecked{reserve(v, n_elts)} let mut i: uint = 0u; unsafe { // because unsafe::set is unsafe - while i < n_elts { unsafe::set(v, i, t); i += 1u; } - unsafe { unsafe::set_len(v, n_elts); } + while i < n_elts { raw::set(v, i, t); i += 1u; } + unsafe { raw::set_len(v, n_elts); } } move v } @@ -478,7 +478,7 @@ fn shift<T>(&v: ~[T]) -> T { unsafe { let mut rr; { - let vv = unsafe::to_ptr(vv); + let vv = raw::to_ptr(vv); rr <- *vv; for uint::range(1, ln) |i| { @@ -486,7 +486,7 @@ fn shift<T>(&v: ~[T]) -> T { push(v, move r); } } - unsafe::set_len(vv, 0); + raw::set_len(vv, 0); move rr } @@ -509,7 +509,7 @@ fn consume<T>(+v: ~[T], f: fn(uint, +T)) unsafe { } } - unsafe::set_len(v, 0); + raw::set_len(v, 0); } fn consume_mut<T>(+v: ~[mut T], f: fn(uint, +T)) unsafe { @@ -520,7 +520,7 @@ fn consume_mut<T>(+v: ~[mut T], f: fn(uint, +T)) unsafe { } } - unsafe::set_len(v, 0); + raw::set_len(v, 0); } /// Remove the last element from a vector and return it @@ -532,7 +532,7 @@ fn pop<T>(&v: ~[const T]) -> T { let valptr = ptr::mut_addr_of(v[ln - 1u]); unsafe { let val <- *valptr; - unsafe::set_len(v, ln - 1u); + raw::set_len(v, ln - 1u); move val } } @@ -555,7 +555,7 @@ fn swap_remove<T>(&v: ~[const T], index: uint) -> T { let valptr = ptr::mut_addr_of(v[index]); *valptr <-> val; } - unsafe::set_len(v, ln - 1); + raw::set_len(v, ln - 1); move val } } @@ -564,7 +564,7 @@ fn swap_remove<T>(&v: ~[const T], index: uint) -> T { #[inline(always)] fn push<T>(&v: ~[const T], +initval: T) { unsafe { - let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(&addr_of(v)); + let repr: **raw::VecRepr = ::unsafe::reinterpret_cast(&addr_of(v)); let fill = (**repr).fill; if (**repr).alloc > fill { push_fast(v, move initval); @@ -578,7 +578,7 @@ fn push<T>(&v: ~[const T], +initval: T) { // This doesn't bother to make sure we have space. #[inline(always)] // really pretty please unsafe fn push_fast<T>(&v: ~[const T], +initval: T) { - let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(&addr_of(v)); + let repr: **raw::VecRepr = ::unsafe::reinterpret_cast(&addr_of(v)); let fill = (**repr).fill; (**repr).fill += sys::size_of::<T>(); let p = ptr::addr_of((**repr).data); @@ -597,7 +597,7 @@ fn push_all<T: Copy>(&v: ~[const T], rhs: &[const T]) { reserve(v, v.len() + rhs.len()); for uint::range(0u, rhs.len()) |i| { - push(v, unsafe { unsafe::get(rhs, i) }) + push(v, unsafe { raw::get(rhs, i) }) } } @@ -611,7 +611,7 @@ fn push_all_move<T>(&v: ~[const T], -rhs: ~[const T]) { push(v, move x); } } - unsafe::set_len(rhs, 0); + raw::set_len(rhs, 0); } } @@ -624,7 +624,7 @@ fn truncate<T>(&v: ~[const T], newlen: uint) { for uint::range(newlen, oldlen) |i| { let _dropped <- *ptr::offset(p, i); } - unsafe::set_len(v, newlen); + raw::set_len(v, newlen); } } } @@ -660,7 +660,7 @@ fn dedup<T: Eq>(&v: ~[const T]) unsafe { } } // last_written < next_to_read == ln - unsafe::set_len(v, last_written + 1); + raw::set_len(v, last_written + 1); } @@ -1786,7 +1786,7 @@ impl<T: Copy> &[T]: ImmutableCopyableVector<T> { } /// Unsafe operations -mod unsafe { +mod raw { // FIXME: This should have crate visibility (#1893 blocks that) /// The internal representation of a vector type VecRepr = { @@ -1936,8 +1936,8 @@ mod u8 { let b_len = len(*b); let n = uint::min(a_len, b_len) as libc::size_t; let r = unsafe { - libc::memcmp(unsafe::to_ptr(*a) as *libc::c_void, - unsafe::to_ptr(*b) as *libc::c_void, n) as int + libc::memcmp(raw::to_ptr(*a) as *libc::c_void, + raw::to_ptr(*b) as *libc::c_void, n) as int }; if r != 0 { r } else { @@ -1984,7 +1984,7 @@ mod u8 { assert dst.len() >= count; assert src.len() >= count; - unsafe { vec::unsafe::memcpy(dst, src, count) } + unsafe { vec::raw::memcpy(dst, src, count) } } /** @@ -1997,7 +1997,7 @@ mod u8 { assert dst.len() >= count; assert src.len() >= count; - unsafe { vec::unsafe::memmove(dst, src, count) } + unsafe { vec::raw::memmove(dst, src, count) } } } @@ -2076,8 +2076,8 @@ mod tests { unsafe { // Test on-stack copy-from-buf. let a = ~[1, 2, 3]; - let mut ptr = unsafe::to_ptr(a); - let b = unsafe::from_buf(ptr, 3u); + let mut ptr = raw::to_ptr(a); + let b = raw::from_buf(ptr, 3u); assert (len(b) == 3u); assert (b[0] == 1); assert (b[1] == 2); @@ -2085,8 +2085,8 @@ mod tests { // Test on-heap copy-from-buf. let c = ~[1, 2, 3, 4, 5]; - ptr = unsafe::to_ptr(c); - let d = unsafe::from_buf(ptr, 5u); + ptr = raw::to_ptr(c); + let d = raw::from_buf(ptr, 5u); assert (len(d) == 5u); assert (d[0] == 1); assert (d[1] == 2); @@ -2869,9 +2869,9 @@ mod tests { fn to_mut_no_copy() { unsafe { let x = ~[1, 2, 3]; - let addr = unsafe::to_ptr(x); + let addr = raw::to_ptr(x); let x_mut = to_mut(x); - let addr_mut = unsafe::to_ptr(x_mut); + let addr_mut = raw::to_ptr(x_mut); assert addr == addr_mut; } } @@ -2880,9 +2880,9 @@ mod tests { fn from_mut_no_copy() { unsafe { let x = ~[mut 1, 2, 3]; - let addr = unsafe::to_ptr(x); + let addr = raw::to_ptr(x); let x_imm = from_mut(x); - let addr_imm = unsafe::to_ptr(x_imm); + let addr_imm = raw::to_ptr(x_imm); assert addr == addr_imm; } } diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index 173348d8dca..637c7451de0 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -89,7 +89,7 @@ fn round_up_to(base: uint, align: uint) -> uint { // in it. unsafe fn destroy_chunk(chunk: Chunk) { let mut idx = 0; - let buf = vec::unsafe::to_ptr(chunk.data); + let buf = vec::raw::to_ptr(chunk.data); let fill = chunk.fill; while idx < fill { @@ -156,7 +156,7 @@ impl &Arena { // start, n_bytes, align, head.fill); unsafe { - ptr::offset(vec::unsafe::to_ptr(head.data), start) + ptr::offset(vec::raw::to_ptr(head.data), start) } } @@ -200,7 +200,7 @@ impl &Arena { // start, n_bytes, align, head.fill); unsafe { - let buf = vec::unsafe::to_ptr(head.data); + let buf = vec::raw::to_ptr(head.data); return (ptr::offset(buf, tydesc_start), ptr::offset(buf, start)); } } diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 7622483a64b..31ef440e4a8 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -968,7 +968,7 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData, let stream_handle_ptr = (*socket_data_ptr).stream_handle_ptr; let write_buf_vec = ~[ uv::ll::buf_init( - vec::unsafe::to_ptr(raw_write_data), + vec::raw::to_ptr(raw_write_data), vec::len(raw_write_data)) ]; let write_buf_vec_ptr = ptr::addr_of(write_buf_vec); let result_po = core::comm::Port::<TcpWriteResult>(); @@ -1103,7 +1103,7 @@ extern fn on_tcp_read_cb(stream: *uv::ll::uv_stream_t, log(debug, fmt!("tcp on_read_cb nread: %d", nread as int)); let reader_ch = (*socket_data_ptr).reader_ch; let buf_base = uv::ll::get_base_from_buf(buf); - let new_bytes = vec::unsafe::from_buf(buf_base, nread as uint); + let new_bytes = vec::raw::from_buf(buf_base, nread as uint); core::comm::send(reader_ch, result::Ok(new_bytes)); } } diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index cd150fc1abf..2fe410ec3ec 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -749,7 +749,7 @@ unsafe fn accept(server: *libc::c_void, client: *libc::c_void) unsafe fn write<T>(req: *uv_write_t, stream: *T, buf_in: *~[uv_buf_t], cb: *u8) -> libc::c_int { - let buf_ptr = vec::unsafe::to_ptr(*buf_in); + let buf_ptr = vec::raw::to_ptr(*buf_in); let buf_cnt = vec::len(*buf_in) as i32; return rustrt::rust_uv_write(req as *libc::c_void, stream as *libc::c_void, @@ -1046,7 +1046,7 @@ mod test { as *request_wrapper; let buf_base = get_base_from_buf(buf); let buf_len = get_len_from_buf(buf); - let bytes = vec::unsafe::from_buf(buf_base, buf_len as uint); + let bytes = vec::raw::from_buf(buf_base, buf_len as uint); let read_chan = *((*client_data).read_chan); let msg_from_server = str::from_bytes(bytes); core::comm::send(read_chan, msg_from_server); @@ -1122,7 +1122,7 @@ mod test { // struct that we'd cast to a void* and store as the // data field in our uv_connect_t struct let req_str_bytes = str::to_bytes(req_str); - let req_msg_ptr: *u8 = vec::unsafe::to_ptr(req_str_bytes); + let req_msg_ptr: *u8 = vec::raw::to_ptr(req_str_bytes); log(debug, fmt!("req_msg ptr: %u", req_msg_ptr as uint)); let req_msg = ~[ buf_init(req_msg_ptr, vec::len(req_str_bytes)) @@ -1221,7 +1221,7 @@ mod test { buf_base as uint, buf_len as uint, nread)); - let bytes = vec::unsafe::from_buf(buf_base, buf_len); + let bytes = vec::raw::from_buf(buf_base, buf_len); let request_str = str::from_bytes(bytes); let client_data = get_data_for_uv_handle( @@ -1370,7 +1370,7 @@ mod test { let server_write_req_ptr = ptr::addr_of(server_write_req); let resp_str_bytes = str::to_bytes(server_resp_msg); - let resp_msg_ptr: *u8 = vec::unsafe::to_ptr(resp_str_bytes); + let resp_msg_ptr: *u8 = vec::raw::to_ptr(resp_str_bytes); log(debug, fmt!("resp_msg ptr: %u", resp_msg_ptr as uint)); let resp_msg = ~[ buf_init(resp_msg_ptr, vec::len(resp_str_bytes)) diff --git a/src/rustc/lib/llvm.rs b/src/rustc/lib/llvm.rs index 64258fcd43a..4ccf8439d3f 100644 --- a/src/rustc/lib/llvm.rs +++ b/src/rustc/lib/llvm.rs @@ -1105,7 +1105,7 @@ fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) -> let n_args = llvm::LLVMCountParamTypes(ty) as uint; let args = vec::from_elem(n_args, 0 as TypeRef); unsafe { - llvm::LLVMGetParamTypes(ty, vec::unsafe::to_ptr(args)); + llvm::LLVMGetParamTypes(ty, vec::raw::to_ptr(args)); } s += tys_str(names, outer, args); s += ~") -> "; @@ -1117,7 +1117,7 @@ fn type_to_str_inner(names: type_names, outer0: ~[TypeRef], ty: TypeRef) -> let n_elts = llvm::LLVMCountStructElementTypes(ty) as uint; let elts = vec::from_elem(n_elts, 0 as TypeRef); unsafe { - llvm::LLVMGetStructElementTypes(ty, vec::unsafe::to_ptr(elts)); + llvm::LLVMGetStructElementTypes(ty, vec::raw::to_ptr(elts)); } s += tys_str(names, outer, elts); s += ~"}"; @@ -1167,7 +1167,7 @@ fn float_width(llt: TypeRef) -> uint { fn fn_ty_param_tys(fn_ty: TypeRef) -> ~[TypeRef] unsafe { let args = vec::from_elem(llvm::LLVMCountParamTypes(fn_ty) as uint, 0 as TypeRef); - llvm::LLVMGetParamTypes(fn_ty, vec::unsafe::to_ptr(args)); + llvm::LLVMGetParamTypes(fn_ty, vec::raw::to_ptr(args)); return args; } diff --git a/src/rustc/metadata/loader.rs b/src/rustc/metadata/loader.rs index 2c16e6a4206..b19fa07d999 100644 --- a/src/rustc/metadata/loader.rs +++ b/src/rustc/metadata/loader.rs @@ -193,7 +193,7 @@ fn get_metadata_section(os: os, vlen); let minsz = uint::min(vlen, csz); let mut version_ok = false; - do vec::unsafe::form_slice(cvbuf, minsz) |buf0| { + do vec::raw::form_slice(cvbuf, minsz) |buf0| { version_ok = (buf0 == encoder::metadata_encoding_version); } @@ -202,7 +202,7 @@ fn get_metadata_section(os: os, let cvbuf1 = ptr::offset(cvbuf, vlen); debug!("inflating %u bytes of compressed metadata", csz - vlen); - do vec::unsafe::form_slice(cvbuf1, csz-vlen) |buf| { + do vec::raw::form_slice(cvbuf1, csz-vlen) |buf| { let inflated = flate::inflate_buf(buf); found = move Some(@(move inflated)); } diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 6b89549e73c..b91d9e58e14 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -2018,7 +2018,7 @@ fn create_main_wrapper(ccx: @crate_ctxt, sp: span, main_llfn: ValueRef, let args = ~[rust_main, llvm::LLVMGetParam(llfn, 0 as c_uint), llvm::LLVMGetParam(llfn, 1 as c_uint), crate_map]; let result = unsafe { - llvm::LLVMBuildCall(bld, start, vec::unsafe::to_ptr(args), + llvm::LLVMBuildCall(bld, start, vec::raw::to_ptr(args), args.len() as c_uint, noname()) }; llvm::LLVMBuildRet(bld, result); diff --git a/src/rustc/middle/trans/build.rs b/src/rustc/middle/trans/build.rs index ab108f5ef55..45cef99d0a2 100644 --- a/src/rustc/middle/trans/build.rs +++ b/src/rustc/middle/trans/build.rs @@ -87,7 +87,7 @@ fn AggregateRet(cx: block, RetVals: ~[ValueRef]) { assert (!cx.terminated); cx.terminated = true; unsafe { - llvm::LLVMBuildAggregateRet(B(cx), vec::unsafe::to_ptr(RetVals), + llvm::LLVMBuildAggregateRet(B(cx), vec::raw::to_ptr(RetVals), RetVals.len() as c_uint); } } @@ -148,7 +148,7 @@ fn Invoke(cx: block, Fn: ValueRef, Args: ~[ValueRef], ~", ")); unsafe { count_insn(cx, "invoke"); - llvm::LLVMBuildInvoke(B(cx), Fn, vec::unsafe::to_ptr(Args), + llvm::LLVMBuildInvoke(B(cx), Fn, vec::raw::to_ptr(Args), Args.len() as c_uint, Then, Catch, noname()); } @@ -161,7 +161,7 @@ fn FastInvoke(cx: block, Fn: ValueRef, Args: ~[ValueRef], cx.terminated = true; unsafe { count_insn(cx, "fastinvoke"); - let v = llvm::LLVMBuildInvoke(B(cx), Fn, vec::unsafe::to_ptr(Args), + let v = llvm::LLVMBuildInvoke(B(cx), Fn, vec::raw::to_ptr(Args), Args.len() as c_uint, Then, Catch, noname()); lib::llvm::SetInstructionCallConv(v, lib::llvm::FastCallConv); @@ -424,7 +424,7 @@ fn GEP(cx: block, Pointer: ValueRef, Indices: ~[ValueRef]) -> ValueRef { if cx.unreachable { return llvm::LLVMGetUndef(T_ptr(T_nil())); } unsafe { count_insn(cx, "gep"); - return llvm::LLVMBuildGEP(B(cx), Pointer, vec::unsafe::to_ptr(Indices), + return llvm::LLVMBuildGEP(B(cx), Pointer, vec::raw::to_ptr(Indices), Indices.len() as c_uint, noname()); } } @@ -446,7 +446,7 @@ fn InBoundsGEP(cx: block, Pointer: ValueRef, Indices: &[ValueRef]) -> unsafe { count_insn(cx, "inboundsgep"); return llvm::LLVMBuildInBoundsGEP(B(cx), Pointer, - vec::unsafe::to_ptr(Indices), + vec::raw::to_ptr(Indices), Indices.len() as c_uint, noname()); } @@ -619,8 +619,8 @@ fn Phi(cx: block, Ty: TypeRef, vals: ~[ValueRef], bbs: ~[BasicBlockRef]) let phi = EmptyPhi(cx, Ty); unsafe { count_insn(cx, "addincoming"); - llvm::LLVMAddIncoming(phi, vec::unsafe::to_ptr(vals), - vec::unsafe::to_ptr(bbs), + llvm::LLVMAddIncoming(phi, vec::raw::to_ptr(vals), + vec::raw::to_ptr(bbs), vals.len() as c_uint); return phi; } @@ -689,7 +689,7 @@ fn FastCall(cx: block, Fn: ValueRef, Args: ~[ValueRef]) -> ValueRef { if cx.unreachable { return _UndefReturn(cx, Fn); } unsafe { count_insn(cx, "fastcall"); - let v = llvm::LLVMBuildCall(B(cx), Fn, vec::unsafe::to_ptr(Args), + let v = llvm::LLVMBuildCall(B(cx), Fn, vec::raw::to_ptr(Args), Args.len() as c_uint, noname()); lib::llvm::SetInstructionCallConv(v, lib::llvm::FastCallConv); return v; @@ -701,7 +701,7 @@ fn CallWithConv(cx: block, Fn: ValueRef, Args: ~[ValueRef], if cx.unreachable { return _UndefReturn(cx, Fn); } unsafe { count_insn(cx, "callwithconv"); - let v = llvm::LLVMBuildCall(B(cx), Fn, vec::unsafe::to_ptr(Args), + let v = llvm::LLVMBuildCall(B(cx), Fn, vec::raw::to_ptr(Args), Args.len() as c_uint, noname()); lib::llvm::SetInstructionCallConv(v, Conv); return v; @@ -789,7 +789,7 @@ fn Trap(cx: block) { let Args: ~[ValueRef] = ~[]; unsafe { count_insn(cx, "trap"); - llvm::LLVMBuildCall(b, T, vec::unsafe::to_ptr(Args), + llvm::LLVMBuildCall(b, T, vec::raw::to_ptr(Args), Args.len() as c_uint, noname()); } } diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 0708d9f21a6..b6b073e1e35 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -4,7 +4,7 @@ */ use libc::c_uint; -use vec::unsafe::to_ptr; +use vec::raw::to_ptr; use std::map::{HashMap,Set}; use syntax::{ast, ast_map}; use driver::session; @@ -1052,7 +1052,7 @@ fn C_zero_byte_arr(size: uint) -> ValueRef unsafe { let mut i = 0u; let mut elts: ~[ValueRef] = ~[]; while i < size { vec::push(elts, C_u8(0u)); i += 1u; } - return llvm::LLVMConstArray(T_i8(), vec::unsafe::to_ptr(elts), + return llvm::LLVMConstArray(T_i8(), vec::raw::to_ptr(elts), elts.len() as c_uint); } @@ -1069,19 +1069,19 @@ fn C_named_struct(T: TypeRef, elts: &[ValueRef]) -> ValueRef { } fn C_array(ty: TypeRef, elts: ~[ValueRef]) -> ValueRef unsafe { - return llvm::LLVMConstArray(ty, vec::unsafe::to_ptr(elts), + return llvm::LLVMConstArray(ty, vec::raw::to_ptr(elts), elts.len() as c_uint); } fn C_bytes(bytes: ~[u8]) -> ValueRef unsafe { return llvm::LLVMConstString( - unsafe::reinterpret_cast(&vec::unsafe::to_ptr(bytes)), + unsafe::reinterpret_cast(&vec::raw::to_ptr(bytes)), bytes.len() as c_uint, True); } fn C_bytes_plus_null(bytes: ~[u8]) -> ValueRef unsafe { return llvm::LLVMConstString( - unsafe::reinterpret_cast(&vec::unsafe::to_ptr(bytes)), + unsafe::reinterpret_cast(&vec::raw::to_ptr(bytes)), bytes.len() as c_uint, False); } diff --git a/src/rustc/middle/trans/debuginfo.rs b/src/rustc/middle/trans/debuginfo.rs index fc0c462e935..fe5cdc8d1ed 100644 --- a/src/rustc/middle/trans/debuginfo.rs +++ b/src/rustc/middle/trans/debuginfo.rs @@ -66,7 +66,7 @@ fn lli1(bval: bool) -> ValueRef { C_bool(bval) } fn llmdnode(elems: ~[ValueRef]) -> ValueRef unsafe { - llvm::LLVMMDNode(vec::unsafe::to_ptr(elems), + llvm::LLVMMDNode(vec::raw::to_ptr(elems), vec::len(elems) as libc::c_uint) } fn llunused() -> ValueRef { diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index 77cb6eaa74e..22b35eca9f2 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -11,7 +11,7 @@ extern mod libc { fn strlen(str: ~str) -> uint unsafe { // C string is terminated with a zero let bytes = str::to_bytes(str) + ~[0u8]; - return libc::my_strlen(vec::unsafe::to_ptr(bytes)); + return libc::my_strlen(vec::raw::to_ptr(bytes)); } fn main() { |
