Skip to content

Obsolete the for Sized? syntax #20556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub use core::slice::{from_raw_buf, from_raw_mut_buf};

/// Allocating extension methods for slices.
#[unstable = "needs associated types, may merge with other traits"]
pub trait SliceExt for Sized? {
pub trait SliceExt {
type Item;

/// Sorts the slice, in place, using `compare` to compare
Expand Down Expand Up @@ -989,7 +989,7 @@ impl<T> SliceExt for [T] {
////////////////////////////////////////////////////////////////////////////////
#[unstable = "U should be an associated type"]
/// An extension trait for concatenating slices
pub trait SliceConcatExt<Sized? T, U> for Sized? {
pub trait SliceConcatExt<Sized? T, U> {
/// Flattens a slice of `T` into a single value `U`.
#[stable]
fn concat(&self) -> U;
Expand Down
3 changes: 1 addition & 2 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ use core::char::CharExt;
use core::clone::Clone;
use core::iter::AdditiveIterator;
use core::iter::{range, Iterator, IteratorExt};
use core::kinds::Sized;
use core::ops;
use core::option::Option::{self, Some, None};
use core::slice::AsSlice;
Expand Down Expand Up @@ -401,7 +400,7 @@ Section: Trait implementations
*/

/// Any string that can be represented as a slice.
pub trait StrExt for Sized?: ops::Slice<uint, str> {
pub trait StrExt: ops::Slice<uint, str> {
/// Escapes each char in `s` with `char::escape_default`.
#[unstable = "return type may change to be an iterator"]
fn escape_default(&self) -> String {
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ use option::Option;
use self::Cow::*;

/// A trait for borrowing data.
pub trait BorrowFrom<Sized? Owned> for Sized? {
pub trait BorrowFrom<Sized? Owned> {
/// Immutably borrow from an owned value.
fn borrow_from(owned: &Owned) -> &Self;
}

/// A trait for mutably borrowing data.
pub trait BorrowFromMut<Sized? Owned> for Sized? : BorrowFrom<Owned> {
pub trait BorrowFromMut<Sized? Owned> : BorrowFrom<Owned> {
/// Mutably borrow from an owned value.
fn borrow_from_mut(owned: &mut Owned) -> &mut Self;
}
Expand Down Expand Up @@ -103,7 +103,7 @@ impl<'a, T, Sized? B> IntoCow<'a, T, B> for Cow<'a, T, B> where B: ToOwned<T> {
}

/// A generalization of Clone to borrowed data.
pub trait ToOwned<Owned> for Sized?: BorrowFrom<Owned> {
pub trait ToOwned<Owned>: BorrowFrom<Owned> {
/// Create owned data from borrowed data, usually by copying.
fn to_owned(&self) -> Owned;
}
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ use option::Option::{self, Some, None};
/// only if `a != b`.
#[lang="eq"]
#[stable]
pub trait PartialEq<Sized? Rhs = Self> for Sized? {
pub trait PartialEq<Sized? Rhs = Self> {
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
#[stable]
fn eq(&self, other: &Rhs) -> bool;
Expand All @@ -90,7 +90,7 @@ pub trait PartialEq<Sized? Rhs = Self> for Sized? {
/// - symmetric: `a == b` implies `b == a`; and
/// - transitive: `a == b` and `b == c` implies `a == c`.
#[stable]
pub trait Eq for Sized?: PartialEq<Self> {
pub trait Eq: PartialEq<Self> {
// FIXME #13101: this method is used solely by #[deriving] to
// assert that every component of a type implements #[deriving]
// itself, the current deriving infrastructure means doing this
Expand Down Expand Up @@ -164,7 +164,7 @@ impl Ordering {
/// - transitive, `a < b` and `b < c` implies `a < c`. The same must hold for
/// both `==` and `>`.
#[stable]
pub trait Ord for Sized?: Eq + PartialOrd<Self> {
pub trait Ord: Eq + PartialOrd<Self> {
/// This method returns an ordering between `self` and `other` values.
///
/// By convention, `self.cmp(&other)` returns the ordering matching
Expand Down Expand Up @@ -224,7 +224,7 @@ impl PartialOrd for Ordering {
/// 5.11).
#[lang="ord"]
#[stable]
pub trait PartialOrd<Sized? Rhs = Self> for Sized?: PartialEq<Rhs> {
pub trait PartialOrd<Sized? Rhs = Self>: PartialEq<Rhs> {
/// This method returns an ordering between `self` and `other` values
/// if one exists.
#[stable]
Expand Down
16 changes: 8 additions & 8 deletions src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,57 +222,57 @@ impl<'a> Show for Arguments<'a> {
/// to this trait. There is not an explicit way of selecting this trait to be
/// used for formatting, it is only if no other format is specified.
#[unstable = "I/O and core have yet to be reconciled"]
pub trait Show for Sized? {
pub trait Show {
/// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result;
}


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

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

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

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

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

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

/// Format trait for the `E` character
#[unstable = "I/O and core have yet to be reconciled"]
pub trait UpperExp for Sized? {
pub trait UpperExp {
/// Formats the value using the given formatter.
fn fmt(&self, &mut Formatter) -> Result;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub mod sip;
/// A hashable type. The `S` type parameter is an abstract hash state that is
/// used by the `Hash` to compute the hash. It defaults to
/// `std::hash::sip::SipState`.
pub trait Hash<S = sip::SipState> for Sized? {
pub trait Hash<S = sip::SipState> {
/// Computes the hash of a value.
fn hash(&self, state: &mut S);
}
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/kinds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@

/// Types able to be transferred across task boundaries.
#[lang="send"]
pub unsafe trait Send for Sized? : 'static {
pub unsafe trait Send : 'static {
// empty.
}

/// Types with a constant size known at compile-time.
#[lang="sized"]
pub trait Sized for Sized? {
pub trait Sized {
// Empty.
}

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

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

Expand Down
20 changes: 10 additions & 10 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ shr_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
#[cfg(stage0)]
#[allow(missing_docs)]
#[lang="index"]
pub trait Index<Sized? Index, Sized? Result> for Sized? {
pub trait Index<Sized? Index, Sized? Result> {
/// The method for the indexing (`Foo[Bar]`) operation
fn index<'a>(&'a self, index: &Index) -> &'a Result;
}
Expand Down Expand Up @@ -757,7 +757,7 @@ pub trait Index<Sized? Index, Sized? Result> for Sized? {
/// ```
#[cfg(not(stage0))] // NOTE(stage0) remove cfg after a snapshot
#[lang="index"]
pub trait Index<Sized? Index> for Sized? {
pub trait Index<Sized? Index> {
type Sized? Output;

/// The method for the indexing (`Foo[Bar]`) operation
Expand All @@ -768,7 +768,7 @@ pub trait Index<Sized? Index> for Sized? {
#[cfg(stage0)]
#[allow(missing_docs)]
#[lang="index_mut"]
pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
pub trait IndexMut<Sized? Index, Sized? Result> {
/// The method for the indexing (`Foo[Bar]`) operation
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
}
Expand Down Expand Up @@ -804,7 +804,7 @@ pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
/// ```
#[cfg(not(stage0))] // NOTE(stage0) remove cfg after a snapshot
#[lang="index_mut"]
pub trait IndexMut<Sized? Index> for Sized? {
pub trait IndexMut<Sized? Index> {
type Sized? Output;

/// The method for the indexing (`Foo[Bar]`) operation
Expand Down Expand Up @@ -849,7 +849,7 @@ pub trait IndexMut<Sized? Index> for Sized? {
/// }
/// ```
#[lang="slice"]
pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
pub trait Slice<Sized? Idx, Sized? Result> {
/// The method for the slicing operation foo[]
fn as_slice_<'a>(&'a self) -> &'a Result;
/// The method for the slicing operation foo[from..]
Expand Down Expand Up @@ -898,7 +898,7 @@ pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
/// }
/// ```
#[lang="slice_mut"]
pub trait SliceMut<Sized? Idx, Sized? Result> for Sized? {
pub trait SliceMut<Sized? Idx, Sized? Result> {
/// The method for the slicing operation foo[]
fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Result;
/// The method for the slicing operation foo[from..]
Expand Down Expand Up @@ -1025,7 +1025,7 @@ pub struct RangeTo<Idx> {
/// }
/// ```
#[lang="deref"]
pub trait Deref for Sized? {
pub trait Deref {
type Sized? Target;

/// The method called to dereference a value
Expand Down Expand Up @@ -1082,7 +1082,7 @@ impl<'a, Sized? T> Deref for &'a mut T {
/// }
/// ```
#[lang="deref_mut"]
pub trait DerefMut for Sized? : Deref {
pub trait DerefMut : Deref {
/// The method called to mutably dereference a value
fn deref_mut<'a>(&'a mut self) -> &'a mut <Self as Deref>::Target;
}
Expand All @@ -1093,14 +1093,14 @@ impl<'a, Sized? T> DerefMut for &'a mut T {

/// A version of the call operator that takes an immutable receiver.
#[lang="fn"]
pub trait Fn<Args,Result> for Sized? {
pub trait Fn<Args,Result> {
/// This is called when the call operator is used.
extern "rust-call" fn call(&self, args: Args) -> Result;
}

/// A version of the call operator that takes a mutable receiver.
#[lang="fn_mut"]
pub trait FnMut<Args,Result> for Sized? {
pub trait FnMut<Args,Result> {
/// This is called when the call operator is used.
extern "rust-call" fn call_mut(&mut self, args: Args) -> Result;
}
Expand Down
3 changes: 1 addition & 2 deletions src/libcore/raw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

use kinds::Copy;
use mem;
use kinds::Sized;

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

/// This trait is meant to map equivalences between raw structs and their
/// corresponding rust values.
pub trait Repr<T> for Sized? {
pub trait Repr<T> {
/// This function "unwraps" a rust value (without consuming it) into its raw
/// struct representation. This can be used to read/write different values
/// for the struct. This is a safe method because by default it does not
Expand Down
9 changes: 4 additions & 5 deletions src/libcore/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ use raw::Slice as RawSlice;

/// Extension methods for slices.
#[allow(missing_docs)] // docs in libcollections
pub trait SliceExt for Sized? {
pub trait SliceExt {
type Item;

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

/// Data that is viewable as a slice.
#[experimental = "will be replaced by slice syntax"]
pub trait AsSlice<T> for Sized? {
pub trait AsSlice<T> {
/// Work with `self` as a slice.
fn as_slice<'a>(&'a self) -> &'a [T];
}
Expand Down Expand Up @@ -1372,12 +1372,11 @@ pub unsafe fn from_raw_mut_buf<'a, T>(p: &'a *mut T, len: uint) -> &'a mut [T] {
/// Operations on `[u8]`.
#[experimental = "needs review"]
pub mod bytes {
use kinds::Sized;
use ptr;
use slice::SliceExt;

/// A trait for operations on mutable `[u8]`s.
pub trait MutableByteVector for Sized? {
pub trait MutableByteVector {
/// Sets all bytes of the receiver to the given value.
fn set_memory(&mut self, value: u8);
}
Expand Down Expand Up @@ -1461,7 +1460,7 @@ impl<T: PartialOrd> PartialOrd for [T] {

/// Extension methods for slices containing integers.
#[experimental]
pub trait IntSliceExt<U, S> for Sized? {
pub trait IntSliceExt<U, S> {
/// Converts the slice to an immutable slice of unsigned integers with the same width.
fn as_unsigned<'a>(&'a self) -> &'a [U];
/// Converts the slice to an immutable slice of signed integers with the same width.
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,7 +1130,7 @@ pub mod traits {
#[unstable = "Instead of taking this bound generically, this trait will be \
replaced with one of slicing syntax, deref coercions, or \
a more generic conversion trait"]
pub trait Str for Sized? {
pub trait Str {
/// Work with `self` as a slice.
fn as_slice<'a>(&'a self) -> &'a str;
}
Expand Down Expand Up @@ -1171,7 +1171,7 @@ delegate_iter!{pattern forward &'a str in RSplitN<'a, P>}

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

Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/traits/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ impl<'cx, 'tcx> Elaborator<'cx, 'tcx> {
// Only keep those bounds that we haven't already
// seen. This is necessary to prevent infinite
// recursion in some cases. One common case is when
// people define `trait Sized { }` rather than `trait
// Sized for Sized? { }`.
// people define `trait Sized: Sized { }` rather than `trait
// Sized { }`.
predicates.retain(|r| self.visited.insert(r.clone()));

self.stack.push(StackEntry { position: 0,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/util/ppaux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use syntax::{ast, ast_util};
use syntax::owned_slice::OwnedSlice;

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

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/cabi_x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl RegClass {
}
}

trait ClassList for Sized? {
trait ClassList {
fn is_pass_byval(&self) -> bool;
fn is_ret_bysret(&self) -> bool;
}
Expand Down
Loading