diff options
| author | bors <bors@rust-lang.org> | 2014-06-06 20:42:01 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-06-06 20:42:01 -0700 |
| commit | e87e18064ece0d7eddb269b8211fb8fdf5efaa91 (patch) | |
| tree | d57ee1ed5bf68588d436c75d1ca91143981564b9 /src/libstd | |
| parent | bd6683c729e3dc919e054839eed07702d938b727 (diff) | |
| parent | 8bf6da0836be838f10e50de1105f92087f83f526 (diff) | |
| download | rust-e87e18064ece0d7eddb269b8211fb8fdf5efaa91.tar.gz rust-e87e18064ece0d7eddb269b8211fb8fdf5efaa91.zip | |
auto merge of #14712 : alexcrichton/rust/rollup, r=alexcrichton
Closes #14675 (rustc: Encode argument names for traits) Closes #14681 (rustc: Avoid UB with signed division/remainder) Closes #14682 (librustc: Update AutoObject adjustment in writeback.) Closes #14683 (Avoid 16-byte filenames in rlibs) Closes #14687 (rustdoc: Inline static documentation across crates) Closes #14689 (Remove reference to ~str in documentation) Closes #14692 (Rename Iterator::len to count) Closes #14693 (Implement Eq for HashSet and HashMap) Closes #14699 (url: encode small bytes correctly.) Closes #14700 (rustdoc: Submit examples to play.rust-lang.org) Closes #14701 (mk: Run doc tests with --cfg dox) Closes #14710 (rustc: Preserve reachable extern fns with LTO) Closes #14711 (Removing unused wrapper to libc::close.)
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hashmap.rs | 10 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 3 | ||||
| -rw-r--r-- | src/libstd/macros.rs | 8 | ||||
| -rw-r--r-- | src/libstd/num/strconv.rs | 1 | ||||
| -rw-r--r-- | src/libstd/os.rs | 6 | ||||
| -rw-r--r-- | src/libstd/rand/mod.rs | 12 | ||||
| -rw-r--r-- | src/libstd/rt/backtrace.rs | 3 |
7 files changed, 22 insertions, 21 deletions
diff --git a/src/libstd/collections/hashmap.rs b/src/libstd/collections/hashmap.rs index 5dba7a533a1..571c5794704 100644 --- a/src/libstd/collections/hashmap.rs +++ b/src/libstd/collections/hashmap.rs @@ -684,8 +684,8 @@ impl DefaultResizePolicy { /// denial-of-service attacks (Hash DoS). This behaviour can be /// overridden with one of the constructors. /// -/// It is required that the keys implement the `PartialEq` and `Hash` traits, although -/// this can frequently be achieved by using `#[deriving(PartialEq, Hash)]`. +/// It is required that the keys implement the `Eq` and `Hash` traits, although +/// this can frequently be achieved by using `#[deriving(Eq, Hash)]`. /// /// Relevant papers/articles: /// @@ -1422,6 +1422,8 @@ impl<K: Eq + Hash<S>, V: PartialEq, S, H: Hasher<S>> PartialEq for HashMap<K, V, } } +impl<K: Eq + Hash<S>, V: Eq, S, H: Hasher<S>> Eq for HashMap<K, V, H> {} + impl<K: Eq + Hash<S> + Show, V: Show, S, H: Hasher<S>> Show for HashMap<K, V, H> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { try!(write!(f, r"\{")); @@ -1486,7 +1488,7 @@ pub type SetMoveItems<K> = /// An implementation of a hash set using the underlying representation of a /// HashMap where the value is (). As with the `HashMap` type, a `HashSet` -/// requires that the elements implement the `PartialEq` and `Hash` traits. +/// requires that the elements implement the `Eq` and `Hash` traits. #[deriving(Clone)] pub struct HashSet<T, H = sip::SipHasher> { map: HashMap<T, (), H> @@ -1500,6 +1502,8 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> PartialEq for HashSet<T, H> { } } +impl<T: Eq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {} + impl<T: Eq + Hash<S>, S, H: Hasher<S>> Container for HashSet<T, H> { fn len(&self) -> uint { self.map.len() } } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 90d6677d612..109832b7c47 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -101,7 +101,8 @@ #![crate_type = "dylib"] #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", - html_root_url = "http://doc.rust-lang.org/")] + html_root_url = "http://doc.rust-lang.org/", + html_playground_url = "http://play.rust-lang.org/")] #![feature(macro_rules, globs, asm, managed_boxes, thread_local, link_args, linkage, default_type_params, phase, concat_idents, quad_precision_float)] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index 0b9fc250636..805da8021ed 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -212,7 +212,7 @@ macro_rules! unimplemented( () => (fail!("not yet implemented")) ) -/// Use the syntax described in `std::fmt` to create a value of type `~str`. +/// Use the syntax described in `std::fmt` to create a value of type `String`. /// See `std::fmt` for more information. /// /// # Example @@ -465,7 +465,7 @@ pub mod builtin { /// ``` /// let rust = bytes!("r", 'u', "st", 255); /// assert_eq!(rust[1], 'u' as u8); - /// assert_eq!(rust[5], 255); + /// assert_eq!(rust[4], 255); /// ``` #[macro_export] macro_rules! bytes( ($($e:expr),*) => ({ /* compiler built-in */ }) ) @@ -482,10 +482,14 @@ pub mod builtin { /// # Example /// /// ``` + /// #![feature(concat_idents)] + /// + /// # fn main() { /// fn foobar() -> int { 23 } /// /// let f = concat_idents!(foo, bar); /// println!("{}", f()); + /// # } /// ``` #[macro_export] macro_rules! concat_idents( ($($e:ident),*) => ({ /* compiler built-in */ }) ) diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 54ca5797804..133a8db90fa 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -13,7 +13,6 @@ use char; use clone::Clone; use container::Container; -use iter::Iterator; use num::{NumCast, Zero, One, cast, Int}; use num::{Float, FPNaN, FPInfinite, ToPrimitive}; use num; diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 1f75754f4d5..381ebc08200 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -56,12 +56,6 @@ use libc::c_char; #[cfg(windows)] use str::OwnedStr; -/// Delegates to the libc close() function, returning the same return value. -pub fn close(fd: int) -> int { - unsafe { - libc::close(fd as c_int) as int - } -} pub static TMPBUF_SZ : uint = 1000u; static BUF_BYTES : uint = 2048u; diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 61a2ffd383d..ee193562887 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -353,17 +353,17 @@ mod test { #[test] fn test_gen_ascii_str() { let mut r = task_rng(); - assert_eq!(r.gen_ascii_chars().take(0).len(), 0u); - assert_eq!(r.gen_ascii_chars().take(10).len(), 10u); - assert_eq!(r.gen_ascii_chars().take(16).len(), 16u); + assert_eq!(r.gen_ascii_chars().take(0).count(), 0u); + assert_eq!(r.gen_ascii_chars().take(10).count(), 10u); + assert_eq!(r.gen_ascii_chars().take(16).count(), 16u); } #[test] fn test_gen_vec() { let mut r = task_rng(); - assert_eq!(r.gen_iter::<u8>().take(0).len(), 0u); - assert_eq!(r.gen_iter::<u8>().take(10).len(), 10u); - assert_eq!(r.gen_iter::<f64>().take(16).len(), 16u); + assert_eq!(r.gen_iter::<u8>().take(0).count(), 0u); + assert_eq!(r.gen_iter::<u8>().take(10).count(), 10u); + assert_eq!(r.gen_iter::<f64>().take(16).count(), 16u); } #[test] diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs index ac421bf78be..94472ee7241 100644 --- a/src/libstd/rt/backtrace.rs +++ b/src/libstd/rt/backtrace.rs @@ -84,7 +84,7 @@ fn demangle(writer: &mut Writer, s: &str) -> IoResult<()> { if i == 0 { valid = chars.next().is_none(); break - } else if chars.by_ref().take(i - 1).len() != i - 1 { + } else if chars.by_ref().take(i - 1).count() != i - 1 { valid = false; } } @@ -505,7 +505,6 @@ mod imp { use c_str::CString; use container::Container; use io::{IoResult, Writer}; - use iter::Iterator; use libc; use mem; use ops::Drop; |
