Skip to content

Commit 384e218

Browse files
committed
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
2 parents afbce05 + 8f3a424 commit 384e218

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+251
-245
lines changed

src/liballoc/boxed.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ impl<T: Clone> Clone for Box<T> {
7575
}
7676

7777
#[stable]
78-
impl<Sized? T: PartialEq> PartialEq for Box<T> {
78+
impl<T: ?Sized + PartialEq> PartialEq for Box<T> {
7979
#[inline]
8080
fn eq(&self, other: &Box<T>) -> bool { PartialEq::eq(&**self, &**other) }
8181
#[inline]
8282
fn ne(&self, other: &Box<T>) -> bool { PartialEq::ne(&**self, &**other) }
8383
}
8484
#[stable]
85-
impl<Sized? T: PartialOrd> PartialOrd for Box<T> {
85+
impl<T: ?Sized + PartialOrd> PartialOrd for Box<T> {
8686
#[inline]
8787
fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> {
8888
PartialOrd::partial_cmp(&**self, &**other)
@@ -97,16 +97,16 @@ impl<Sized? T: PartialOrd> PartialOrd for Box<T> {
9797
fn gt(&self, other: &Box<T>) -> bool { PartialOrd::gt(&**self, &**other) }
9898
}
9999
#[stable]
100-
impl<Sized? T: Ord> Ord for Box<T> {
100+
impl<T: ?Sized + Ord> Ord for Box<T> {
101101
#[inline]
102102
fn cmp(&self, other: &Box<T>) -> Ordering {
103103
Ord::cmp(&**self, &**other)
104104
}
105105

106106
#[stable]}
107-
impl<Sized? T: Eq> Eq for Box<T> {}
107+
impl<T: ?Sized + Eq> Eq for Box<T> {}
108108

109-
impl<S: hash::Writer, Sized? T: Hash<S>> Hash<S> for Box<T> {
109+
impl<S: hash::Writer, T: ?Sized + Hash<S>> Hash<S> for Box<T> {
110110
#[inline]
111111
fn hash(&self, state: &mut S) {
112112
(**self).hash(state);
@@ -143,7 +143,7 @@ impl BoxAny for Box<Any> {
143143
}
144144
}
145145

146-
impl<Sized? T: fmt::Show> fmt::Show for Box<T> {
146+
impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> {
147147
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
148148
(**self).fmt(f)
149149
}
@@ -156,14 +156,14 @@ impl fmt::Show for Box<Any> {
156156
}
157157

158158
#[stable]
159-
impl<Sized? T> Deref for Box<T> {
159+
impl<T: ?Sized> Deref for Box<T> {
160160
type Target = T;
161161

162162
fn deref(&self) -> &T { &**self }
163163
}
164164

165165
#[stable]
166-
impl<Sized? T> DerefMut for Box<T> {
166+
impl<T: ?Sized> DerefMut for Box<T> {
167167
fn deref_mut(&mut self) -> &mut T { &mut **self }
168168
}
169169

src/libcollections/btree/map.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
130130

131131
#[stable]
132132
/// A view into a single entry in a map, which may either be vacant or occupied.
133-
pub enum Entry<'a, Sized? Q:'a, K:'a, V:'a> {
133+
pub enum Entry<'a, Q: ?Sized +'a, K:'a, V:'a> {
134134
/// A vacant Entry
135135
Vacant(VacantEntry<'a, Q, K, V>),
136136
/// An occupied Entry
@@ -139,7 +139,7 @@ pub enum Entry<'a, Sized? Q:'a, K:'a, V:'a> {
139139

140140
#[stable]
141141
/// A vacant Entry.
142-
pub struct VacantEntry<'a, Sized? Q:'a, K:'a, V:'a> {
142+
pub struct VacantEntry<'a, Q: ?Sized +'a, K:'a, V:'a> {
143143
key: &'a Q,
144144
stack: stack::SearchStack<'a, K, V, node::handle::Edge, node::handle::Leaf>,
145145
}
@@ -214,7 +214,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
214214
/// assert_eq!(map.get(&2), None);
215215
/// ```
216216
#[stable]
217-
pub fn get<Sized? Q>(&self, key: &Q) -> Option<&V> where Q: BorrowFrom<K> + Ord {
217+
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where Q: BorrowFrom<K> + Ord {
218218
let mut cur_node = &self.root;
219219
loop {
220220
match Node::search(cur_node, key) {
@@ -246,7 +246,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
246246
/// assert_eq!(map.contains_key(&2), false);
247247
/// ```
248248
#[stable]
249-
pub fn contains_key<Sized? Q>(&self, key: &Q) -> bool where Q: BorrowFrom<K> + Ord {
249+
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where Q: BorrowFrom<K> + Ord {
250250
self.get(key).is_some()
251251
}
252252

@@ -270,7 +270,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
270270
/// ```
271271
// See `get` for implementation notes, this is basically a copy-paste with mut's added
272272
#[stable]
273-
pub fn get_mut<Sized? Q>(&mut self, key: &Q) -> Option<&mut V> where Q: BorrowFrom<K> + Ord {
273+
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where Q: BorrowFrom<K> + Ord {
274274
// temp_node is a Borrowck hack for having a mutable value outlive a loop iteration
275275
let mut temp_node = &mut self.root;
276276
loop {
@@ -440,7 +440,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
440440
/// assert_eq!(map.remove(&1), None);
441441
/// ```
442442
#[stable]
443-
pub fn remove<Sized? Q>(&mut self, key: &Q) -> Option<V> where Q: BorrowFrom<K> + Ord {
443+
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where Q: BorrowFrom<K> + Ord {
444444
// See `swap` for a more thorough description of the stuff going on in here
445445
let mut stack = stack::PartialSearchStack::new(self);
446446
loop {
@@ -878,7 +878,7 @@ impl<K: Show, V: Show> Show for BTreeMap<K, V> {
878878
}
879879

880880
#[stable]
881-
impl<K: Ord, Sized? Q, V> Index<Q> for BTreeMap<K, V>
881+
impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
882882
where Q: BorrowFrom<K> + Ord
883883
{
884884
type Output = V;
@@ -889,7 +889,7 @@ impl<K: Ord, Sized? Q, V> Index<Q> for BTreeMap<K, V>
889889
}
890890

891891
#[stable]
892-
impl<K: Ord, Sized? Q, V> IndexMut<Q> for BTreeMap<K, V>
892+
impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V>
893893
where Q: BorrowFrom<K> + Ord
894894
{
895895
type Output = V;
@@ -1111,7 +1111,7 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
11111111
#[stable]
11121112
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {}
11131113

1114-
impl<'a, Sized? Q, K: Ord, V> Entry<'a, Q, K, V> {
1114+
impl<'a, Q: ?Sized, K: Ord, V> Entry<'a, Q, K, V> {
11151115
#[unstable = "matches collection reform v2 specification, waiting for dust to settle"]
11161116
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
11171117
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, Q, K, V>> {
@@ -1122,7 +1122,7 @@ impl<'a, Sized? Q, K: Ord, V> Entry<'a, Q, K, V> {
11221122
}
11231123
}
11241124

1125-
impl<'a, Sized? Q: ToOwned<K>, K: Ord, V> VacantEntry<'a, Q, K, V> {
1125+
impl<'a, Q: ?Sized + ToOwned<K>, K: Ord, V> VacantEntry<'a, Q, K, V> {
11261126
#[stable]
11271127
/// Sets the value of the entry with the VacantEntry's key,
11281128
/// and returns a mutable reference to it.
@@ -1362,7 +1362,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
13621362
/// ```
13631363
/// The key must have the same ordering before or after `.to_owned()` is called.
13641364
#[stable]
1365-
pub fn entry<'a, Sized? Q>(&'a mut self, mut key: &'a Q) -> Entry<'a, Q, K, V>
1365+
pub fn entry<'a, Q: ?Sized>(&'a mut self, mut key: &'a Q) -> Entry<'a, Q, K, V>
13661366
where Q: Ord + ToOwned<K>
13671367
{
13681368
// same basic logic of `swap` and `pop`, blended together

src/libcollections/btree/node.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl<K: Ord, V> Node<K, V> {
517517
/// Searches for the given key in the node. If it finds an exact match,
518518
/// `Found` will be yielded with the matching index. If it doesn't find an exact match,
519519
/// `GoDown` will be yielded with the index of the subtree the key must lie in.
520-
pub fn search<Sized? Q, NodeRef: Deref<Target=Node<K, V>>>(node: NodeRef, key: &Q)
520+
pub fn search<Q: ?Sized, NodeRef: Deref<Target=Node<K, V>>>(node: NodeRef, key: &Q)
521521
-> SearchResult<NodeRef> where Q: BorrowFrom<K> + Ord {
522522
// FIXME(Gankro): Tune when to search linear or binary based on B (and maybe K/V).
523523
// For the B configured as of this writing (B = 6), binary search was *significantly*
@@ -536,7 +536,7 @@ impl<K: Ord, V> Node<K, V> {
536536
}
537537
}
538538

539-
fn search_linear<Sized? Q>(&self, key: &Q) -> (bool, uint) where Q: BorrowFrom<K> + Ord {
539+
fn search_linear<Q: ?Sized>(&self, key: &Q) -> (bool, uint) where Q: BorrowFrom<K> + Ord {
540540
for (i, k) in self.keys().iter().enumerate() {
541541
match key.cmp(BorrowFrom::borrow_from(k)) {
542542
Greater => {},

src/libcollections/btree/set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl<T: Ord> BTreeSet<T> {
299299
/// assert_eq!(set.contains(&4), false);
300300
/// ```
301301
#[stable]
302-
pub fn contains<Sized? Q>(&self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord {
302+
pub fn contains<Q: ?Sized>(&self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord {
303303
self.map.contains_key(value)
304304
}
305305

@@ -429,7 +429,7 @@ impl<T: Ord> BTreeSet<T> {
429429
/// assert_eq!(set.remove(&2), false);
430430
/// ```
431431
#[stable]
432-
pub fn remove<Sized? Q>(&mut self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord {
432+
pub fn remove<Q: ?Sized>(&mut self, value: &Q) -> bool where Q: BorrowFrom<T> + Ord {
433433
self.map.remove(value).is_some()
434434
}
435435
}

src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ impl<T: Ord> OrdSliceExt<T> for [T] {
10081008

10091009
#[unstable = "U should be an associated type"]
10101010
/// An extension trait for concatenating slices
1011-
pub trait SliceConcatExt<Sized? T, U> {
1011+
pub trait SliceConcatExt<T: ?Sized, U> {
10121012
/// Flattens a slice of `T` into a single value `U`.
10131013
#[stable]
10141014
fn concat(&self) -> U;

src/libcore/borrow.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,52 +54,52 @@ use self::Cow::*;
5454

5555
/// A trait for borrowing data.
5656
#[old_orphan_check]
57-
pub trait BorrowFrom<Sized? Owned> {
57+
pub trait BorrowFrom<Owned: ?Sized> {
5858
/// Immutably borrow from an owned value.
5959
fn borrow_from(owned: &Owned) -> &Self;
6060
}
6161

6262
/// A trait for mutably borrowing data.
6363
#[old_orphan_check]
64-
pub trait BorrowFromMut<Sized? Owned> : BorrowFrom<Owned> {
64+
pub trait BorrowFromMut<Owned: ?Sized> : BorrowFrom<Owned> {
6565
/// Mutably borrow from an owned value.
6666
fn borrow_from_mut(owned: &mut Owned) -> &mut Self;
6767
}
6868

69-
impl<Sized? T> BorrowFrom<T> for T {
69+
impl<T: ?Sized> BorrowFrom<T> for T {
7070
fn borrow_from(owned: &T) -> &T { owned }
7171
}
7272

73-
impl<Sized? T> BorrowFromMut<T> for T {
73+
impl<T: ?Sized> BorrowFromMut<T> for T {
7474
fn borrow_from_mut(owned: &mut T) -> &mut T { owned }
7575
}
7676

77-
impl<'a, Sized? T> BorrowFrom<&'a T> for T {
77+
impl<'a, T: ?Sized> BorrowFrom<&'a T> for T {
7878
fn borrow_from<'b>(owned: &'b &'a T) -> &'b T { &**owned }
7979
}
8080

81-
impl<'a, Sized? T> BorrowFrom<&'a mut T> for T {
81+
impl<'a, T: ?Sized> BorrowFrom<&'a mut T> for T {
8282
fn borrow_from<'b>(owned: &'b &'a mut T) -> &'b T { &**owned }
8383
}
8484

85-
impl<'a, Sized? T> BorrowFromMut<&'a mut T> for T {
85+
impl<'a, T: ?Sized> BorrowFromMut<&'a mut T> for T {
8686
fn borrow_from_mut<'b>(owned: &'b mut &'a mut T) -> &'b mut T { &mut **owned }
8787
}
8888

89-
impl<'a, T, Sized? B> BorrowFrom<Cow<'a, T, B>> for B where B: ToOwned<T> {
89+
impl<'a, T, B: ?Sized> BorrowFrom<Cow<'a, T, B>> for B where B: ToOwned<T> {
9090
fn borrow_from<'b>(owned: &'b Cow<'a, T, B>) -> &'b B {
9191
&**owned
9292
}
9393
}
9494

9595
/// Trait for moving into a `Cow`
9696
#[old_orphan_check]
97-
pub trait IntoCow<'a, T, Sized? B> {
97+
pub trait IntoCow<'a, T, B: ?Sized> {
9898
/// Moves `self` into `Cow`
9999
fn into_cow(self) -> Cow<'a, T, B>;
100100
}
101101

102-
impl<'a, T, Sized? B> IntoCow<'a, T, B> for Cow<'a, T, B> where B: ToOwned<T> {
102+
impl<'a, T, B: ?Sized> IntoCow<'a, T, B> for Cow<'a, T, B> where B: ToOwned<T> {
103103
fn into_cow(self) -> Cow<'a, T, B> {
104104
self
105105
}
@@ -133,7 +133,7 @@ impl<T> ToOwned<T> for T where T: Clone {
133133
/// }
134134
/// }
135135
/// ```
136-
pub enum Cow<'a, T, Sized? B: 'a> where B: ToOwned<T> {
136+
pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
137137
/// Borrowed data.
138138
Borrowed(&'a B),
139139

@@ -142,7 +142,7 @@ pub enum Cow<'a, T, Sized? B: 'a> where B: ToOwned<T> {
142142
}
143143

144144
#[stable]
145-
impl<'a, T, Sized? B> Clone for Cow<'a, T, B> where B: ToOwned<T> {
145+
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
146146
fn clone(&self) -> Cow<'a, T, B> {
147147
match *self {
148148
Borrowed(b) => Borrowed(b),
@@ -154,7 +154,7 @@ impl<'a, T, Sized? B> Clone for Cow<'a, T, B> where B: ToOwned<T> {
154154
}
155155
}
156156

157-
impl<'a, T, Sized? B> Cow<'a, T, B> where B: ToOwned<T> {
157+
impl<'a, T, B: ?Sized> Cow<'a, T, B> where B: ToOwned<T> {
158158
/// Acquire a mutable reference to the owned form of the data.
159159
///
160160
/// Copies the data if it is not already owned.
@@ -196,7 +196,7 @@ impl<'a, T, Sized? B> Cow<'a, T, B> where B: ToOwned<T> {
196196
}
197197

198198
#[stable]
199-
impl<'a, T, Sized? B> Deref for Cow<'a, T, B> where B: ToOwned<T> {
199+
impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> {
200200
type Target = B;
201201

202202
fn deref(&self) -> &B {
@@ -208,18 +208,18 @@ impl<'a, T, Sized? B> Deref for Cow<'a, T, B> where B: ToOwned<T> {
208208
}
209209

210210
#[stable]
211-
impl<'a, T, Sized? B> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {}
211+
impl<'a, T, B: ?Sized> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {}
212212

213213
#[stable]
214-
impl<'a, T, Sized? B> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
214+
impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
215215
#[inline]
216216
fn cmp(&self, other: &Cow<'a, T, B>) -> Ordering {
217217
Ord::cmp(&**self, &**other)
218218
}
219219
}
220220

221221
#[stable]
222-
impl<'a, 'b, T, U, Sized? B, Sized? C> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where
222+
impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where
223223
B: PartialEq<C> + ToOwned<T>,
224224
C: ToOwned<U>,
225225
{
@@ -230,14 +230,14 @@ impl<'a, 'b, T, U, Sized? B, Sized? C> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B
230230
}
231231

232232
#[stable]
233-
impl<'a, T, Sized? B> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> {
233+
impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> {
234234
#[inline]
235235
fn partial_cmp(&self, other: &Cow<'a, T, B>) -> Option<Ordering> {
236236
PartialOrd::partial_cmp(&**self, &**other)
237237
}
238238
}
239239

240-
impl<'a, T, Sized? B> fmt::Show for Cow<'a, T, B> where B: fmt::Show + ToOwned<T>, T: fmt::Show {
240+
impl<'a, T, B: ?Sized> fmt::Show for Cow<'a, T, B> where B: fmt::Show + ToOwned<T>, T: fmt::Show {
241241
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
242242
match *self {
243243
Borrowed(ref b) => fmt::Show::fmt(b, f),

src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub trait Clone : Sized {
4343
}
4444

4545
#[stable]
46-
impl<'a, Sized? T> Clone for &'a T {
46+
impl<'a, T: ?Sized> Clone for &'a T {
4747
/// Return a shallow copy of the reference.
4848
#[inline]
4949
fn clone(&self) -> &'a T { *self }

0 commit comments

Comments
 (0)