From 6854265161fa2ee23fca58cc1bcfad183c4b3730 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Thu, 11 Oct 2012 15:37:37 -0700 Subject: [PATCH] Remove comment that is now false --- src/libcore/flate.rs | 4 ++-- src/libcore/task.rs | 4 ++-- src/libcore/vec.rs | 50 +++++++++++++++++++++++++-------------- src/libstd/arc.rs | 4 ++-- src/libstd/net_tcp.rs | 6 ++--- src/libsyntax/ast_util.rs | 1 - 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index 7c5176494a2..b2dd468236a 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -37,7 +37,7 @@ pub fn deflate_bytes(bytes: &[const u8]) -> ~[u8] { ptr::addr_of(&outsz), lz_norm); assert res as int != 0; - let out = vec::raw::from_buf(res as *u8, + let out = vec::raw::from_buf_raw(res as *u8, outsz as uint); libc::free(res); move out @@ -55,7 +55,7 @@ pub fn inflate_bytes(bytes: &[const u8]) -> ~[u8] { ptr::addr_of(&outsz), 0); assert res as int != 0; - let out = vec::raw::from_buf(res as *u8, + let out = vec::raw::from_buf_raw(res as *u8, outsz as uint); libc::free(res); move out diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 1bb23203007..afc4a821bb6 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -759,8 +759,8 @@ fn test_cant_dup_task_builder() { let b = task().unlinked(); do b.spawn { } // FIXME(#3724): For now, this is a -runtime- failure, because we haven't - // got move mode on self. When 3724 is fixed, this test should fail to compile - // instead, and should go in tests/compile-fail. + // got move mode on self. When 3724 is fixed, this test should fail to + // compile instead, and should go in tests/compile-fail. do b.spawn { } // b should have been consumed by the previous call } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 3a2b73f5b5b..5d6e8584664 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -1657,9 +1657,22 @@ impl ~[T]: MutableEqVector { } } + +/** +* Constructs a vector from an unsafe pointer to a buffer +* +* # Arguments +* +* * ptr - An unsafe pointer to a buffer of `T` +* * elts - The number of elements in the buffer +*/ +// Wrapper for fn in raw: needs to be called by net_tcp::on_tcp_read_cb +pub unsafe fn from_buf(ptr: *T, elts: uint) -> ~[T] { + raw::from_buf_raw(ptr, elts) +} + /// Unsafe operations -pub mod raw { - // FIXME: This should have crate visibility (#1893 blocks that) +mod raw { /// The internal representation of a (boxed) vector pub struct VecRepr { @@ -1679,22 +1692,6 @@ pub mod raw { mut len: uint }; - /** - * Constructs a vector from an unsafe pointer to a buffer - * - * # Arguments - * - * * ptr - An unsafe pointer to a buffer of `T` - * * elts - The number of elements in the buffer - */ - #[inline(always)] - pub unsafe fn from_buf(ptr: *T, elts: uint) -> ~[T] { - let mut dst = with_capacity(elts); - set_len(&mut dst, elts); - as_mut_buf(dst, |p_dst, _len_dst| ptr::memcpy(p_dst, ptr, elts)); - move dst - } - /** * Sets the length of a vector * @@ -1775,6 +1772,23 @@ pub mod raw { } } + /** + * Constructs a vector from an unsafe pointer to a buffer + * + * # Arguments + * + * * ptr - An unsafe pointer to a buffer of `T` + * * elts - The number of elements in the buffer + */ + // Was in raw, but needs to be called by net_tcp::on_tcp_read_cb + #[inline(always)] + pub unsafe fn from_buf_raw(ptr: *T, elts: uint) -> ~[T] { + let mut dst = with_capacity(elts); + set_len(&mut dst, elts); + as_mut_buf(dst, |p_dst, _len_dst| ptr::memcpy(p_dst, ptr, elts)); + move dst + } + /** * Copies data from one vector to another. * diff --git a/src/libstd/arc.rs b/src/libstd/arc.rs index addabb2ddb9..6178e64ff18 100644 --- a/src/libstd/arc.rs +++ b/src/libstd/arc.rs @@ -190,7 +190,7 @@ impl &MutexARC { * * Will additionally fail if another task has failed while accessing the arc. */ -// FIXME(#2585) make this a by-move method on the arc +// FIXME(#3724) make this a by-move method on the arc pub fn unwrap_mutex_arc(arc: MutexARC) -> T { let MutexARC { x: x } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; @@ -368,7 +368,7 @@ impl &RWARC { * Will additionally fail if another task has failed while accessing the arc * in write mode. */ -// FIXME(#2585) make this a by-move method on the arc +// FIXME(#3724) make this a by-move method on the arc pub fn unwrap_rw_arc(arc: RWARC) -> T { let RWARC { x: x, _ } <- arc; let inner = unsafe { unwrap_shared_mutable_state(move x) }; diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index 249551fbb7d..87dea021f5b 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -6,9 +6,7 @@ use ip = net_ip; use uv::iotask; use uv::iotask::IoTask; use future_spawn = future::spawn; -// FIXME #1935 -// should be able to, but can't atm, replace w/ result::{result, extensions}; -use result::*; +use result::{Result}; use libc::size_t; use io::{Reader, ReaderUtil, Writer}; use comm = core::comm; @@ -1093,7 +1091,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::raw::from_buf(buf_base, nread as uint); + let new_bytes = vec::from_buf(buf_base, nread as uint); core::comm::send(reader_ch, result::Ok(new_bytes)); } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index ab24d7a5316..31ddcfafa2d 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -233,7 +233,6 @@ fn is_exported(i: ident, m: _mod) -> bool { } } - // FIXME: glob-exports aren't supported yet. (#2006) _ => () } }