about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-05 18:55:41 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-05 18:55:41 -0800
commit384e21878904ad1f139d9452c122b10a28a3c28c (patch)
treefa915ac71411765c8c5b38dc421980033005ebd6 /src/libstd
parentafbce050ca3748a66b9e9783dc50f6c77f9bdf8b (diff)
parent8f3a424322f5609f75aab2313dc93b0ad73e2670 (diff)
Merge remote-tracking branch 'nrc/sized-2' into rollup
Conflicts:
	src/liballoc/boxed.rs
	src/libcollections/btree/map.rs
	src/libcollections/slice.rs
	src/libcore/borrow.rs
	src/libcore/cmp.rs
	src/libcore/ops.rs
	src/libstd/c_str.rs
	src/libstd/collections/hash/map.rs
	src/libsyntax/parse/obsolete.rs
	src/test/compile-fail/unboxed-closure-sugar-default.rs
	src/test/compile-fail/unboxed-closure-sugar-equiv.rs
	src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs
	src/test/compile-fail/unboxed-closure-sugar-region.rs
	src/test/compile-fail/unsized3.rs
	src/test/run-pass/associated-types-conditional-dispatch.rs
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/collections/hash/map.rs30
-rw-r--r--src/libstd/collections/hash/set.rs4
-rw-r--r--src/libstd/collections/hash/table.rs2
-rw-r--r--src/libstd/hash.rs2
-rw-r--r--src/libstd/io/mod.rs8
-rw-r--r--src/libstd/path/mod.rs2
-rw-r--r--src/libstd/path/posix.rs2
7 files changed, 25 insertions, 25 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index ce2be39a416..a3fc38c34e8 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -440,14 +440,14 @@ impl<K, V, M> SearchResult<K, V, M> {
 }
 
 impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
-    fn make_hash<Sized? X: Hash<S>>(&self, x: &X) -> SafeHash {
+    fn make_hash<X: ?Sized + Hash<S>>(&self, x: &X) -> SafeHash {
         table::make_hash(&self.hasher, x)
     }
 
     /// Search for a key, yielding the index if it's found in the hashtable.
     /// If you already have the hash for the key lying around, use
     /// search_hashed.
-    fn search<'a, Sized? Q>(&'a self, q: &Q) -> Option<FullBucketImm<'a, K, V>>
+    fn search<'a, Q: ?Sized>(&'a self, q: &Q) -> Option<FullBucketImm<'a, K, V>>
         where Q: BorrowFrom<K> + Eq + Hash<S>
     {
         let hash = self.make_hash(q);
@@ -455,7 +455,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
             .into_option()
     }
 
-    fn search_mut<'a, Sized? Q>(&'a mut self, q: &Q) -> Option<FullBucketMut<'a, K, V>>
+    fn search_mut<'a, Q: ?Sized>(&'a mut self, q: &Q) -> Option<FullBucketMut<'a, K, V>>
         where Q: BorrowFrom<K> + Eq + Hash<S>
     {
         let hash = self.make_hash(q);
@@ -923,7 +923,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     #[stable]
     /// Gets the given key's corresponding entry in the map for in-place manipulation.
     /// Regardless of whether or not `to_owned()` has been called, the key must hash the same way.
-    pub fn entry<'a, Sized? Q>(&'a mut self, key: &'a Q) -> Entry<'a, Q, K, V>
+    pub fn entry<'a, Q: ?Sized>(&'a mut self, key: &'a Q) -> Entry<'a, Q, K, V>
         where Q: Eq + Hash<S> + ToOwned<K>
     {
         // Gotta resize now.
@@ -1030,7 +1030,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     /// assert_eq!(map.get(&2), None);
     /// ```
     #[stable]
-    pub fn get<Sized? Q>(&self, k: &Q) -> Option<&V>
+    pub fn get<Q: ?Sized>(&self, k: &Q) -> Option<&V>
         where Q: Hash<S> + Eq + BorrowFrom<K>
     {
         self.search(k).map(|bucket| bucket.into_refs().1)
@@ -1053,7 +1053,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     /// assert_eq!(map.contains_key(&2), false);
     /// ```
     #[stable]
-    pub fn contains_key<Sized? Q>(&self, k: &Q) -> bool
+    pub fn contains_key<Q: ?Sized>(&self, k: &Q) -> bool
         where Q: Hash<S> + Eq + BorrowFrom<K>
     {
         self.search(k).is_some()
@@ -1079,7 +1079,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     /// assert_eq!(map[1], "b");
     /// ```
     #[stable]
-    pub fn get_mut<Sized? Q>(&mut self, k: &Q) -> Option<&mut V>
+    pub fn get_mut<Q: ?Sized>(&mut self, k: &Q) -> Option<&mut V>
         where Q: Hash<S> + Eq + BorrowFrom<K>
     {
         self.search_mut(k).map(|bucket| bucket.into_mut_refs().1)
@@ -1131,7 +1131,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     /// assert_eq!(map.remove(&1), None);
     /// ```
     #[stable]
-    pub fn remove<Sized? Q>(&mut self, k: &Q) -> Option<V>
+    pub fn remove<Q: ?Sized>(&mut self, k: &Q) -> Option<V>
         where Q: Hash<S> + Eq + BorrowFrom<K>
     {
         if self.table.size() == 0 {
@@ -1142,7 +1142,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S>> HashMap<K, V, H> {
     }
 }
 
-fn search_entry_hashed<'a, K, V, Sized? Q>(table: &'a mut RawTable<K,V>, hash: SafeHash, k: &'a Q)
+fn search_entry_hashed<'a, K, V, Q: ?Sized>(table: &'a mut RawTable<K,V>, hash: SafeHash, k: &'a Q)
         -> Entry<'a, Q, K, V>
     where Q: Eq + ToOwned<K>
 {
@@ -1227,7 +1227,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H>
 }
 
 #[stable]
-impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H>
+impl<K: Hash<S> + Eq, Q: ?Sized, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H>
     where Q: BorrowFrom<K> + Hash<S> + Eq
 {
     type Output = V;
@@ -1239,7 +1239,7 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H
 }
 
 #[stable]
-impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q> for HashMap<K, V, H>
+impl<K: Hash<S> + Eq, Q: ?Sized, V, S, H: Hasher<S>> IndexMut<Q> for HashMap<K, V, H>
     where Q: BorrowFrom<K> + Hash<S> + Eq
 {
     type Output = V;
@@ -1331,7 +1331,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
 
 #[stable]
 /// A view into a single empty location in a HashMap
-pub struct VacantEntry<'a, Sized? Q: 'a, K: 'a, V: 'a> {
+pub struct VacantEntry<'a, Q: ?Sized + 'a, K: 'a, V: 'a> {
     hash: SafeHash,
     key: &'a Q,
     elem: VacantEntryState<K, V, &'a mut RawTable<K, V>>,
@@ -1339,7 +1339,7 @@ pub struct VacantEntry<'a, Sized? Q: 'a, K: 'a, V: 'a> {
 
 #[stable]
 /// A view into a single location in a map, which may be vacant or occupied
-pub enum Entry<'a, Sized? Q: 'a, K: 'a, V: 'a> {
+pub enum Entry<'a, Q: ?Sized + 'a, K: 'a, V: 'a> {
     /// An occupied Entry
     Occupied(OccupiedEntry<'a, K, V>),
     /// A vacant Entry
@@ -1409,7 +1409,7 @@ impl<'a, K: 'a, V: 'a> Iterator for Drain<'a, K, V> {
     }
 }
 
-impl<'a, Sized? Q, K, V> Entry<'a, Q, K, V> {
+impl<'a, Q: ?Sized, K, V> Entry<'a, Q, K, V> {
     #[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
     /// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
     pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, Q, K, V>> {
@@ -1455,7 +1455,7 @@ impl<'a, K, V> OccupiedEntry<'a, K, V> {
     }
 }
 
-impl<'a, Sized? Q: 'a + ToOwned<K>, K: 'a, V: 'a> VacantEntry<'a, Q, K, V> {
+impl<'a, Q: ?Sized + 'a + ToOwned<K>, K: 'a, V: 'a> VacantEntry<'a, Q, K, V> {
     #[stable]
     /// Sets the value of the entry with the VacantEntry's key,
     /// and returns a mutable reference to it
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index bfaf69942a6..91a5db2ba76 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -451,7 +451,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
     /// assert_eq!(set.contains(&4), false);
     /// ```
     #[stable]
-    pub fn contains<Sized? Q>(&self, value: &Q) -> bool
+    pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool
         where Q: BorrowFrom<T> + Hash<S> + Eq
     {
         self.map.contains_key(value)
@@ -561,7 +561,7 @@ impl<T: Eq + Hash<S>, S, H: Hasher<S>> HashSet<T, H> {
     /// assert_eq!(set.remove(&2), false);
     /// ```
     #[stable]
-    pub fn remove<Sized? Q>(&mut self, value: &Q) -> bool
+    pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool
         where Q: BorrowFrom<T> + Hash<S> + Eq
     {
         self.map.remove(value).is_some()
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index ab91beb4f9b..1eb4408eedc 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -138,7 +138,7 @@ impl SafeHash {
 /// We need to remove hashes of 0. That's reserved for empty buckets.
 /// This function wraps up `hash_keyed` to be the only way outside this
 /// module to generate a SafeHash.
-pub fn make_hash<Sized? T: Hash<S>, S, H: Hasher<S>>(hasher: &H, t: &T) -> SafeHash {
+pub fn make_hash<T: ?Sized + Hash<S>, S, H: Hasher<S>>(hasher: &H, t: &T) -> SafeHash {
     // We need to avoid 0u64 in order to prevent collisions with
     // EMPTY_HASH. We can maintain our precious uniform distribution
     // of initial indexes by unconditionally setting the MSB,
diff --git a/src/libstd/hash.rs b/src/libstd/hash.rs
index cdd0e9bf76f..ac2b01e995e 100644
--- a/src/libstd/hash.rs
+++ b/src/libstd/hash.rs
@@ -90,7 +90,7 @@ impl RandomSipHasher {
 
 impl Hasher<sip::SipState> for RandomSipHasher {
     #[inline]
-    fn hash<Sized? T: Hash<sip::SipState>>(&self, value: &T) -> u64 {
+    fn hash<T: ?Sized + Hash<sip::SipState>>(&self, value: &T) -> u64 {
         self.hasher.hash(value)
     }
 }
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 3fa0b5645c5..66416a21dd9 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -1012,12 +1012,12 @@ pub trait Writer {
     fn write_fmt(&mut self, fmt: fmt::Arguments) -> IoResult<()> {
         // Create a shim which translates a Writer to a fmt::Writer and saves
         // off I/O errors. instead of discarding them
-        struct Adaptor<'a, Sized? T:'a> {
+        struct Adaptor<'a, T: ?Sized +'a> {
             inner: &'a mut T,
             error: IoResult<()>,
         }
 
-        impl<'a, Sized? T: Writer> fmt::Writer for Adaptor<'a, T> {
+        impl<'a, T: ?Sized + Writer> fmt::Writer for Adaptor<'a, T> {
             fn write_str(&mut self, s: &str) -> fmt::Result {
                 match self.inner.write(s.as_bytes()) {
                     Ok(()) => Ok(()),
@@ -1597,11 +1597,11 @@ pub trait Acceptor<T> {
 /// `Some`. The `Some` contains the `IoResult` representing whether the
 /// connection attempt was successful.  A successful connection will be wrapped
 /// in `Ok`. A failed connection is represented as an `Err`.
-pub struct IncomingConnections<'a, Sized? A:'a> {
+pub struct IncomingConnections<'a, A: ?Sized +'a> {
     inc: &'a mut A,
 }
 
-impl<'a, T, Sized? A: Acceptor<T>> Iterator for IncomingConnections<'a, A> {
+impl<'a, T, A: ?Sized + Acceptor<T>> Iterator for IncomingConnections<'a, A> {
     type Item = IoResult<T>;
 
     fn next(&mut self) -> Option<IoResult<T>> {
diff --git a/src/libstd/path/mod.rs b/src/libstd/path/mod.rs
index a2d69a7e7dc..b020164158c 100644
--- a/src/libstd/path/mod.rs
+++ b/src/libstd/path/mod.rs
@@ -896,7 +896,7 @@ impl BytesContainer for CString {
     }
 }
 
-impl<'a, Sized? T: BytesContainer> BytesContainer for &'a T {
+impl<'a, T: ?Sized + BytesContainer> BytesContainer for &'a T {
     #[inline]
     fn container_as_bytes(&self) -> &[u8] {
         (**self).container_as_bytes()
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs
index 013212b2705..1df02101ed0 100644
--- a/src/libstd/path/posix.rs
+++ b/src/libstd/path/posix.rs
@@ -321,7 +321,7 @@ impl Path {
 
     /// Returns a normalized byte vector representation of a path, by removing all empty
     /// components, and unnecessary . and .. components.
-    fn normalize<Sized? V: AsSlice<u8>>(v: &V) -> Vec<u8> {
+    fn normalize<V: ?Sized + AsSlice<u8>>(v: &V) -> Vec<u8> {
         // borrowck is being very picky
         let val = {
             let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE;