Skip to content

Commit afbce05

Browse files
committed
rollup merge of #20556: japaric/no-for-sized
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/libcore/borrow.rs src/libcore/cmp.rs src/libcore/ops.rs src/libstd/c_str.rs src/test/compile-fail/issue-19009.rs
2 parents cf8a11e + cd4205a commit afbce05

Some content is hidden

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

43 files changed

+101
-77
lines changed

src/libcollections/slice.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ pub type MutItems<'a, T:'a> = IterMut<'a, T>;
122122
////////////////////////////////////////////////////////////////////////////////
123123

124124
/// Allocating extension methods for slices.
125+
#[stable]
125126
pub trait SliceExt for Sized? {
126127
#[stable]
127128
type Item;
@@ -1007,7 +1008,7 @@ impl<T: Ord> OrdSliceExt<T> for [T] {
10071008

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

src/libcollections/str.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ use core::char::CharExt;
6060
use core::clone::Clone;
6161
use core::iter::AdditiveIterator;
6262
use core::iter::{range, Iterator, IteratorExt};
63-
use core::kinds::Sized;
6463
use core::ops;
6564
use core::option::Option::{self, Some, None};
6665
use core::slice::AsSlice;
@@ -409,7 +408,7 @@ Section: Trait implementations
409408

410409
/// Any string that can be represented as a slice.
411410
#[stable]
412-
pub trait StrExt for Sized?: ops::Slice<uint, str> {
411+
pub trait StrExt: ops::Slice<uint, str> {
413412
/// Escapes each char in `s` with `char::escape_default`.
414413
#[unstable = "return type may change to be an iterator"]
415414
fn escape_default(&self) -> String {

src/libcore/borrow.rs

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

5555
/// A trait for borrowing data.
5656
#[old_orphan_check]
57-
pub trait BorrowFrom<Sized? Owned> for Sized? {
57+
pub trait BorrowFrom<Sized? Owned> {
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> for Sized? : BorrowFrom<Owned> {
64+
pub trait BorrowFromMut<Sized? Owned> : BorrowFrom<Owned> {
6565
/// Mutably borrow from an owned value.
6666
fn borrow_from_mut(owned: &mut Owned) -> &mut Self;
6767
}
@@ -107,7 +107,7 @@ impl<'a, T, Sized? B> IntoCow<'a, T, B> for Cow<'a, T, B> where B: ToOwned<T> {
107107

108108
/// A generalization of Clone to borrowed data.
109109
#[old_orphan_check]
110-
pub trait ToOwned<Owned> for Sized?: BorrowFrom<Owned> {
110+
pub trait ToOwned<Owned>: BorrowFrom<Owned> {
111111
/// Create owned data from borrowed data, usually by copying.
112112
fn to_owned(&self) -> Owned;
113113
}

src/libcore/cmp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ use option::Option::{self, Some, None};
7070
#[lang="eq"]
7171
#[stable]
7272
#[old_orphan_check]
73-
pub trait PartialEq<Sized? Rhs = Self> for Sized? {
73+
pub trait PartialEq<Sized? Rhs = Self> {
7474
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
7575
#[stable]
7676
fn eq(&self, other: &Rhs) -> bool;
@@ -91,7 +91,7 @@ pub trait PartialEq<Sized? Rhs = Self> for Sized? {
9191
/// - symmetric: `a == b` implies `b == a`; and
9292
/// - transitive: `a == b` and `b == c` implies `a == c`.
9393
#[stable]
94-
pub trait Eq for Sized?: PartialEq<Self> {
94+
pub trait Eq: PartialEq<Self> {
9595
// FIXME #13101: this method is used solely by #[deriving] to
9696
// assert that every component of a type implements #[deriving]
9797
// itself, the current deriving infrastructure means doing this
@@ -165,7 +165,7 @@ impl Ordering {
165165
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
166166
/// both `==` and `>`.
167167
#[stable]
168-
pub trait Ord for Sized?: Eq + PartialOrd<Self> {
168+
pub trait Ord: Eq + PartialOrd<Self> {
169169
/// This method returns an ordering between `self` and `other` values.
170170
///
171171
/// By convention, `self.cmp(&other)` returns the ordering matching
@@ -225,7 +225,7 @@ impl PartialOrd for Ordering {
225225
/// 5.11).
226226
#[lang="ord"]
227227
#[stable]
228-
pub trait PartialOrd<Sized? Rhs = Self> for Sized?: PartialEq<Rhs> {
228+
pub trait PartialOrd<Sized? Rhs = Self>: PartialEq<Rhs> {
229229
/// This method returns an ordering between `self` and `other` values
230230
/// if one exists.
231231
#[stable]

src/libcore/fmt/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,57 +222,57 @@ impl<'a> Show for Arguments<'a> {
222222
/// to this trait. There is not an explicit way of selecting this trait to be
223223
/// used for formatting, it is only if no other format is specified.
224224
#[unstable = "I/O and core have yet to be reconciled"]
225-
pub trait Show for Sized? {
225+
pub trait Show {
226226
/// Formats the value using the given formatter.
227227
fn fmt(&self, &mut Formatter) -> Result;
228228
}
229229

230230

231231
/// Format trait for the `o` character
232232
#[unstable = "I/O and core have yet to be reconciled"]
233-
pub trait Octal for Sized? {
233+
pub trait Octal {
234234
/// Formats the value using the given formatter.
235235
fn fmt(&self, &mut Formatter) -> Result;
236236
}
237237

238238
/// Format trait for the `b` character
239239
#[unstable = "I/O and core have yet to be reconciled"]
240-
pub trait Binary for Sized? {
240+
pub trait Binary {
241241
/// Formats the value using the given formatter.
242242
fn fmt(&self, &mut Formatter) -> Result;
243243
}
244244

245245
/// Format trait for the `x` character
246246
#[unstable = "I/O and core have yet to be reconciled"]
247-
pub trait LowerHex for Sized? {
247+
pub trait LowerHex {
248248
/// Formats the value using the given formatter.
249249
fn fmt(&self, &mut Formatter) -> Result;
250250
}
251251

252252
/// Format trait for the `X` character
253253
#[unstable = "I/O and core have yet to be reconciled"]
254-
pub trait UpperHex for Sized? {
254+
pub trait UpperHex {
255255
/// Formats the value using the given formatter.
256256
fn fmt(&self, &mut Formatter) -> Result;
257257
}
258258

259259
/// Format trait for the `p` character
260260
#[unstable = "I/O and core have yet to be reconciled"]
261-
pub trait Pointer for Sized? {
261+
pub trait Pointer {
262262
/// Formats the value using the given formatter.
263263
fn fmt(&self, &mut Formatter) -> Result;
264264
}
265265

266266
/// Format trait for the `e` character
267267
#[unstable = "I/O and core have yet to be reconciled"]
268-
pub trait LowerExp for Sized? {
268+
pub trait LowerExp {
269269
/// Formats the value using the given formatter.
270270
fn fmt(&self, &mut Formatter) -> Result;
271271
}
272272

273273
/// Format trait for the `E` character
274274
#[unstable = "I/O and core have yet to be reconciled"]
275-
pub trait UpperExp for Sized? {
275+
pub trait UpperExp {
276276
/// Formats the value using the given formatter.
277277
fn fmt(&self, &mut Formatter) -> Result;
278278
}

src/libcore/hash/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub mod sip;
7676
/// A hashable type. The `S` type parameter is an abstract hash state that is
7777
/// used by the `Hash` to compute the hash. It defaults to
7878
/// `std::hash::sip::SipState`.
79-
pub trait Hash<S = sip::SipState> for Sized? {
79+
pub trait Hash<S = sip::SipState> {
8080
/// Computes the hash of a value.
8181
fn hash(&self, state: &mut S);
8282
}

src/libcore/kinds.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@
1919
2020
/// Types able to be transferred across task boundaries.
2121
#[lang="send"]
22-
pub unsafe trait Send for Sized? : 'static {
22+
pub unsafe trait Send : 'static {
2323
// empty.
2424
}
2525

2626
/// Types with a constant size known at compile-time.
2727
#[lang="sized"]
28-
pub trait Sized for Sized? {
28+
pub trait Sized {
2929
// Empty.
3030
}
3131

3232
/// Types that can be copied by simply copying bits (i.e. `memcpy`).
3333
#[lang="copy"]
34-
pub trait Copy for Sized? {
34+
pub trait Copy {
3535
// Empty.
3636
}
3737

@@ -81,7 +81,7 @@ pub trait Copy for Sized? {
8181
/// reference; not doing this is undefined behaviour (for example,
8282
/// `transmute`-ing from `&T` to `&mut T` is illegal).
8383
#[lang="sync"]
84-
pub unsafe trait Sync for Sized? {
84+
pub unsafe trait Sync {
8585
// Empty
8686
}
8787

src/libcore/ops.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ shr_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
802802
/// }
803803
/// ```
804804
#[lang="index"]
805-
pub trait Index<Sized? Index> for Sized? {
805+
pub trait Index<Sized? Index> {
806806
type Sized? Output;
807807

808808
/// The method for the indexing (`Foo[Bar]`) operation
@@ -839,7 +839,7 @@ pub trait Index<Sized? Index> for Sized? {
839839
/// }
840840
/// ```
841841
#[lang="index_mut"]
842-
pub trait IndexMut<Sized? Index> for Sized? {
842+
pub trait IndexMut<Sized? Index> {
843843
type Sized? Output;
844844

845845
/// The method for the indexing (`Foo[Bar]`) operation
@@ -884,7 +884,7 @@ pub trait IndexMut<Sized? Index> for Sized? {
884884
/// }
885885
/// ```
886886
#[lang="slice"]
887-
pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
887+
pub trait Slice<Sized? Idx, Sized? Result> {
888888
/// The method for the slicing operation foo[]
889889
fn as_slice_<'a>(&'a self) -> &'a Result;
890890
/// The method for the slicing operation foo[from..]
@@ -933,7 +933,7 @@ pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
933933
/// }
934934
/// ```
935935
#[lang="slice_mut"]
936-
pub trait SliceMut<Sized? Idx, Sized? Result> for Sized? {
936+
pub trait SliceMut<Sized? Idx, Sized? Result> {
937937
/// The method for the slicing operation foo[]
938938
fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Result;
939939
/// The method for the slicing operation foo[from..]
@@ -1069,7 +1069,7 @@ pub struct RangeTo<Idx> {
10691069
/// ```
10701070
#[lang="deref"]
10711071
#[stable]
1072-
pub trait Deref for Sized? {
1072+
pub trait Deref {
10731073
#[stable]
10741074
type Sized? Target;
10751075

@@ -1131,7 +1131,7 @@ impl<'a, Sized? T> Deref for &'a mut T {
11311131
/// ```
11321132
#[lang="deref_mut"]
11331133
#[stable]
1134-
pub trait DerefMut for Sized? : Deref {
1134+
pub trait DerefMut: Deref {
11351135
/// The method called to mutably dereference a value
11361136
#[stable]
11371137
fn deref_mut<'a>(&'a mut self) -> &'a mut <Self as Deref>::Target;
@@ -1145,15 +1145,15 @@ impl<'a, Sized? T> DerefMut for &'a mut T {
11451145
/// A version of the call operator that takes an immutable receiver.
11461146
#[lang="fn"]
11471147
#[unstable = "uncertain about variadic generics, input versus associated types"]
1148-
pub trait Fn<Args,Result> for Sized? {
1148+
pub trait Fn<Args,Result> {
11491149
/// This is called when the call operator is used.
11501150
extern "rust-call" fn call(&self, args: Args) -> Result;
11511151
}
11521152

11531153
/// A version of the call operator that takes a mutable receiver.
11541154
#[lang="fn_mut"]
11551155
#[unstable = "uncertain about variadic generics, input versus associated types"]
1156-
pub trait FnMut<Args,Result> for Sized? {
1156+
pub trait FnMut<Args,Result> {
11571157
/// This is called when the call operator is used.
11581158
extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
11591159
}

src/libcore/raw.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
2121
use kinds::Copy;
2222
use mem;
23-
use kinds::Sized;
2423

2524
/// The representation of a Rust slice
2625
#[repr(C)]
@@ -52,7 +51,7 @@ pub struct TraitObject {
5251

5352
/// This trait is meant to map equivalences between raw structs and their
5453
/// corresponding rust values.
55-
pub trait Repr<T> for Sized? {
54+
pub trait Repr<T> {
5655
/// This function "unwraps" a rust value (without consuming it) into its raw
5756
/// struct representation. This can be used to read/write different values
5857
/// for the struct. This is a safe method because by default it does not

src/libcore/slice.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use raw::Slice as RawSlice;
6464

6565
/// Extension methods for slices.
6666
#[allow(missing_docs)] // docs in libcollections
67-
pub trait SliceExt for Sized? {
67+
pub trait SliceExt {
6868
type Item;
6969

7070
fn slice<'a>(&'a self, start: uint, end: uint) -> &'a [Self::Item];
@@ -614,7 +614,7 @@ impl<T> ops::SliceMut<uint, [T]> for [T] {
614614

615615
/// Data that is viewable as a slice.
616616
#[experimental = "will be replaced by slice syntax"]
617-
pub trait AsSlice<T> for Sized? {
617+
pub trait AsSlice<T> {
618618
/// Work with `self` as a slice.
619619
fn as_slice<'a>(&'a self) -> &'a [T];
620620
}
@@ -1355,12 +1355,11 @@ pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] {
13551355
/// Operations on `[u8]`.
13561356
#[experimental = "needs review"]
13571357
pub mod bytes {
1358-
use kinds::Sized;
13591358
use ptr;
13601359
use slice::SliceExt;
13611360

13621361
/// A trait for operations on mutable `[u8]`s.
1363-
pub trait MutableByteVector for Sized? {
1362+
pub trait MutableByteVector {
13641363
/// Sets all bytes of the receiver to the given value.
13651364
fn set_memory(&mut self, value: u8);
13661365
}
@@ -1444,7 +1443,7 @@ impl<T: PartialOrd> PartialOrd for [T] {
14441443

14451444
/// Extension methods for slices containing integers.
14461445
#[experimental]
1447-
pub trait IntSliceExt<U, S> for Sized? {
1446+
pub trait IntSliceExt<U, S> {
14481447
/// Converts the slice to an immutable slice of unsigned integers with the same width.
14491448
fn as_unsigned<'a>(&'a self) -> &'a [U];
14501449
/// Converts the slice to an immutable slice of signed integers with the same width.

src/libcore/str/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ mod traits {
11451145
#[unstable = "Instead of taking this bound generically, this trait will be \
11461146
replaced with one of slicing syntax, deref coercions, or \
11471147
a more generic conversion trait"]
1148-
pub trait Str for Sized? {
1148+
pub trait Str {
11491149
/// Work with `self` as a slice.
11501150
fn as_slice<'a>(&'a self) -> &'a str;
11511151
}
@@ -1186,7 +1186,7 @@ delegate_iter!{pattern forward &'a str in RSplitN<'a, P>}
11861186

11871187
/// Methods for string slices
11881188
#[allow(missing_docs)]
1189-
pub trait StrExt for Sized? {
1189+
pub trait StrExt {
11901190
// NB there are no docs here are they're all located on the StrExt trait in
11911191
// libcollections, not here.
11921192

src/librustc/middle/traits/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ impl<'cx, 'tcx> Elaborator<'cx, 'tcx> {
9292
// Only keep those bounds that we haven't already
9393
// seen. This is necessary to prevent infinite
9494
// recursion in some cases. One common case is when
95-
// people define `trait Sized { }` rather than `trait
96-
// Sized for Sized? { }`.
95+
// people define `trait Sized: Sized { }` rather than `trait
96+
// Sized { }`.
9797
predicates.retain(|r| self.visited.insert(r.clone()));
9898

9999
self.stack.push(StackEntry { position: 0,

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use syntax::{ast, ast_util};
3838
use syntax::owned_slice::OwnedSlice;
3939

4040
/// Produces a string suitable for debugging output.
41-
pub trait Repr<'tcx> for Sized? {
41+
pub trait Repr<'tcx> {
4242
fn repr(&self, tcx: &ctxt<'tcx>) -> String;
4343
}
4444

src/librustc_trans/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl RegClass {
6363
}
6464
}
6565

66-
trait ClassList for Sized? {
66+
trait ClassList {
6767
fn is_pass_byval(&self) -> bool;
6868
fn is_ret_bysret(&self) -> bool;
6969
}

src/librustc_trans/trans/llrepr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use trans::context::CrateContext;
1212
use trans::type_::Type;
1313
use llvm::ValueRef;
1414

15-
pub trait LlvmRepr for Sized? {
15+
pub trait LlvmRepr {
1616
fn llrepr(&self, ccx: &CrateContext) -> String;
1717
}
1818

0 commit comments

Comments
 (0)