Skip to content

Commit 5da4b4d

Browse files
committed
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
1 parent 77279a7 commit 5da4b4d

File tree

10 files changed

+49
-44
lines changed

10 files changed

+49
-44
lines changed

src/libstd/at_vec.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,6 @@ pub mod raw {
255255
if capacity(*v) < n {
256256
let ptr: *mut *mut Box<Vec<()>> = transmute(v);
257257
let ty = intrinsics::get_tydesc::<T>();
258-
// XXX transmute shouldn't be necessary
259-
let ty = cast::transmute(ty);
260258
return reserve_raw(ty, ptr, n);
261259
}
262260
}

src/libstd/rand/distributions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl Rand for StandardNormal {
9292
let mut x = 1.0f64;
9393
let mut y = 0.0f64;
9494

95-
// XXX infinities?
95+
// FIXME #7755: infinities?
9696
while -2.0 * y < x * x {
9797
x = rng.gen::<f64>().ln() / ziggurat_tables::ZIG_NORM_R;
9898
y = rng.gen::<f64>().ln();

src/libstd/rt/args.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
//! Only valid to call on linux. Mac and Windows use syscalls to
1818
//! discover the command line arguments.
1919
//!
20-
//! XXX: Would be nice for this to not exist.
21-
//! XXX: This has a lot of C glue for lack of globals.
20+
//! FIXME #7756: Would be nice for this to not exist.
21+
//! FIXME #7756: This has a lot of C glue for lack of globals.
2222
2323
use option::Option;
2424

src/libstd/rt/comm.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct Packet<T> {
4646
payload: Option<T>,
4747
}
4848

49-
/// A one-shot channel.
49+
// A one-shot channel.
5050
pub struct ChanOne<T> {
5151
void_packet: *mut Void,
5252
suppress_finalize: bool
@@ -681,7 +681,7 @@ impl<T> Clone for SharedPort<T> {
681681
}
682682
}
683683

684-
// XXX: Need better name
684+
// FIXME #7760: Need better name
685685
type MegaPipe<T> = (SharedPort<T>, SharedChan<T>);
686686

687687
pub fn megapipe<T: Send>() -> MegaPipe<T> {
@@ -1027,9 +1027,8 @@ mod test {
10271027
fn shared_port_stress() {
10281028
if util::limit_thread_creation_due_to_osx_and_valgrind() { return; }
10291029
do run_in_mt_newsched_task {
1030-
// XXX: Removing these type annotations causes an ICE
1031-
let (end_port, end_chan) = stream::<()>();
1032-
let (port, chan) = stream::<()>();
1030+
let (end_port, end_chan) = stream();
1031+
let (port, chan) = stream();
10331032
let end_chan = SharedChan::new(end_chan);
10341033
let port = SharedPort::new(port);
10351034
let total = stress_factor() + 100;

src/libstd/rt/context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ use libc::c_void;
1414
use cast::{transmute, transmute_mut_unsafe,
1515
transmute_region, transmute_mut_region};
1616

17-
// XXX: Registers is boxed so that it is 16-byte aligned, for storing
17+
// FIXME #7761: Registers is boxed so that it is 16-byte aligned, for storing
1818
// SSE regs. It would be marginally better not to do this. In C++ we
1919
// use an attribute on a struct.
20-
// XXX: It would be nice to define regs as `~Option<Registers>` since
20+
// FIXME #7761: It would be nice to define regs as `~Option<Registers>` since
2121
// the registers are sometimes empty, but the discriminant would
2222
// then misalign the regs again.
2323
pub struct Context {
@@ -37,7 +37,7 @@ impl Context {
3737

3838
/// Create a new context that will resume execution by running ~fn()
3939
pub fn new(start: ~fn(), stack: &mut StackSegment) -> Context {
40-
// XXX: Putting main into a ~ so it's a thin pointer and can
40+
// FIXME #7767: Putting main into a ~ so it's a thin pointer and can
4141
// be passed to the spawn function. Another unfortunate
4242
// allocation
4343
let start = ~start;
@@ -206,7 +206,7 @@ fn align_down(sp: *mut uint) -> *mut uint {
206206
}
207207
}
208208

209-
// XXX: ptr::offset is positive ints only
209+
// ptr::mut_offset is positive ints only
210210
#[inline]
211211
pub fn mut_offset<T>(ptr: *mut T, count: int) -> *mut T {
212212
use std::sys::size_of;

src/libstd/rt/io/extensions.rs

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ pub trait WriterByteConversions {
229229
fn write_be_i64(&mut self, n: i64);
230230

231231
/// Write a big-endian i32 (4 bytes).
232-
fn write_be_i32(&mut self, n: i32);
232+
fn write_be_i32_(&mut self, n: i32);
233233

234234
/// Write a big-endian i16 (2 bytes).
235235
fn write_be_i16(&mut self, n: i16);
@@ -238,7 +238,7 @@ pub trait WriterByteConversions {
238238
fn write_be_f64(&mut self, f: f64);
239239

240240
/// Write a big-endian IEEE754 single-precision floating-point (4 bytes).
241-
fn write_be_f32(&mut self, f: f32);
241+
fn write_be_f32_(&mut self, f: f32);
242242

243243
/// Write a little-endian u64 (8 bytes).
244244
fn write_le_u64_(&mut self, n: u64);
@@ -264,7 +264,7 @@ pub trait WriterByteConversions {
264264

265265
/// Write a little-endian IEEE754 single-precision floating-point
266266
/// (4 bytes).
267-
fn write_le_f32(&mut self, f: f32);
267+
fn write_le_f32_(&mut self, f: f32);
268268

269269
/// Write a u8 (1 byte).
270270
fn write_u8(&mut self, n: u8);
@@ -519,7 +519,7 @@ impl<T: Writer> WriterByteConversions for T {
519519
u64_to_be_bytes(n as u64, 8u, |v| self.write(v))
520520
}
521521

522-
fn write_be_i32(&mut self, n: i32) {
522+
fn write_be_i32_(&mut self, n: i32) {
523523
u64_to_be_bytes(n as u64, 4u, |v| self.write(v))
524524
}
525525

@@ -533,7 +533,7 @@ impl<T: Writer> WriterByteConversions for T {
533533
}
534534
}
535535

536-
fn write_be_f32(&mut self, f: f32) {
536+
fn write_be_f32_(&mut self, f: f32) {
537537
unsafe {
538538
self.write_be_u32(cast::transmute(f))
539539
}
@@ -569,7 +569,7 @@ impl<T: Writer> WriterByteConversions for T {
569569
}
570570
}
571571

572-
fn write_le_f32(&mut self, f: f32) {
572+
fn write_le_f32_(&mut self, f: f32) {
573573
unsafe {
574574
self.write_le_u32(cast::transmute(f))
575575
}
@@ -594,7 +594,7 @@ mod test {
594594
use super::ReaderUtil;
595595
use option::{Some, None};
596596
use cell::Cell;
597-
use rt::io::mem::MemReader;
597+
use rt::io::mem::{MemReader, MemWriter};
598598
use rt::io::mock::MockReader;
599599
use rt::io::{read_error, placeholder_error};
600600

@@ -827,48 +827,49 @@ mod test {
827827
assert!(buf == ~[10, 11]);
828828
}
829829

830-
// XXX: Some problem with resolve here
831-
/*#[test]
832-
fn test_read_write_le() {
833-
let uints = [0, 1, 2, 42, 10_123, 100_123_456, u64::max_value];
830+
831+
#[test]
832+
fn test_read_write_le_mem() {
833+
let uints = [0, 1, 2, 42, 10_123, 100_123_456, ::u64::max_value];
834834

835835
let mut writer = MemWriter::new();
836-
for uints.each |i| {
837-
writer.write_le_u64(*i);
836+
for i in uints.iter() {
837+
writer.write_le_u64_(*i);
838838
}
839839

840840
let mut reader = MemReader::new(writer.inner());
841-
for uints.each |i| {
841+
for i in uints.iter() {
842842
assert!(reader.read_le_u64() == *i);
843843
}
844844
}
845845

846+
846847
#[test]
847848
fn test_read_write_be() {
848-
let uints = [0, 1, 2, 42, 10_123, 100_123_456, u64::max_value];
849+
let uints = [0, 1, 2, 42, 10_123, 100_123_456, ::u64::max_value];
849850

850851
let mut writer = MemWriter::new();
851-
for uints.each |i| {
852-
writer.write_be_u64(*i);
852+
for i in uints.iter() {
853+
writer.write_be_u64_(*i);
853854
}
854855

855856
let mut reader = MemReader::new(writer.inner());
856-
for uints.each |i| {
857+
for i in uints.iter() {
857858
assert!(reader.read_be_u64() == *i);
858859
}
859860
}
860861

861862
#[test]
862863
fn test_read_be_int_n() {
863-
let ints = [i32::min_value, -123456, -42, -5, 0, 1, i32::max_value];
864+
let ints = [::i32::min_value, -123456, -42, -5, 0, 1, ::i32::max_value];
864865

865866
let mut writer = MemWriter::new();
866-
for ints.each |i| {
867-
writer.write_be_i32(*i);
867+
for i in ints.iter() {
868+
writer.write_be_i32_(*i);
868869
}
869870

870871
let mut reader = MemReader::new(writer.inner());
871-
for ints.each |i| {
872+
for i in ints.iter() {
872873
// this tests that the sign extension is working
873874
// (comparing the values as i32 would not test this)
874875
assert!(reader.read_be_int_n(4) == *i as i64);
@@ -893,12 +894,12 @@ mod test {
893894
let f:f32 = 8.1250;
894895

895896
let mut writer = MemWriter::new();
896-
writer.write_be_f32(f);
897-
writer.write_le_f32(f);
897+
writer.write_be_f32_(f);
898+
writer.write_le_f32_(f);
898899

899900
let mut reader = MemReader::new(writer.inner());
900901
assert!(reader.read_be_f32() == 8.1250);
901902
assert!(reader.read_le_f32() == 8.1250);
902-
}*/
903+
}
903904

904905
}

src/libstd/rt/io/file.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use super::support::PathLike;
1313
use super::{Reader, Writer, Seek};
1414
use super::SeekStyle;
1515

16-
/// # XXX
16+
/// # FIXME #7785
1717
/// * Ugh, this is ridiculous. What is the best way to represent these options?
1818
enum FileMode {
1919
/// Opens an existing file. IoError if file does not exist.

src/libstd/std.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ mod unicode;
198198
#[path = "num/cmath.rs"]
199199
mod cmath;
200200

201-
// XXX: This shouldn't be pub, and it should be reexported under 'unstable'
201+
// FIXME #7809: This shouldn't be pub, and it should be reexported under 'unstable'
202202
// but name resolution doesn't work without it being pub.
203203
pub mod rt;
204204

src/libstd/task/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ pub fn deschedule() {
543543
use rt::local::Local;
544544
use rt::sched::Scheduler;
545545

546-
// XXX: What does yield really mean in newsched?
546+
// FIXME #6842: What does yield really mean in newsched?
547547
// FIXME(#7544): Optimize this, since we know we won't block.
548548
let sched = Local::take::<Scheduler>();
549549
do sched.deschedule_running_task_and_then |sched, task| {

src/libsyntax/parse/parser.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5061,12 +5061,19 @@ impl Parser {
50615061
}
50625062
}
50635063

5064-
pub fn parse_str(&self) -> @str {
5064+
pub fn parse_optional_str(&self) -> Option<@str> {
50655065
match *self.token {
50665066
token::LIT_STR(s) => {
50675067
self.bump();
5068-
ident_to_str(&s)
5068+
Some(ident_to_str(&s))
50695069
}
5070+
_ => None
5071+
}
5072+
}
5073+
5074+
pub fn parse_str(&self) -> @str {
5075+
match self.parse_optional_str() {
5076+
Some(s) => { s }
50705077
_ => self.fatal("expected string literal")
50715078
}
50725079
}

0 commit comments

Comments
 (0)