about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstd/c_vec.rs28
-rw-r--r--src/libstd/ebml.rs15
-rw-r--r--src/libstd/md4.rs13
-rw-r--r--src/libstd/sha1.rs4
-rw-r--r--src/libstd/std.rc4
-rw-r--r--src/libstd/test.rs63
-rw-r--r--src/libstd/uv_iotask.rs16
-rw-r--r--src/libstd/uv_ll.rs2
8 files changed, 74 insertions, 71 deletions
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs
index c190d08687a..17920f5de3f 100644
--- a/src/libstd/c_vec.rs
+++ b/src/libstd/c_vec.rs
@@ -46,11 +46,11 @@ use core::task;
 /**
  * The type representing a foreign chunk of memory
  *
- * Wrapped in a enum for opacity; FIXME #818 when it is possible to have
- * truly opaque types, this should be revisited.
  */
-pub enum CVec<T> {
-    CVecCtor({ base: *mut T, len: uint, rsrc: @DtorRes})
+pub struct CVec<T> {
+    priv base: *mut T,
+    priv len: uint,
+    priv rsrc: @DtorRes
 }
 
 struct DtorRes {
@@ -85,11 +85,11 @@ fn DtorRes(dtor: Option<fn@()>) -> DtorRes {
  * * len - The number of elements in the buffer
  */
 pub unsafe fn CVec<T>(base: *mut T, len: uint) -> CVec<T> {
-    return CVecCtor({
+    return CVec{
         base: base,
         len: len,
         rsrc: @DtorRes(option::None)
-    });
+    };
 }
 
 /**
@@ -105,11 +105,11 @@ pub unsafe fn CVec<T>(base: *mut T, len: uint) -> CVec<T> {
  */
 pub unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: fn@())
   -> CVec<T> {
-    return CVecCtor({
+    return CVec{
         base: base,
         len: len,
         rsrc: @DtorRes(option::Some(dtor))
-    });
+    };
 }
 
 /*
@@ -123,7 +123,7 @@ pub unsafe fn c_vec_with_dtor<T>(base: *mut T, len: uint, dtor: fn@())
  */
 pub fn get<T: Copy>(t: CVec<T>, ofs: uint) -> T {
     assert ofs < len(t);
-    return unsafe { *ptr::mut_offset((*t).base, ofs) };
+    return unsafe { *ptr::mut_offset(t.base, ofs) };
 }
 
 /**
@@ -133,7 +133,7 @@ pub fn get<T: Copy>(t: CVec<T>, ofs: uint) -> T {
  */
 pub fn set<T: Copy>(t: CVec<T>, ofs: uint, v: T) {
     assert ofs < len(t);
-    unsafe { *ptr::mut_offset((*t).base, ofs) = v };
+    unsafe { *ptr::mut_offset(t.base, ofs) = v };
 }
 
 /*
@@ -141,14 +141,10 @@ pub fn set<T: Copy>(t: CVec<T>, ofs: uint, v: T) {
  */
 
 /// Returns the length of the vector
-pub pure fn len<T>(t: CVec<T>) -> uint {
-    return (*t).len;
-}
+pub pure fn len<T>(t: CVec<T>) -> uint { t.len }
 
 /// Returns a pointer to the first element of the vector
-pub unsafe fn ptr<T>(t: CVec<T>) -> *mut T {
-    return (*t).base;
-}
+pub unsafe fn ptr<T>(t: CVec<T>) -> *mut T { t.base }
 
 #[cfg(test)]
 mod tests {
diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs
index 25deaf2a9b5..aaeecfb3302 100644
--- a/src/libstd/ebml.rs
+++ b/src/libstd/ebml.rs
@@ -84,22 +84,27 @@ pub mod reader {
         }
     }
 
-    fn vuint_at(data: &[u8], start: uint) -> {val: uint, next: uint} {
+    struct Res {
+        val: uint,
+        next: uint
+    }
+
+    fn vuint_at(data: &[u8], start: uint) -> Res {
         let a = data[start];
         if a & 0x80u8 != 0u8 {
-            return {val: (a & 0x7fu8) as uint, next: start + 1u};
+            return Res {val: (a & 0x7fu8) as uint, next: start + 1u};
         }
         if a & 0x40u8 != 0u8 {
-            return {val: ((a & 0x3fu8) as uint) << 8u |
+            return Res {val: ((a & 0x3fu8) as uint) << 8u |
                         (data[start + 1u] as uint),
                     next: start + 2u};
         } else if a & 0x20u8 != 0u8 {
-            return {val: ((a & 0x1fu8) as uint) << 16u |
+            return Res {val: ((a & 0x1fu8) as uint) << 16u |
                         (data[start + 1u] as uint) << 8u |
                         (data[start + 2u] as uint),
                     next: start + 3u};
         } else if a & 0x10u8 != 0u8 {
-            return {val: ((a & 0x0fu8) as uint) << 24u |
+            return Res {val: ((a & 0x0fu8) as uint) << 24u |
                         (data[start + 1u] as uint) << 16u |
                         (data[start + 2u] as uint) << 8u |
                         (data[start + 3u] as uint),
diff --git a/src/libstd/md4.rs b/src/libstd/md4.rs
index e1e2bb2697f..718e805b5d9 100644
--- a/src/libstd/md4.rs
+++ b/src/libstd/md4.rs
@@ -14,7 +14,14 @@ use core::str;
 use core::uint;
 use core::vec;
 
-pub pure fn md4(msg: &[u8]) -> {a: u32, b: u32, c: u32, d: u32} {
+struct Quad {
+    a: u32,
+    b: u32,
+    c: u32,
+    d: u32
+}
+
+pub pure fn md4(msg: &[u8]) -> Quad {
     // subtle: if orig_len is merely uint, then the code below
     // which performs shifts by 32 bits or more has undefined
     // results.
@@ -95,11 +102,11 @@ pub pure fn md4(msg: &[u8]) -> {a: u32, b: u32, c: u32, d: u32} {
         a += aa; b += bb; c += cc; d += dd;
         i += 64u;
     }
-    return {a: a, b: b, c: c, d: d};
+    return Quad {a: a, b: b, c: c, d: d};
 }
 
 pub pure fn md4_str(msg: &[u8]) -> ~str {
-    let {a, b, c, d} = md4(msg);
+    let Quad {a, b, c, d} = md4(msg);
     pure fn app(a: u32, b: u32, c: u32, d: u32, f: fn(u32)) {
         f(a); f(b); f(c); f(d);
     }
diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs
index a5c740c343c..5fb7d892c58 100644
--- a/src/libstd/sha1.rs
+++ b/src/libstd/sha1.rs
@@ -66,7 +66,7 @@ const k3: u32 = 0xCA62C1D6u32;
 
 /// Construct a `sha` object
 pub fn sha1() -> Sha1 {
-    type Sha1State =
+    struct Sha1State
         {h: ~[mut u32],
          mut len_low: u32,
          mut len_high: u32,
@@ -258,7 +258,7 @@ pub fn sha1() -> Sha1 {
             return s;
         }
     }
-    let st = {
+    let st = Sha1State {
         h: vec::cast_to_mut(vec::from_elem(digest_buf_len, 0u32)),
         mut len_low: 0u32,
         mut len_high: 0u32,
diff --git a/src/libstd/std.rc b/src/libstd/std.rc
index 65122bea750..a2fbc8b1db1 100644
--- a/src/libstd/std.rc
+++ b/src/libstd/std.rc
@@ -34,10 +34,6 @@ not required in or otherwise suitable for the core library.
 #[forbid(deprecated_pattern)];
 #[allow(deprecated_self)];
 
-
-// Transitional
-#[legacy_records];
-
 #[no_core];
 
 extern mod core(vers = "0.6");
diff --git a/src/libstd/test.rs b/src/libstd/test.rs
index 5a2693a42c1..4f0b7da89aa 100644
--- a/src/libstd/test.rs
+++ b/src/libstd/test.rs
@@ -92,7 +92,7 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
         };
 
     let filter =
-        if vec::len(matches.free) > 0u {
+        if vec::len(matches.free) > 0 {
             option::Some(matches.free[0])
         } else { option::None };
 
@@ -111,26 +111,27 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
 #[deriving_eq]
 pub enum TestResult { TrOk, TrFailed, TrIgnored, }
 
-type ConsoleTestState =
-    @{out: io::Writer,
-      log_out: Option<io::Writer>,
-      use_color: bool,
-      mut total: uint,
-      mut passed: uint,
-      mut failed: uint,
-      mut ignored: uint,
-      mut failures: ~[TestDesc]};
+struct ConsoleTestState {
+    out: io::Writer,
+    log_out: Option<io::Writer>,
+    use_color: bool,
+    mut total: uint,
+    mut passed: uint,
+    mut failed: uint,
+    mut ignored: uint,
+    mut failures: ~[TestDesc]
+}
 
 // A simple console test runner
 pub fn run_tests_console(opts: &TestOpts,
                      tests: &[TestDesc]) -> bool {
 
-    fn callback(event: &TestEvent, st: ConsoleTestState) {
+    fn callback(event: &TestEvent, st: @ConsoleTestState) {
         debug!("callback(event=%?)", event);
         match *event {
           TeFiltered(ref filtered_tests) => {
             st.total = filtered_tests.len();
-            let noun = if st.total != 1u { ~"tests" } else { ~"test" };
+            let noun = if st.total != 1 { ~"tests" } else { ~"test" };
             st.out.write_line(fmt!("\nrunning %u %s", st.total, noun));
           }
           TeWait(ref test) => st.out.write_str(
@@ -142,18 +143,18 @@ pub fn run_tests_console(opts: &TestOpts,
             }
             match result {
               TrOk => {
-                st.passed += 1u;
+                st.passed += 1;
                 write_ok(st.out, st.use_color);
                 st.out.write_line(~"");
               }
               TrFailed => {
-                st.failed += 1u;
+                st.failed += 1;
                 write_failed(st.out, st.use_color);
                 st.out.write_line(~"");
                 st.failures.push(move test);
               }
               TrIgnored => {
-                st.ignored += 1u;
+                st.ignored += 1;
                 write_ignored(st.out, st.use_color);
                 st.out.write_line(~"");
               }
@@ -174,19 +175,19 @@ pub fn run_tests_console(opts: &TestOpts,
     };
 
     let st =
-        @{out: io::stdout(),
+        @ConsoleTestState{out: io::stdout(),
           log_out: log_out,
           use_color: use_color(),
-          mut total: 0u,
-          mut passed: 0u,
-          mut failed: 0u,
-          mut ignored: 0u,
+          mut total: 0,
+          mut passed: 0,
+          mut failed: 0,
+          mut ignored: 0,
           mut failures: ~[]};
 
     run_tests(opts, tests, |x| callback(&x, st));
 
     assert (st.passed + st.failed + st.ignored == st.total);
-    let success = st.failed == 0u;
+    let success = st.failed == 0;
 
     if !success {
         print_failures(st);
@@ -234,7 +235,7 @@ pub fn run_tests_console(opts: &TestOpts,
     }
 }
 
-fn print_failures(st: ConsoleTestState) {
+fn print_failures(st: @ConsoleTestState) {
     st.out.write_line(~"\nfailures:");
     let failures = copy st.failures;
     let failures = vec::map(failures, |test| test.name);
@@ -262,13 +263,13 @@ fn should_sort_failures_before_printing_them() {
         };
 
         let st =
-            @{out: wr,
+            @ConsoleTestState{out: wr,
               log_out: option::None,
               use_color: false,
-              mut total: 0u,
-              mut passed: 0u,
-              mut failed: 0u,
-              mut ignored: 0u,
+              mut total: 0,
+              mut passed: 0,
+              mut failed: 0,
+              mut ignored: 0,
               mut failures: ~[move test_b, move test_a]};
 
         print_failures(st);
@@ -279,7 +280,7 @@ fn should_sort_failures_before_printing_them() {
     assert apos < bpos;
 }
 
-fn use_color() -> bool { return get_concurrency() == 1u; }
+fn use_color() -> bool { return get_concurrency() == 1; }
 
 enum TestEvent {
     TeFiltered(~[TestDesc]),
@@ -334,7 +335,7 @@ fn run_tests(opts: &TestOpts,
 
 // Windows tends to dislike being overloaded with threads.
 #[cfg(windows)]
-const sched_overcommit : uint = 1u;
+const sched_overcommit : uint = 1;
 
 #[cfg(unix)]
 const sched_overcommit : uint = 4u;
@@ -342,7 +343,7 @@ const sched_overcommit : uint = 4u;
 fn get_concurrency() -> uint {
     unsafe {
         let threads = rustrt::rust_sched_threads() as uint;
-        if threads == 1u { 1u }
+        if threads == 1 { 1 }
         else { threads * sched_overcommit }
     }
 }
@@ -556,7 +557,7 @@ mod tests {
         ];
         let filtered = filter_tests(&opts, tests);
 
-        assert (vec::len(filtered) == 1u);
+        assert (vec::len(filtered) == 1);
         assert (filtered[0].name == ~"1");
         assert (filtered[0].ignore == false);
     }
diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs
index 6fcbccf8183..fe4137f76be 100644
--- a/src/libstd/uv_iotask.rs
+++ b/src/libstd/uv_iotask.rs
@@ -27,19 +27,17 @@ use core::task::TaskBuilder;
 use core::task;
 
 /// Used to abstract-away direct interaction with a libuv loop.
-pub enum IoTask {
-    IoTask_({
-        async_handle: *ll::uv_async_t,
-        op_chan: SharedChan<IoTaskMsg>
-    })
+pub struct IoTask {
+    async_handle: *ll::uv_async_t,
+    op_chan: SharedChan<IoTaskMsg>
 }
 
 impl IoTask: Clone {
     fn clone(&self) -> IoTask {
-        IoTask_({
+        IoTask{
             async_handle: self.async_handle,
             op_chan: self.op_chan.clone()
-        })
+        }
     }
 }
 
@@ -131,10 +129,10 @@ fn run_loop(iotask_ch: &Chan<IoTask>) {
 
         // Send out a handle through which folks can talk to us
         // while we dwell in the I/O loop
-        let iotask = IoTask_({
+        let iotask = IoTask{
             async_handle: async_handle,
             op_chan: SharedChan(msg_ch)
-        });
+        };
         iotask_ch.send(iotask);
 
         log(debug, ~"about to run uv loop");
diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs
index 8bef6eb6c91..ca5a821921a 100644
--- a/src/libstd/uv_ll.rs
+++ b/src/libstd/uv_ll.rs
@@ -1543,7 +1543,7 @@ pub mod test {
             let continue_async_handle_ptr =
                 ptr::addr_of(&continue_async_handle);
             let async_data =
-                { continue_chan: continue_chan };
+                async_handle_data { continue_chan: continue_chan };
             let async_data_ptr = ptr::addr_of(&async_data);
 
             let server_data = tcp_server_data {