about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/collections/hash/map.rs2
-rw-r--r--src/libstd/collections/mod.rs8
-rw-r--r--src/libstd/ffi/c_str.rs4
-rw-r--r--src/libstd/macros.rs4
-rw-r--r--src/libstd/num/mod.rs66
-rw-r--r--src/libstd/num/uint_macros.rs62
-rw-r--r--src/libstd/old_path/windows.rs2
7 files changed, 76 insertions, 72 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index f5d2b8aed29..df2fb538c0a 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -203,7 +203,7 @@ fn test_resize_policy() {
 // produces identical results to a linear naive reinsertion from the same
 // element.
 //
-// FIXME(Gankro, pczarn): review the proof and put it all in a separate doc.rs
+// FIXME(Gankro, pczarn): review the proof and put it all in a separate README.md
 
 /// A hash map implementation which uses linear probing with Robin
 /// Hood bucket stealing.
diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs
index 0e64370df60..100d3e6ed4a 100644
--- a/src/libstd/collections/mod.rs
+++ b/src/libstd/collections/mod.rs
@@ -23,9 +23,9 @@
 //!
 //! Rust's collections can be grouped into four major categories:
 //!
-//! * Sequences: `Vec`, `VecDeque`, `LinkedList`, `BitV`
+//! * Sequences: `Vec`, `VecDeque`, `LinkedList`, `BitVec`
 //! * Maps: `HashMap`, `BTreeMap`, `VecMap`
-//! * Sets: `HashSet`, `BTreeSet`, `BitVSet`
+//! * Sets: `HashSet`, `BTreeSet`, `BitSet`
 //! * Misc: `BinaryHeap`
 //!
 //! # When Should You Use Which Collection?
@@ -73,11 +73,11 @@
 //! * There is no meaningful value to associate with your keys.
 //! * You just want a set.
 //!
-//! ### Use a `BitV` when:
+//! ### Use a `BitVec` when:
 //! * You want to store an unbounded number of booleans in a small space.
 //! * You want a bit vector.
 //!
-//! ### Use a `BitVSet` when:
+//! ### Use a `BitSet` when:
 //! * You want a `VecSet`.
 //!
 //! ### Use a `BinaryHeap` when:
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index 8976813d3f9..8900713974b 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -224,7 +224,7 @@ impl CString {
     /// Returns the contents of this `CString` as a slice of bytes.
     ///
     /// The returned slice does **not** contain the trailing nul separator and
-    /// it is guaranteet to not have any interior nul bytes.
+    /// it is guaranteed to not have any interior nul bytes.
     pub fn as_bytes(&self) -> &[u8] {
         &self.inner[..self.inner.len() - 1]
     }
@@ -333,7 +333,7 @@ impl CStr {
     /// Return the inner pointer to this C string.
     ///
     /// The returned pointer will be valid for as long as `self` is and points
-    /// to a continguous region of memory terminated with a 0 byte to represent
+    /// to a contiguous region of memory terminated with a 0 byte to represent
     /// the end of the string.
     pub fn as_ptr(&self) -> *const libc::c_char {
         self.inner.as_ptr()
diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs
index 00bb7f86b17..abdcca59c58 100644
--- a/src/libstd/macros.rs
+++ b/src/libstd/macros.rs
@@ -44,7 +44,7 @@ macro_rules! panic {
     ($msg:expr) => ({
         $crate::rt::begin_unwind($msg, {
             // static requires less code at runtime, more constant data
-            static _FILE_LINE: (&'static str, usize) = (file!(), line!());
+            static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
             &_FILE_LINE
         })
     });
@@ -54,7 +54,7 @@ macro_rules! panic {
             // used inside a dead function. Just `#[allow(dead_code)]` is
             // insufficient, since the user may have
             // `#[forbid(dead_code)]` and which cannot be overridden.
-            static _FILE_LINE: (&'static str, usize) = (file!(), line!());
+            static _FILE_LINE: (&'static str, usize) = (file!(), line!() as usize);
             &_FILE_LINE
         })
     });
diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs
index 968adfafeab..15ae8b027e1 100644
--- a/src/libstd/num/mod.rs
+++ b/src/libstd/num/mod.rs
@@ -1751,6 +1751,72 @@ mod tests {
         assert_pow!((8,     3 ) => 512);
         assert_pow!((2u64,   50) => 1125899906842624);
     }
+
+    #[test]
+    fn test_uint_to_str_overflow() {
+        let mut u8_val: u8 = 255_u8;
+        assert_eq!(u8_val.to_string(), "255");
+
+        u8_val += 1 as u8;
+        assert_eq!(u8_val.to_string(), "0");
+
+        let mut u16_val: u16 = 65_535_u16;
+        assert_eq!(u16_val.to_string(), "65535");
+
+        u16_val += 1 as u16;
+        assert_eq!(u16_val.to_string(), "0");
+
+        let mut u32_val: u32 = 4_294_967_295_u32;
+        assert_eq!(u32_val.to_string(), "4294967295");
+
+        u32_val += 1 as u32;
+        assert_eq!(u32_val.to_string(), "0");
+
+        let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
+        assert_eq!(u64_val.to_string(), "18446744073709551615");
+
+        u64_val += 1 as u64;
+        assert_eq!(u64_val.to_string(), "0");
+    }
+
+    fn from_str<T: ::str::FromStr>(t: &str) -> Option<T> {
+        ::str::FromStr::from_str(t).ok()
+    }
+
+    #[test]
+    fn test_uint_from_str_overflow() {
+        let mut u8_val: u8 = 255_u8;
+        assert_eq!(from_str::<u8>("255"), Some(u8_val));
+        assert_eq!(from_str::<u8>("256"), None);
+
+        u8_val += 1 as u8;
+        assert_eq!(from_str::<u8>("0"), Some(u8_val));
+        assert_eq!(from_str::<u8>("-1"), None);
+
+        let mut u16_val: u16 = 65_535_u16;
+        assert_eq!(from_str::<u16>("65535"), Some(u16_val));
+        assert_eq!(from_str::<u16>("65536"), None);
+
+        u16_val += 1 as u16;
+        assert_eq!(from_str::<u16>("0"), Some(u16_val));
+        assert_eq!(from_str::<u16>("-1"), None);
+
+        let mut u32_val: u32 = 4_294_967_295_u32;
+        assert_eq!(from_str::<u32>("4294967295"), Some(u32_val));
+        assert_eq!(from_str::<u32>("4294967296"), None);
+
+        u32_val += 1 as u32;
+        assert_eq!(from_str::<u32>("0"), Some(u32_val));
+        assert_eq!(from_str::<u32>("-1"), None);
+
+        let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
+        assert_eq!(from_str::<u64>("18446744073709551615"), Some(u64_val));
+        assert_eq!(from_str::<u64>("18446744073709551616"), None);
+
+        u64_val += 1 as u64;
+        assert_eq!(from_str::<u64>("0"), Some(u64_val));
+        assert_eq!(from_str::<u64>("-1"), None);
+    }
 }
 
 
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index 8d4f0344beb..c9e6a8f66d1 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -48,68 +48,6 @@ mod tests {
         assert_eq!(FromStrRadix::from_str_radix("Z", 10).ok(), None::<$T>);
         assert_eq!(FromStrRadix::from_str_radix("_", 2).ok(), None::<$T>);
     }
-
-    #[test]
-    fn test_uint_to_str_overflow() {
-        let mut u8_val: u8 = 255_u8;
-        assert_eq!(u8_val.to_string(), "255");
-
-        u8_val += 1 as u8;
-        assert_eq!(u8_val.to_string(), "0");
-
-        let mut u16_val: u16 = 65_535_u16;
-        assert_eq!(u16_val.to_string(), "65535");
-
-        u16_val += 1 as u16;
-        assert_eq!(u16_val.to_string(), "0");
-
-        let mut u32_val: u32 = 4_294_967_295_u32;
-        assert_eq!(u32_val.to_string(), "4294967295");
-
-        u32_val += 1 as u32;
-        assert_eq!(u32_val.to_string(), "0");
-
-        let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
-        assert_eq!(u64_val.to_string(), "18446744073709551615");
-
-        u64_val += 1 as u64;
-        assert_eq!(u64_val.to_string(), "0");
-    }
-
-    #[test]
-    fn test_uint_from_str_overflow() {
-        let mut u8_val: u8 = 255_u8;
-        assert_eq!(from_str::<u8>("255"), Some(u8_val));
-        assert_eq!(from_str::<u8>("256"), None);
-
-        u8_val += 1 as u8;
-        assert_eq!(from_str::<u8>("0"), Some(u8_val));
-        assert_eq!(from_str::<u8>("-1"), None);
-
-        let mut u16_val: u16 = 65_535_u16;
-        assert_eq!(from_str::<u16>("65535"), Some(u16_val));
-        assert_eq!(from_str::<u16>("65536"), None);
-
-        u16_val += 1 as u16;
-        assert_eq!(from_str::<u16>("0"), Some(u16_val));
-        assert_eq!(from_str::<u16>("-1"), None);
-
-        let mut u32_val: u32 = 4_294_967_295_u32;
-        assert_eq!(from_str::<u32>("4294967295"), Some(u32_val));
-        assert_eq!(from_str::<u32>("4294967296"), None);
-
-        u32_val += 1 as u32;
-        assert_eq!(from_str::<u32>("0"), Some(u32_val));
-        assert_eq!(from_str::<u32>("-1"), None);
-
-        let mut u64_val: u64 = 18_446_744_073_709_551_615_u64;
-        assert_eq!(from_str::<u64>("18446744073709551615"), Some(u64_val));
-        assert_eq!(from_str::<u64>("18446744073709551616"), None);
-
-        u64_val += 1 as u64;
-        assert_eq!(from_str::<u64>("0"), Some(u64_val));
-        assert_eq!(from_str::<u64>("-1"), None);
-    }
 }
 
 ) }
diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs
index 31a2be1daf3..31a8cbe572a 100644
--- a/src/libstd/old_path/windows.rs
+++ b/src/libstd/old_path/windows.rs
@@ -507,7 +507,7 @@ impl GenericPath for Path {
 
     fn path_relative_from(&self, base: &Path) -> Option<Path> {
         fn comp_requires_verbatim(s: &str) -> bool {
-            s == "." || s == ".." || s.contains_char(SEP2)
+            s == "." || s == ".." || s.contains(SEP2)
         }
 
         if !self.equiv_prefix(base) {