std/extra: changing XXX to FIXME; cleanup
* Get rid of by-value-self workarounds; it works now * Remove type annotations, they're not needed anymore
This commit is contained in:
parent
77279a73cb
commit
5da4b4d928
|
@ -255,8 +255,6 @@ pub mod raw {
|
|||
if capacity(*v) < n {
|
||||
let ptr: *mut *mut Box<Vec<()>> = transmute(v);
|
||||
let ty = intrinsics::get_tydesc::<T>();
|
||||
// XXX transmute shouldn't be necessary
|
||||
let ty = cast::transmute(ty);
|
||||
return reserve_raw(ty, ptr, n);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ impl Rand for StandardNormal {
|
|||
let mut x = 1.0f64;
|
||||
let mut y = 0.0f64;
|
||||
|
||||
// XXX infinities?
|
||||
// FIXME #7755: infinities?
|
||||
while -2.0 * y < x * x {
|
||||
x = rng.gen::<f64>().ln() / ziggurat_tables::ZIG_NORM_R;
|
||||
y = rng.gen::<f64>().ln();
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
//! Only valid to call on linux. Mac and Windows use syscalls to
|
||||
//! discover the command line arguments.
|
||||
//!
|
||||
//! XXX: Would be nice for this to not exist.
|
||||
//! XXX: This has a lot of C glue for lack of globals.
|
||||
//! FIXME #7756: Would be nice for this to not exist.
|
||||
//! FIXME #7756: This has a lot of C glue for lack of globals.
|
||||
|
||||
use option::Option;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ struct Packet<T> {
|
|||
payload: Option<T>,
|
||||
}
|
||||
|
||||
/// A one-shot channel.
|
||||
// A one-shot channel.
|
||||
pub struct ChanOne<T> {
|
||||
void_packet: *mut Void,
|
||||
suppress_finalize: bool
|
||||
|
@ -681,7 +681,7 @@ impl<T> Clone for SharedPort<T> {
|
|||
}
|
||||
}
|
||||
|
||||
// XXX: Need better name
|
||||
// FIXME #7760: Need better name
|
||||
type MegaPipe<T> = (SharedPort<T>, SharedChan<T>);
|
||||
|
||||
pub fn megapipe<T: Send>() -> MegaPipe<T> {
|
||||
|
@ -1027,9 +1027,8 @@ mod test {
|
|||
fn shared_port_stress() {
|
||||
if util::limit_thread_creation_due_to_osx_and_valgrind() { return; }
|
||||
do run_in_mt_newsched_task {
|
||||
// XXX: Removing these type annotations causes an ICE
|
||||
let (end_port, end_chan) = stream::<()>();
|
||||
let (port, chan) = stream::<()>();
|
||||
let (end_port, end_chan) = stream();
|
||||
let (port, chan) = stream();
|
||||
let end_chan = SharedChan::new(end_chan);
|
||||
let port = SharedPort::new(port);
|
||||
let total = stress_factor() + 100;
|
||||
|
|
|
@ -14,10 +14,10 @@ use libc::c_void;
|
|||
use cast::{transmute, transmute_mut_unsafe,
|
||||
transmute_region, transmute_mut_region};
|
||||
|
||||
// XXX: Registers is boxed so that it is 16-byte aligned, for storing
|
||||
// FIXME #7761: Registers is boxed so that it is 16-byte aligned, for storing
|
||||
// SSE regs. It would be marginally better not to do this. In C++ we
|
||||
// use an attribute on a struct.
|
||||
// XXX: It would be nice to define regs as `~Option<Registers>` since
|
||||
// FIXME #7761: It would be nice to define regs as `~Option<Registers>` since
|
||||
// the registers are sometimes empty, but the discriminant would
|
||||
// then misalign the regs again.
|
||||
pub struct Context {
|
||||
|
@ -37,7 +37,7 @@ impl Context {
|
|||
|
||||
/// Create a new context that will resume execution by running ~fn()
|
||||
pub fn new(start: ~fn(), stack: &mut StackSegment) -> Context {
|
||||
// XXX: Putting main into a ~ so it's a thin pointer and can
|
||||
// FIXME #7767: Putting main into a ~ so it's a thin pointer and can
|
||||
// be passed to the spawn function. Another unfortunate
|
||||
// allocation
|
||||
let start = ~start;
|
||||
|
@ -206,7 +206,7 @@ fn align_down(sp: *mut uint) -> *mut uint {
|
|||
}
|
||||
}
|
||||
|
||||
// XXX: ptr::offset is positive ints only
|
||||
// ptr::mut_offset is positive ints only
|
||||
#[inline]
|
||||
pub fn mut_offset<T>(ptr: *mut T, count: int) -> *mut T {
|
||||
use std::sys::size_of;
|
||||
|
|
|
@ -229,7 +229,7 @@ pub trait WriterByteConversions {
|
|||
fn write_be_i64(&mut self, n: i64);
|
||||
|
||||
/// Write a big-endian i32 (4 bytes).
|
||||
fn write_be_i32(&mut self, n: i32);
|
||||
fn write_be_i32_(&mut self, n: i32);
|
||||
|
||||
/// Write a big-endian i16 (2 bytes).
|
||||
fn write_be_i16(&mut self, n: i16);
|
||||
|
@ -238,7 +238,7 @@ pub trait WriterByteConversions {
|
|||
fn write_be_f64(&mut self, f: f64);
|
||||
|
||||
/// Write a big-endian IEEE754 single-precision floating-point (4 bytes).
|
||||
fn write_be_f32(&mut self, f: f32);
|
||||
fn write_be_f32_(&mut self, f: f32);
|
||||
|
||||
/// Write a little-endian u64 (8 bytes).
|
||||
fn write_le_u64_(&mut self, n: u64);
|
||||
|
@ -264,7 +264,7 @@ pub trait WriterByteConversions {
|
|||
|
||||
/// Write a little-endian IEEE754 single-precision floating-point
|
||||
/// (4 bytes).
|
||||
fn write_le_f32(&mut self, f: f32);
|
||||
fn write_le_f32_(&mut self, f: f32);
|
||||
|
||||
/// Write a u8 (1 byte).
|
||||
fn write_u8(&mut self, n: u8);
|
||||
|
@ -519,7 +519,7 @@ impl<T: Writer> WriterByteConversions for T {
|
|||
u64_to_be_bytes(n as u64, 8u, |v| self.write(v))
|
||||
}
|
||||
|
||||
fn write_be_i32(&mut self, n: i32) {
|
||||
fn write_be_i32_(&mut self, n: i32) {
|
||||
u64_to_be_bytes(n as u64, 4u, |v| self.write(v))
|
||||
}
|
||||
|
||||
|
@ -533,7 +533,7 @@ impl<T: Writer> WriterByteConversions for T {
|
|||
}
|
||||
}
|
||||
|
||||
fn write_be_f32(&mut self, f: f32) {
|
||||
fn write_be_f32_(&mut self, f: f32) {
|
||||
unsafe {
|
||||
self.write_be_u32(cast::transmute(f))
|
||||
}
|
||||
|
@ -569,7 +569,7 @@ impl<T: Writer> WriterByteConversions for T {
|
|||
}
|
||||
}
|
||||
|
||||
fn write_le_f32(&mut self, f: f32) {
|
||||
fn write_le_f32_(&mut self, f: f32) {
|
||||
unsafe {
|
||||
self.write_le_u32(cast::transmute(f))
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ mod test {
|
|||
use super::ReaderUtil;
|
||||
use option::{Some, None};
|
||||
use cell::Cell;
|
||||
use rt::io::mem::MemReader;
|
||||
use rt::io::mem::{MemReader, MemWriter};
|
||||
use rt::io::mock::MockReader;
|
||||
use rt::io::{read_error, placeholder_error};
|
||||
|
||||
|
@ -827,48 +827,49 @@ mod test {
|
|||
assert!(buf == ~[10, 11]);
|
||||
}
|
||||
|
||||
// XXX: Some problem with resolve here
|
||||
/*#[test]
|
||||
fn test_read_write_le() {
|
||||
let uints = [0, 1, 2, 42, 10_123, 100_123_456, u64::max_value];
|
||||
|
||||
#[test]
|
||||
fn test_read_write_le_mem() {
|
||||
let uints = [0, 1, 2, 42, 10_123, 100_123_456, ::u64::max_value];
|
||||
|
||||
let mut writer = MemWriter::new();
|
||||
for uints.each |i| {
|
||||
writer.write_le_u64(*i);
|
||||
for i in uints.iter() {
|
||||
writer.write_le_u64_(*i);
|
||||
}
|
||||
|
||||
let mut reader = MemReader::new(writer.inner());
|
||||
for uints.each |i| {
|
||||
for i in uints.iter() {
|
||||
assert!(reader.read_le_u64() == *i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[test]
|
||||
fn test_read_write_be() {
|
||||
let uints = [0, 1, 2, 42, 10_123, 100_123_456, u64::max_value];
|
||||
let uints = [0, 1, 2, 42, 10_123, 100_123_456, ::u64::max_value];
|
||||
|
||||
let mut writer = MemWriter::new();
|
||||
for uints.each |i| {
|
||||
writer.write_be_u64(*i);
|
||||
for i in uints.iter() {
|
||||
writer.write_be_u64_(*i);
|
||||
}
|
||||
|
||||
let mut reader = MemReader::new(writer.inner());
|
||||
for uints.each |i| {
|
||||
for i in uints.iter() {
|
||||
assert!(reader.read_be_u64() == *i);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_read_be_int_n() {
|
||||
let ints = [i32::min_value, -123456, -42, -5, 0, 1, i32::max_value];
|
||||
let ints = [::i32::min_value, -123456, -42, -5, 0, 1, ::i32::max_value];
|
||||
|
||||
let mut writer = MemWriter::new();
|
||||
for ints.each |i| {
|
||||
writer.write_be_i32(*i);
|
||||
for i in ints.iter() {
|
||||
writer.write_be_i32_(*i);
|
||||
}
|
||||
|
||||
let mut reader = MemReader::new(writer.inner());
|
||||
for ints.each |i| {
|
||||
for i in ints.iter() {
|
||||
// this tests that the sign extension is working
|
||||
// (comparing the values as i32 would not test this)
|
||||
assert!(reader.read_be_int_n(4) == *i as i64);
|
||||
|
@ -893,12 +894,12 @@ mod test {
|
|||
let f:f32 = 8.1250;
|
||||
|
||||
let mut writer = MemWriter::new();
|
||||
writer.write_be_f32(f);
|
||||
writer.write_le_f32(f);
|
||||
writer.write_be_f32_(f);
|
||||
writer.write_le_f32_(f);
|
||||
|
||||
let mut reader = MemReader::new(writer.inner());
|
||||
assert!(reader.read_be_f32() == 8.1250);
|
||||
assert!(reader.read_le_f32() == 8.1250);
|
||||
}*/
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use super::support::PathLike;
|
|||
use super::{Reader, Writer, Seek};
|
||||
use super::SeekStyle;
|
||||
|
||||
/// # XXX
|
||||
/// # FIXME #7785
|
||||
/// * Ugh, this is ridiculous. What is the best way to represent these options?
|
||||
enum FileMode {
|
||||
/// Opens an existing file. IoError if file does not exist.
|
||||
|
|
|
@ -198,7 +198,7 @@ mod unicode;
|
|||
#[path = "num/cmath.rs"]
|
||||
mod cmath;
|
||||
|
||||
// XXX: This shouldn't be pub, and it should be reexported under 'unstable'
|
||||
// FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable'
|
||||
// but name resolution doesn't work without it being pub.
|
||||
pub mod rt;
|
||||
|
||||
|
|
|
@ -543,7 +543,7 @@ pub fn deschedule() {
|
|||
use rt::local::Local;
|
||||
use rt::sched::Scheduler;
|
||||
|
||||
// XXX: What does yield really mean in newsched?
|
||||
// FIXME #6842: What does yield really mean in newsched?
|
||||
// FIXME(#7544): Optimize this, since we know we won't block.
|
||||
let sched = Local::take::<Scheduler>();
|
||||
do sched.deschedule_running_task_and_then |sched, task| {
|
||||
|
|
|
@ -5061,12 +5061,19 @@ impl Parser {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_str(&self) -> @str {
|
||||
pub fn parse_optional_str(&self) -> Option<@str> {
|
||||
match *self.token {
|
||||
token::LIT_STR(s) => {
|
||||
self.bump();
|
||||
ident_to_str(&s)
|
||||
Some(ident_to_str(&s))
|
||||
}
|
||||
_ => None
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_str(&self) -> @str {
|
||||
match self.parse_optional_str() {
|
||||
Some(s) => { s }
|
||||
_ => self.fatal("expected string literal")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue