diff options
| author | bors <bors@rust-lang.org> | 2013-03-26 16:21:59 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-26 16:21:59 -0700 |
| commit | fa82b9af2ae1f5a32a6f0d34366f0a26aee151d6 (patch) | |
| tree | 65b4789c0d2ba30391c2cef2681c753bc4e40ff6 /src/libcore | |
| parent | 3d588c528685fa0590ff91f189f0ef44a3815ec2 (diff) | |
| parent | d69108d8f78a9b5a8669606b62fe6df6409d17e7 (diff) | |
| download | rust-fa82b9af2ae1f5a32a6f0d34366f0a26aee151d6.tar.gz rust-fa82b9af2ae1f5a32a6f0d34366f0a26aee151d6.zip | |
auto merge of #5523 : alexcrichton/rust/less-oldmap, r=thestinger
I started out just removing a few instances of `HashMap` throughout rustc, but it ended up snowballing to remove the entire thing. Most uses translated to just using `@mut LinearMap` instead of `HashMap`, although I tried where possible to drop the `@mut` modifier. This ended up working out some of the time, but definitely not in the major use cases. Things got kinda weird in some cases like: * https://github.com/alexcrichton/rust/compare/mozilla:a56ec8c1342453a88be79e192a11501844375d40...alexcrichton:621b63300358cacad088ddd7f78180f29c40e66e#L39R1587 * https://github.com/alexcrichton/rust/compare/mozilla:a56ec8c1342453a88be79e192a11501844375d40...alexcrichton:621b63300358cacad088ddd7f78180f29c40e66e#L61R3760 * https://github.com/alexcrichton/rust/compare/mozilla:a56ec8c1342453a88be79e192a11501844375d40...alexcrichton:621b63300358cacad088ddd7f78180f29c40e66e#L71R917 * https://github.com/alexcrichton/rust/compare/mozilla:a56ec8c1342453a88be79e192a11501844375d40...alexcrichton:621b63300358cacad088ddd7f78180f29c40e66e#L91R127 I tried to tag them all with bugs which I thought would make them less weird, but I may have the wrong bug in a few places. These cases only came up when I tried to pass around `&mut LinearMap` instead of an `@mut LinearMap`. I also ran into a few bugs when migrating to `LinearMap`, one of which is #5521. There's another set of bugs which a00d779042fb8753c716e07b4f1aac0d5ab7bf66 addresses (all marked with `XXX`). I have a feeling they're all the same bug, but all I've been able is to reproduce them. I tried to whittle down the test cases and try to get some input which causes a failure, but I've been unable to do so. All I know is that it's vaguely related to `*T` pointers being used as `&*T` (return value of `find`). I'm not able to open a very descriptive issue, but I'll do so if there seems no other better route. I realize this is a very large pull request, so if it'd be better to split this up into multiple segments I'd be more than willing to do so. So far the tests all pass locally, although I'm sure bors will turn something up. I also don't mind keeping this up to date with rebasing. This maybe should wait until after 0.6 because it is a fairly large change...
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/flate.rs | 2 | ||||
| -rw-r--r-- | src/libcore/hashmap.rs | 5 | ||||
| -rw-r--r-- | src/libcore/logging.rs | 3 | ||||
| -rw-r--r-- | src/libcore/rt/io/mod.rs | 3 | ||||
| -rw-r--r-- | src/libcore/rt/uv/mod.rs | 1 | ||||
| -rw-r--r-- | src/libcore/rt/uvll.rs | 1 |
6 files changed, 7 insertions, 8 deletions
diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index d9dc89097d0..2ddf9277096 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -17,10 +17,10 @@ Simple compression use libc; use libc::{c_void, size_t, c_int}; use ptr; -use rand::RngUtil; use vec; #[cfg(test)] use rand; +#[cfg(test)] use rand::RngUtil; pub mod rustrt { use libc::{c_int, c_void, size_t}; diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index 8c290553a45..6f97bf6dde2 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -656,6 +656,11 @@ pub mod linear { fn reserve_at_least(&mut self, n: uint) { self.map.reserve_at_least(n) } + + /// Consumes all of the elements in the set, emptying it out + fn consume(&mut self, f: &fn(T)) { + self.map.consume(|k, _| f(k)) + } } #[test] diff --git a/src/libcore/logging.rs b/src/libcore/logging.rs index be6469abc92..ba976de50ab 100644 --- a/src/libcore/logging.rs +++ b/src/libcore/logging.rs @@ -10,8 +10,6 @@ //! Logging -use libc; - pub mod rustrt { use libc; @@ -49,6 +47,7 @@ pub fn console_off() { pub fn log_type<T>(level: u32, object: &T) { use cast::transmute; use io; + use libc; use repr; use vec; diff --git a/src/libcore/rt/io/mod.rs b/src/libcore/rt/io/mod.rs index f82092b829c..1634e7443b4 100644 --- a/src/libcore/rt/io/mod.rs +++ b/src/libcore/rt/io/mod.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use option::*; -use comm::{GenericPort, GenericChan}; - pub mod file; // FIXME #5370 Strongly want this to be StreamError(&mut Stream) diff --git a/src/libcore/rt/uv/mod.rs b/src/libcore/rt/uv/mod.rs index 28d695273e7..94a3b562fd8 100644 --- a/src/libcore/rt/uv/mod.rs +++ b/src/libcore/rt/uv/mod.rs @@ -42,7 +42,6 @@ use ptr; use libc::{c_void, c_int, size_t, malloc, free, ssize_t}; use cast::{transmute, transmute_mut_region}; use ptr::null; -use sys::size_of; use super::uvll; use super::uvll::*; use unstable::finally::Finally; diff --git a/src/libcore/rt/uvll.rs b/src/libcore/rt/uvll.rs index 5111b2bdc1d..4eaf9dcf40a 100644 --- a/src/libcore/rt/uvll.rs +++ b/src/libcore/rt/uvll.rs @@ -32,7 +32,6 @@ use libc::{size_t, c_int, c_uint, c_void, c_char, uintptr_t}; use libc::{malloc, free}; use prelude::*; -use ptr::to_unsafe_ptr; pub struct uv_err_t { code: c_int, |
