This commit is contained in:
Nick Cameron 2015-01-06 10:16:49 +13:00
parent 48f50e1e98
commit e0684e8769
64 changed files with 211 additions and 211 deletions

View File

@ -75,14 +75,14 @@ impl<T: Clone> Clone for Box<T> {
}
#[stable]
impl<Sized? T: PartialEq> PartialEq for Box<T> {
impl<T: ?Sized + PartialEq> PartialEq for Box<T> {
#[inline]
fn eq(&self, other: &Box<T>) -> bool { PartialEq::eq(&**self, &**other) }
#[inline]
fn ne(&self, other: &Box<T>) -> bool { PartialEq::ne(&**self, &**other) }
}
#[stable]
impl<Sized? T: PartialOrd> PartialOrd for Box<T> {
impl<T: ?Sized + PartialOrd> PartialOrd for Box<T> {
#[inline]
fn partial_cmp(&self, other: &Box<T>) -> Option<Ordering> {
PartialOrd::partial_cmp(&**self, &**other)
@ -97,16 +97,16 @@ impl<Sized? T: PartialOrd> PartialOrd for Box<T> {
fn gt(&self, other: &Box<T>) -> bool { PartialOrd::gt(&**self, &**other) }
}
#[stable]
impl<Sized? T: Ord> Ord for Box<T> {
impl<T: ?Sized + Ord> Ord for Box<T> {
#[inline]
fn cmp(&self, other: &Box<T>) -> Ordering {
Ord::cmp(&**self, &**other)
}
#[stable]}
impl<Sized? T: Eq> Eq for Box<T> {}
impl<T: ?Sized + Eq> Eq for Box<T> {}
impl<S: hash::Writer, Sized? T: Hash<S>> Hash<S> for Box<T> {
impl<S: hash::Writer, T: ?Sized + Hash<S>> Hash<S> for Box<T> {
#[inline]
fn hash(&self, state: &mut S) {
(**self).hash(state);
@ -143,7 +143,7 @@ impl BoxAny for Box<Any> {
}
}
impl<Sized? T: fmt::Show> fmt::Show for Box<T> {
impl<T: ?Sized + fmt::Show> fmt::Show for Box<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
(**self).fmt(f)
}
@ -155,13 +155,13 @@ impl fmt::Show for Box<Any> {
}
}
impl<Sized? T> Deref for Box<T> {
impl<T: ?Sized> Deref for Box<T> {
type Target = T;
fn deref(&self) -> &T { &**self }
}
impl<Sized? T> DerefMut for Box<T> {
impl<T: ?Sized> DerefMut for Box<T> {
fn deref_mut(&mut self) -> &mut T { &mut **self }
}

View File

@ -130,7 +130,7 @@ pub struct Values<'a, K: 'a, V: 'a> {
#[stable]
/// A view into a single entry in a map, which may either 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> {
/// A vacant Entry
Vacant(VacantEntry<'a, Q, K, V>),
/// An occupied Entry
@ -139,7 +139,7 @@ pub enum Entry<'a, Sized? Q:'a, K:'a, V:'a> {
#[stable]
/// A vacant Entry.
pub struct VacantEntry<'a, Sized? Q:'a, K:'a, V:'a> {
pub struct VacantEntry<'a, Q: ?Sized +'a, K:'a, V:'a> {
key: &'a Q,
stack: stack::SearchStack<'a, K, V, node::handle::Edge, node::handle::Leaf>,
}
@ -214,7 +214,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.get(&2), None);
/// ```
#[stable]
pub fn get<Sized? Q>(&self, key: &Q) -> Option<&V> where Q: BorrowFrom<K> + Ord {
pub fn get<Q: ?Sized>(&self, key: &Q) -> Option<&V> where Q: BorrowFrom<K> + Ord {
let mut cur_node = &self.root;
loop {
match Node::search(cur_node, key) {
@ -246,7 +246,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.contains_key(&2), false);
/// ```
#[stable]
pub fn contains_key<Sized? Q>(&self, key: &Q) -> bool where Q: BorrowFrom<K> + Ord {
pub fn contains_key<Q: ?Sized>(&self, key: &Q) -> bool where Q: BorrowFrom<K> + Ord {
self.get(key).is_some()
}
@ -270,7 +270,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// ```
// See `get` for implementation notes, this is basically a copy-paste with mut's added
#[stable]
pub fn get_mut<Sized? Q>(&mut self, key: &Q) -> Option<&mut V> where Q: BorrowFrom<K> + Ord {
pub fn get_mut<Q: ?Sized>(&mut self, key: &Q) -> Option<&mut V> where Q: BorrowFrom<K> + Ord {
// temp_node is a Borrowck hack for having a mutable value outlive a loop iteration
let mut temp_node = &mut self.root;
loop {
@ -440,7 +440,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// assert_eq!(map.remove(&1), None);
/// ```
#[stable]
pub fn remove<Sized? Q>(&mut self, key: &Q) -> Option<V> where Q: BorrowFrom<K> + Ord {
pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V> where Q: BorrowFrom<K> + Ord {
// See `swap` for a more thorough description of the stuff going on in here
let mut stack = stack::PartialSearchStack::new(self);
loop {
@ -880,7 +880,7 @@ impl<K: Show, V: Show> Show for BTreeMap<K, V> {
// NOTE(stage0): remove impl after a snapshot
#[cfg(stage0)]
#[stable]
impl<K: Ord, Sized? Q, V> Index<Q, V> for BTreeMap<K, V>
impl<K: Ord, Q: ?Sized, V> Index<Q, V> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord
{
fn index(&self, key: &Q) -> &V {
@ -890,7 +890,7 @@ impl<K: Ord, Sized? Q, V> Index<Q, V> for BTreeMap<K, V>
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<K: Ord, Sized? Q, V> Index<Q> for BTreeMap<K, V>
impl<K: Ord, Q: ?Sized, V> Index<Q> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord
{
type Output = V;
@ -903,7 +903,7 @@ impl<K: Ord, Sized? Q, V> Index<Q> for BTreeMap<K, V>
// NOTE(stage0): remove impl after a snapshot
#[cfg(stage0)]
#[stable]
impl<K: Ord, Sized? Q, V> IndexMut<Q, V> for BTreeMap<K, V>
impl<K: Ord, Q: ?Sized, V> IndexMut<Q, V> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord
{
fn index_mut(&mut self, key: &Q) -> &mut V {
@ -913,7 +913,7 @@ impl<K: Ord, Sized? Q, V> IndexMut<Q, V> for BTreeMap<K, V>
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[stable]
impl<K: Ord, Sized? Q, V> IndexMut<Q> for BTreeMap<K, V>
impl<K: Ord, Q: ?Sized, V> IndexMut<Q> for BTreeMap<K, V>
where Q: BorrowFrom<K> + Ord
{
type Output = V;
@ -1135,7 +1135,7 @@ impl<'a, K, V> DoubleEndedIterator for Values<'a, K, V> {
#[stable]
impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {}
impl<'a, Sized? Q, K: Ord, V> Entry<'a, Q, K, V> {
impl<'a, Q: ?Sized, K: Ord, 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>> {
@ -1146,7 +1146,7 @@ impl<'a, Sized? Q, K: Ord, V> Entry<'a, Q, K, V> {
}
}
impl<'a, Sized? Q: ToOwned<K>, K: Ord, V> VacantEntry<'a, Q, K, V> {
impl<'a, Q: ?Sized + ToOwned<K>, K: Ord, V> VacantEntry<'a, Q, K, V> {
#[stable]
/// Sets the value of the entry with the VacantEntry's key,
/// and returns a mutable reference to it.
@ -1386,7 +1386,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// ```
/// The key must have the same ordering before or after `.to_owned()` is called.
#[stable]
pub fn entry<'a, Sized? Q>(&'a mut self, mut key: &'a Q) -> Entry<'a, Q, K, V>
pub fn entry<'a, Q: ?Sized>(&'a mut self, mut key: &'a Q) -> Entry<'a, Q, K, V>
where Q: Ord + ToOwned<K>
{
// same basic logic of `swap` and `pop`, blended together

View File

@ -517,7 +517,7 @@ impl<K: Ord, V> Node<K, V> {
/// Searches for the given key in the node. If it finds an exact match,
/// `Found` will be yielded with the matching index. If it doesn't find an exact match,
/// `GoDown` will be yielded with the index of the subtree the key must lie in.
pub fn search<Sized? Q, NodeRef: Deref<Target=Node<K, V>>>(node: NodeRef, key: &Q)
pub fn search<Q: ?Sized, NodeRef: Deref<Target=Node<K, V>>>(node: NodeRef, key: &Q)
-> SearchResult<NodeRef> where Q: BorrowFrom<K> + Ord {
// FIXME(Gankro): Tune when to search linear or binary based on B (and maybe K/V).
// 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> {
}
}
fn search_linear<Sized? Q>(&self, key: &Q) -> (bool, uint) where Q: BorrowFrom<K> + Ord {
fn search_linear<Q: ?Sized>(&self, key: &Q) -> (bool, uint) where Q: BorrowFrom<K> + Ord {
for (i, k) in self.keys().iter().enumerate() {
match key.cmp(BorrowFrom::borrow_from(k)) {
Greater => {},

View File

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

View File

@ -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<T: ?Sized, U> for Sized? {
/// Flattens a slice of `T` into a single value `U`.
#[stable]
fn concat(&self) -> U;

View File

@ -53,50 +53,50 @@ use option::Option;
use self::Cow::*;
/// A trait for borrowing data.
pub trait BorrowFrom<Sized? Owned> for Sized? {
pub trait BorrowFrom<Owned: ?Sized> for Sized? {
/// 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<Owned: ?Sized> for Sized? : BorrowFrom<Owned> {
/// Mutably borrow from an owned value.
fn borrow_from_mut(owned: &mut Owned) -> &mut Self;
}
impl<Sized? T> BorrowFrom<T> for T {
impl<T: ?Sized> BorrowFrom<T> for T {
fn borrow_from(owned: &T) -> &T { owned }
}
impl<Sized? T> BorrowFromMut<T> for T {
impl<T: ?Sized> BorrowFromMut<T> for T {
fn borrow_from_mut(owned: &mut T) -> &mut T { owned }
}
impl<'a, Sized? T> BorrowFrom<&'a T> for T {
impl<'a, T: ?Sized> BorrowFrom<&'a T> for T {
fn borrow_from<'b>(owned: &'b &'a T) -> &'b T { &**owned }
}
impl<'a, Sized? T> BorrowFrom<&'a mut T> for T {
impl<'a, T: ?Sized> BorrowFrom<&'a mut T> for T {
fn borrow_from<'b>(owned: &'b &'a mut T) -> &'b T { &**owned }
}
impl<'a, Sized? T> BorrowFromMut<&'a mut T> for T {
impl<'a, T: ?Sized> BorrowFromMut<&'a mut T> for T {
fn borrow_from_mut<'b>(owned: &'b mut &'a mut T) -> &'b mut T { &mut **owned }
}
impl<'a, T, Sized? B> BorrowFrom<Cow<'a, T, B>> for B where B: ToOwned<T> {
impl<'a, T, B: ?Sized> BorrowFrom<Cow<'a, T, B>> for B where B: ToOwned<T> {
fn borrow_from<'b>(owned: &'b Cow<'a, T, B>) -> &'b B {
&**owned
}
}
/// Trait for moving into a `Cow`
pub trait IntoCow<'a, T, Sized? B> {
pub trait IntoCow<'a, T, B: ?Sized> {
/// Moves `self` into `Cow`
fn into_cow(self) -> Cow<'a, T, B>;
}
impl<'a, T, Sized? B> IntoCow<'a, T, B> for Cow<'a, T, B> where B: ToOwned<T> {
impl<'a, T, B: ?Sized> IntoCow<'a, T, B> for Cow<'a, T, B> where B: ToOwned<T> {
fn into_cow(self) -> Cow<'a, T, B> {
self
}
@ -129,7 +129,7 @@ impl<T> ToOwned<T> for T where T: Clone {
/// }
/// }
/// ```
pub enum Cow<'a, T, Sized? B: 'a> where B: ToOwned<T> {
pub enum Cow<'a, T, B: ?Sized + 'a> where B: ToOwned<T> {
/// Borrowed data.
Borrowed(&'a B),
@ -138,7 +138,7 @@ pub enum Cow<'a, T, Sized? B: 'a> where B: ToOwned<T> {
}
#[stable]
impl<'a, T, Sized? B> Clone for Cow<'a, T, B> where B: ToOwned<T> {
impl<'a, T, B: ?Sized> Clone for Cow<'a, T, B> where B: ToOwned<T> {
fn clone(&self) -> Cow<'a, T, B> {
match *self {
Borrowed(b) => Borrowed(b),
@ -150,7 +150,7 @@ impl<'a, T, Sized? B> Clone for Cow<'a, T, B> where B: ToOwned<T> {
}
}
impl<'a, T, Sized? B> Cow<'a, T, B> where B: ToOwned<T> {
impl<'a, T, B: ?Sized> Cow<'a, T, B> where B: ToOwned<T> {
/// Acquire a mutable reference to the owned form of the data.
///
/// Copies the data if it is not already owned.
@ -191,7 +191,7 @@ impl<'a, T, Sized? B> Cow<'a, T, B> where B: ToOwned<T> {
}
}
impl<'a, T, Sized? B> Deref for Cow<'a, T, B> where B: ToOwned<T> {
impl<'a, T, B: ?Sized> Deref for Cow<'a, T, B> where B: ToOwned<T> {
type Target = B;
fn deref(&self) -> &B {
@ -203,10 +203,10 @@ impl<'a, T, Sized? B> Deref for Cow<'a, T, B> where B: ToOwned<T> {
}
#[stable]
impl<'a, T, Sized? B> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {}
impl<'a, T, B: ?Sized> Eq for Cow<'a, T, B> where B: Eq + ToOwned<T> {}
#[stable]
impl<'a, T, Sized? B> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
impl<'a, T, B: ?Sized> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
#[inline]
fn cmp(&self, other: &Cow<'a, T, B>) -> Ordering {
Ord::cmp(&**self, &**other)
@ -214,7 +214,7 @@ impl<'a, T, Sized? B> Ord for Cow<'a, T, B> where B: Ord + ToOwned<T> {
}
#[stable]
impl<'a, 'b, T, U, Sized? B, Sized? C> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where
impl<'a, 'b, T, U, B: ?Sized, C: ?Sized> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B> where
B: PartialEq<C> + ToOwned<T>,
C: ToOwned<U>,
{
@ -225,14 +225,14 @@ impl<'a, 'b, T, U, Sized? B, Sized? C> PartialEq<Cow<'b, U, C>> for Cow<'a, T, B
}
#[stable]
impl<'a, T, Sized? B> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> {
impl<'a, T, B: ?Sized> PartialOrd for Cow<'a, T, B> where B: PartialOrd + ToOwned<T> {
#[inline]
fn partial_cmp(&self, other: &Cow<'a, T, B>) -> Option<Ordering> {
PartialOrd::partial_cmp(&**self, &**other)
}
}
impl<'a, T, Sized? B> fmt::Show for Cow<'a, T, B> where B: fmt::Show + ToOwned<T>, T: fmt::Show {
impl<'a, T, B: ?Sized> fmt::Show for Cow<'a, T, B> where B: fmt::Show + ToOwned<T>, T: fmt::Show {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
Borrowed(ref b) => fmt::Show::fmt(b, f),

View File

@ -43,7 +43,7 @@ pub trait Clone : Sized {
}
#[stable]
impl<'a, Sized? T> Clone for &'a T {
impl<'a, T: ?Sized> Clone for &'a T {
/// Return a shallow copy of the reference.
#[inline]
fn clone(&self) -> &'a T { *self }

View File

@ -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<Rhs: ?Sized = Self> for Sized? {
/// This method tests for `self` and `other` values to be equal, and is used by `==`.
#[stable]
fn eq(&self, other: &Rhs) -> bool;
@ -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<Rhs: ?Sized = Self> for Sized?: PartialEq<Rhs> {
/// This method returns an ordering between `self` and `other` values
/// if one exists.
#[stable]
@ -428,14 +428,14 @@ mod impls {
// & pointers
#[stable]
impl<'a, 'b, Sized? A, Sized? B> PartialEq<&'b B> for &'a A where A: PartialEq<B> {
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a A where A: PartialEq<B> {
#[inline]
fn eq(&self, other: & &'b B) -> bool { PartialEq::eq(*self, *other) }
#[inline]
fn ne(&self, other: & &'b B) -> bool { PartialEq::ne(*self, *other) }
}
#[stable]
impl<'a, 'b, Sized? A, Sized? B> PartialOrd<&'b B> for &'a A where A: PartialOrd<B> {
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b B> for &'a A where A: PartialOrd<B> {
#[inline]
fn partial_cmp(&self, other: &&'b B) -> Option<Ordering> {
PartialOrd::partial_cmp(*self, *other)
@ -450,24 +450,24 @@ mod impls {
fn gt(&self, other: & &'b B) -> bool { PartialOrd::gt(*self, *other) }
}
#[stable]
impl<'a, Sized? A> Ord for &'a A where A: Ord {
impl<'a, A: ?Sized> Ord for &'a A where A: Ord {
#[inline]
fn cmp(&self, other: & &'a A) -> Ordering { Ord::cmp(*self, *other) }
}
#[stable]
impl<'a, Sized? A> Eq for &'a A where A: Eq {}
impl<'a, A: ?Sized> Eq for &'a A where A: Eq {}
// &mut pointers
#[stable]
impl<'a, 'b, Sized? A, Sized? B> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> {
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a mut A where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
#[inline]
fn ne(&self, other: &&'b mut B) -> bool { PartialEq::ne(*self, *other) }
}
#[stable]
impl<'a, 'b, Sized? A, Sized? B> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd<B> {
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialOrd<&'b mut B> for &'a mut A where A: PartialOrd<B> {
#[inline]
fn partial_cmp(&self, other: &&'b mut B) -> Option<Ordering> {
PartialOrd::partial_cmp(*self, *other)
@ -482,15 +482,15 @@ mod impls {
fn gt(&self, other: &&'b mut B) -> bool { PartialOrd::gt(*self, *other) }
}
#[stable]
impl<'a, Sized? A> Ord for &'a mut A where A: Ord {
impl<'a, A: ?Sized> Ord for &'a mut A where A: Ord {
#[inline]
fn cmp(&self, other: &&'a mut A) -> Ordering { Ord::cmp(*self, *other) }
}
#[stable]
impl<'a, Sized? A> Eq for &'a mut A where A: Eq {}
impl<'a, A: ?Sized> Eq for &'a mut A where A: Eq {}
#[stable]
impl<'a, 'b, Sized? A, Sized? B> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> {
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b mut B> for &'a A where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &&'b mut B) -> bool { PartialEq::eq(*self, *other) }
#[inline]
@ -498,7 +498,7 @@ mod impls {
}
#[stable]
impl<'a, 'b, Sized? A, Sized? B> PartialEq<&'b B> for &'a mut A where A: PartialEq<B> {
impl<'a, 'b, A: ?Sized, B: ?Sized> PartialEq<&'b B> for &'a mut A where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &&'b B) -> bool { PartialEq::eq(*self, *other) }
#[inline]

View File

@ -78,9 +78,9 @@ pub trait Writer {
// This Adapter is needed to allow `self` (of type `&mut
// Self`) to be cast to a FormatWriter (below) without
// requiring a `Sized` bound.
struct Adapter<'a,Sized? T:'a>(&'a mut T);
struct Adapter<'a,T: ?Sized +'a>(&'a mut T);
impl<'a, Sized? T> Writer for Adapter<'a, T>
impl<'a, T: ?Sized> Writer for Adapter<'a, T>
where T: Writer
{
fn write_str(&mut self, s: &str) -> Result {
@ -592,10 +592,10 @@ pub fn argumentuint<'a>(s: &'a uint) -> Argument<'a> {
// Implementations of the core formatting traits
impl<'a, Sized? T: Show> Show for &'a T {
impl<'a, T: ?Sized + Show> Show for &'a T {
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) }
}
impl<'a, Sized? T: Show> Show for &'a mut T {
impl<'a, T: ?Sized + Show> Show for &'a mut T {
fn fmt(&self, f: &mut Formatter) -> Result { (**self).fmt(f) }
}

View File

@ -85,7 +85,7 @@ pub trait Hash<S = sip::SipState> for Sized? {
/// containers like `HashMap`, which need a generic way hash multiple types.
pub trait Hasher<S> {
/// Compute the hash of a value.
fn hash<Sized? T: Hash<S>>(&self, value: &T) -> u64;
fn hash<T: ?Sized + Hash<S>>(&self, value: &T) -> u64;
}
#[allow(missing_docs)]
@ -194,14 +194,14 @@ impl<S: Writer, T: Hash<S>> Hash<S> for [T] {
}
impl<'a, S: Writer, Sized? T: Hash<S>> Hash<S> for &'a T {
impl<'a, S: Writer, T: ?Sized + Hash<S>> Hash<S> for &'a T {
#[inline]
fn hash(&self, state: &mut S) {
(**self).hash(state);
}
}
impl<'a, S: Writer, Sized? T: Hash<S>> Hash<S> for &'a mut T {
impl<'a, S: Writer, T: ?Sized + Hash<S>> Hash<S> for &'a mut T {
#[inline]
fn hash(&self, state: &mut S) {
(**self).hash(state);
@ -233,7 +233,7 @@ impl<S: Writer> Hash<S> for TypeId {
}
}
impl<'a, T, Sized? B, S> Hash<S> for Cow<'a, T, B> where B: Hash<S> + ToOwned<T> {
impl<'a, T, B: ?Sized, S> Hash<S> for Cow<'a, T, B> where B: Hash<S> + ToOwned<T> {
#[inline]
fn hash(&self, state: &mut S) {
Hash::hash(&**self, state)

View File

@ -239,7 +239,7 @@ impl SipHasher {
impl Hasher<SipState> for SipHasher {
#[inline]
fn hash<Sized? T: Hash<SipState>>(&self, value: &T) -> u64 {
fn hash<T: ?Sized + Hash<SipState>>(&self, value: &T) -> u64 {
let mut state = SipState::new_with_keys(self.k0, self.k1);
value.hash(&mut state);
state.result()
@ -255,7 +255,7 @@ impl Default for SipHasher {
/// Hashes a value using the SipHash algorithm.
#[inline]
pub fn hash<Sized? T: Hash<SipState>>(value: &T) -> u64 {
pub fn hash<T: ?Sized + Hash<SipState>>(value: &T) -> u64 {
let mut state = SipState::new();
value.hash(&mut state);
state.result()
@ -263,7 +263,7 @@ pub fn hash<Sized? T: Hash<SipState>>(value: &T) -> u64 {
/// Hashes a value with the SipHash algorithm with the provided keys.
#[inline]
pub fn hash_with_keys<Sized? T: Hash<SipState>>(k0: u64, k1: u64, value: &T) -> u64 {
pub fn hash_with_keys<T: ?Sized + Hash<SipState>>(k0: u64, k1: u64, value: &T) -> u64 {
let mut state = SipState::new_with_keys(k0, k1);
value.hash(&mut state);
state.result()

View File

@ -133,10 +133,10 @@ pub mod marker {
/// for some lifetime `'a`, but not the other way around).
#[lang="covariant_type"]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct CovariantType<Sized? T>;
pub struct CovariantType<T: ?Sized>;
impl<Sized? T> Copy for CovariantType<T> {}
impl<Sized? T> Clone for CovariantType<T> {
impl<T: ?Sized> Copy for CovariantType<T> {}
impl<T: ?Sized> Clone for CovariantType<T> {
fn clone(&self) -> CovariantType<T> { *self }
}
@ -181,10 +181,10 @@ pub mod marker {
/// arguments of type `U`, hence such a conversion is safe.
#[lang="contravariant_type"]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct ContravariantType<Sized? T>;
pub struct ContravariantType<T: ?Sized>;
impl<Sized? T> Copy for ContravariantType<T> {}
impl<Sized? T> Clone for ContravariantType<T> {
impl<T: ?Sized> Copy for ContravariantType<T> {}
impl<T: ?Sized> Clone for ContravariantType<T> {
fn clone(&self) -> ContravariantType<T> { *self }
}
@ -211,10 +211,10 @@ pub mod marker {
/// interior mutability.
#[lang="invariant_type"]
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct InvariantType<Sized? T>;
pub struct InvariantType<T: ?Sized>;
impl<Sized? T> Copy for InvariantType<T> {}
impl<Sized? T> Clone for InvariantType<T> {
impl<T: ?Sized> Copy for InvariantType<T> {}
impl<T: ?Sized> Clone for InvariantType<T> {
fn clone(&self) -> InvariantType<T> { *self }
}

View File

@ -320,7 +320,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
#[inline]
#[unstable = "this function may be removed in the future due to its \
questionable utility"]
pub unsafe fn copy_lifetime<'a, Sized? S, Sized? T: 'a>(_ptr: &'a S,
pub unsafe fn copy_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a S,
ptr: &T) -> &'a T {
transmute(ptr)
}
@ -329,7 +329,7 @@ pub unsafe fn copy_lifetime<'a, Sized? S, Sized? T: 'a>(_ptr: &'a S,
#[inline]
#[unstable = "this function may be removed in the future due to its \
questionable utility"]
pub unsafe fn copy_mut_lifetime<'a, Sized? S, Sized? T: 'a>(_ptr: &'a mut S,
pub unsafe fn copy_mut_lifetime<'a, S: ?Sized, T: ?Sized + 'a>(_ptr: &'a mut S,
ptr: &mut T)
-> &'a mut T {
transmute(ptr)

View File

@ -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<Index: ?Sized, Result: ?Sized> for Sized? {
/// The method for the indexing (`Foo[Bar]`) operation
fn index<'a>(&'a self, index: &Index) -> &'a Result;
}
@ -757,8 +757,8 @@ 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? {
type Sized? Output;
pub trait Index<Index: ?Sized> for Sized? {
type Output: ?Sized;
/// The method for the indexing (`Foo[Bar]`) operation
fn index<'a>(&'a self, index: &Index) -> &'a Self::Output;
@ -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<Index: ?Sized, Result: ?Sized> for Sized? {
/// The method for the indexing (`Foo[Bar]`) operation
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Result;
}
@ -804,8 +804,8 @@ 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? {
type Sized? Output;
pub trait IndexMut<Index: ?Sized> for Sized? {
type Output: ?Sized;
/// The method for the indexing (`Foo[Bar]`) operation
fn index_mut<'a>(&'a mut self, index: &Index) -> &'a mut Self::Output;
@ -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<Idx: ?Sized, Result: ?Sized> for Sized? {
/// The method for the slicing operation foo[]
fn as_slice_<'a>(&'a self) -> &'a Result;
/// The method for the slicing operation foo[from..]
@ -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<Idx: ?Sized, Result: ?Sized> for Sized? {
/// 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..]
@ -1026,19 +1026,19 @@ pub struct RangeTo<Idx> {
/// ```
#[lang="deref"]
pub trait Deref for Sized? {
type Sized? Target;
type Target: ?Sized;
/// The method called to dereference a value
fn deref<'a>(&'a self) -> &'a Self::Target;
}
impl<'a, Sized? T> Deref for &'a T {
impl<'a, T: ?Sized> Deref for &'a T {
type Target = T;
fn deref(&self) -> &T { *self }
}
impl<'a, Sized? T> Deref for &'a mut T {
impl<'a, T: ?Sized> Deref for &'a mut T {
type Target = T;
fn deref(&self) -> &T { *self }
@ -1087,7 +1087,7 @@ pub trait DerefMut for Sized? : Deref {
fn deref_mut<'a>(&'a mut self) -> &'a mut <Self as Deref>::Target;
}
impl<'a, Sized? T> DerefMut for &'a mut T {
impl<'a, T: ?Sized> DerefMut for &'a mut T {
fn deref_mut(&mut self) -> &mut T { *self }
}
@ -1112,7 +1112,7 @@ pub trait FnOnce<Args,Result> {
extern "rust-call" fn call_once(self, args: Args) -> Result;
}
impl<Sized? F,A,R> FnMut<A,R> for F
impl<F: ?Sized, A, R> FnMut<A, R> for F
where F : Fn<A, R>
{
extern "rust-call" fn call_mut(&mut self, args: A) -> R {

View File

@ -648,13 +648,13 @@ impl<T> AsSlice<T> for [T] {
}
#[experimental = "trait is experimental"]
impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a U {
impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a U {
#[inline(always)]
fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) }
}
#[experimental = "trait is experimental"]
impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a mut U {
impl<'a, T, U: ?Sized + AsSlice<T>> AsSlice<T> for &'a mut U {
#[inline(always)]
fn as_slice(&self) -> &[T] { AsSlice::as_slice(*self) }
}

View File

@ -1140,7 +1140,7 @@ impl Str for str {
fn as_slice<'a>(&'a self) -> &'a str { self }
}
impl<'a, Sized? S> Str for &'a S where S: Str {
impl<'a, S: ?Sized> Str for &'a S where S: Str {
#[inline]
fn as_slice(&self) -> &str { Str::as_slice(*self) }
}

View File

@ -16,7 +16,7 @@ use core::hash::{Hash, Hasher, Writer};
struct MyWriterHasher;
impl Hasher<MyWriter> for MyWriterHasher {
fn hash<Sized? T: Hash<MyWriter>>(&self, value: &T) -> u64 {
fn hash<T: ?Sized + Hash<MyWriter>>(&self, value: &T) -> u64 {
let mut state = MyWriter { hash: 0 };
value.hash(&mut state);
state.hash

View File

@ -25,7 +25,7 @@ use std::slice;
// Note 2: Once Dynamically Sized Types (DST) lands, it might be
// reasonable to replace this with something like `enum MaybeOwned<'a,
// Sized? U>{ Owned(Box<U>), Borrowed(&'a U) }`; and then `U` could be
// U: ?Sized>{ Owned(Box<U>), Borrowed(&'a U) }`; and then `U` could be
// instantiated with `[T]` or `str`, etc. Of course, that would imply
// removing the `Growable` variant, which relates to note 1 above.
// Alternatively, we might add `MaybeOwned` for the general case but

View File

@ -121,7 +121,7 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
// However, it's not as simple as checking whether `T :
// Sized`, because even if `T : Sized` does not hold, that
// just means that `T` *may* not be sized. After all, even a
// type parameter `Sized? T` could be bound to a sized
// type parameter `T: ?Sized` could be bound to a sized
// type. (Issue #20116)
//
// To handle this, we first check for "interior" type
@ -143,12 +143,12 @@ impl<'a, 'tcx> IntrinsicCheckingVisitor<'a, 'tcx> {
// // T=int, U=int
// }
//
// fn bar<Sized? T,U>() {
// fn bar<T: ?Sized, U>() {
// // T=int, U=int
// // T=[int], U=int
// }
//
// fn baz<Sized? T, Sized?U>() {
// fn baz<T: ?Sized, U: ?Sized>() {
// // T=int, U=int
// // T=[int], U=int
// // T=int, U=[int]

View File

@ -75,7 +75,7 @@ pub struct FnvHasher;
pub struct FnvState(u64);
impl Hasher<FnvState> for FnvHasher {
fn hash<Sized? T: Hash<FnvState>>(&self, t: &T) -> u64 {
fn hash<T: ?Sized + Hash<FnvState>>(&self, t: &T) -> u64 {
let mut state = FnvState(0xcbf29ce484222325);
t.hash(&mut state);
let FnvState(ret) = state;

View File

@ -604,7 +604,7 @@ impl<'tcx> Repr<'tcx> for () {
}
}
impl<'a, 'tcx, Sized? T:Repr<'tcx>> Repr<'tcx> for &'a T {
impl<'a, 'tcx, T: ?Sized +Repr<'tcx>> Repr<'tcx> for &'a T {
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
Repr::repr(*self, tcx)
}

View File

@ -396,13 +396,13 @@ impl Decodable for () {
}
}
impl<'a, Sized? T: Encodable> Encodable for &'a T {
impl<'a, T: ?Sized + Encodable> Encodable for &'a T {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
(**self).encode(s)
}
}
impl<Sized? T: Encodable> Encodable for Box<T> {
impl<T: ?Sized + Encodable> Encodable for Box<T> {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
(**self).encode(s)
}

View File

@ -378,13 +378,13 @@ impl<E, D:Decoder<E>> Decodable<D, E> for () {
}
}
impl<'a, E, S: Encoder<E>, Sized? T: Encodable<S, E>> Encodable<S, E> for &'a T {
impl<'a, E, S: Encoder<E>, T: ?Sized + Encodable<S, E>> Encodable<S, E> for &'a T {
fn encode(&self, s: &mut S) -> Result<(), E> {
(**self).encode(s)
}
}
impl<E, S: Encoder<E>, Sized? T: Encodable<S, E>> Encodable<S, E> for Box<T> {
impl<E, S: Encoder<E>, T: ?Sized + Encodable<S, E>> Encodable<S, E> for Box<T> {
fn encode(&self, s: &mut S) -> Result<(), E> {
(**self).encode(s)
}

View File

@ -430,7 +430,7 @@ impl ToCStr for [u8] {
}
}
impl<'a, Sized? T: ToCStr> ToCStr for &'a T {
impl<'a, T: ?Sized + ToCStr> ToCStr for &'a T {
#[inline]
fn to_c_str(&self) -> CString {
(**self).to_c_str()

View File

@ -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>
{
@ -1229,7 +1229,7 @@ impl<K: Eq + Hash<S>, V, S, H: Hasher<S> + Default> Default for HashMap<K, V, H>
// NOTE(stage0): remove impl after a snapshot
#[cfg(stage0)]
#[stable]
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V, H>
impl<K: Hash<S> + Eq, Q: ?Sized, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V, H>
where Q: BorrowFrom<K> + Hash<S> + Eq
{
#[inline]
@ -1240,7 +1240,7 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q, V> for HashMap<K, V
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[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;
@ -1254,7 +1254,7 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> Index<Q> for HashMap<K, V, H
// NOTE(stage0): remove impl after a snapshot
#[cfg(stage0)]
#[stable]
impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K, V, H>
impl<K: Hash<S> + Eq, Q: ?Sized, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K, V, H>
where Q: BorrowFrom<K> + Hash<S> + Eq
{
#[inline]
@ -1265,7 +1265,7 @@ impl<K: Hash<S> + Eq, Sized? Q, V, S, H: Hasher<S>> IndexMut<Q, V> for HashMap<K
#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot
#[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;
@ -1357,7 +1357,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>>,
@ -1365,7 +1365,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
@ -1435,7 +1435,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>> {
@ -1481,7 +1481,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

View File

@ -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()

View File

@ -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,

View File

@ -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)
}
}

View File

@ -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>> {

View File

@ -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()

View File

@ -344,7 +344,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;

View File

@ -95,7 +95,7 @@ impl<'a> ParserObsoleteMethods for parser::Parser<'a> {
"write `extern crate bar as foo` instead"
),
ObsoleteSyntax::Sized => (
"`Sized? T` syntax for removing the `Sized` bound",
"`T: ?Sized` syntax for removing the `Sized` bound",
"write `T: ?Sized` instead"
),
};

View File

@ -77,7 +77,7 @@ impl<T: Eq + Hash + Clone + 'static> Interner<T> {
(*vect).len()
}
pub fn find<Sized? Q>(&self, val: &Q) -> Option<Name>
pub fn find<Q: ?Sized>(&self, val: &Q) -> Option<Name>
where Q: BorrowFrom<T> + Eq + Hash {
let map = self.map.borrow();
match (*map).get(val) {
@ -202,7 +202,7 @@ impl StrInterner {
self.vect.borrow().len()
}
pub fn find<Sized? Q>(&self, val: &Q) -> Option<Name>
pub fn find<Q: ?Sized>(&self, val: &Q) -> Option<Name>
where Q: BorrowFrom<RcStr> + Eq + Hash {
match (*self.map.borrow()).get(val) {
Some(v) => Some(*v),

View File

@ -11,7 +11,7 @@
#![feature(associated_types)]
trait Get {
type Sized? Value;
type Value: ?Sized;
fn get(&self) -> <Self as Get>::Value;
}

View File

@ -10,7 +10,7 @@
// Forbid assignment into a dynamically sized type.
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
f1: int,
f2: &'static str,
ptr: T

View File

@ -10,7 +10,7 @@
// Forbid assignment into a dynamically sized type.
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
f1: int,
f2: &'static str,
ptr: T

View File

@ -10,7 +10,7 @@
// Attempt to change the type as well as unsizing.
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
ptr: T
}

View File

@ -10,7 +10,7 @@
// Attempt to change the mutability as well as unsizing.
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
ptr: T
}

View File

@ -10,7 +10,7 @@
// Attempt to extend the lifetime as well as unsizing.
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
ptr: T
}

View File

@ -10,7 +10,7 @@
// Attempt to coerce from unsized to sized.
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
ptr: T
}

View File

@ -14,7 +14,7 @@ struct S;
trait T {}
impl T for S {}
struct Foo<Sized? T> {
struct Foo<T: ?Sized> {
f: T
}

View File

@ -13,7 +13,7 @@
// because it would require stack allocation of an unsized temporary (*g in the
// test).
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
ptr: T
}

View File

@ -13,12 +13,12 @@
trait Foo for Sized? {}
impl Foo for str {}
fn test1<Sized? T: Foo>(t: &T) {
fn test1<T: ?Sized + Foo>(t: &T) {
let u: &Foo = t;
//~^ ERROR `core::kinds::Sized` is not implemented for the type `T`
}
fn test2<Sized? T: Foo>(t: &T) {
fn test2<T: ?Sized + Foo>(t: &T) {
let v: &Foo = t as &Foo;
//~^ ERROR `core::kinds::Sized` is not implemented for the type `T`
}

View File

@ -14,11 +14,11 @@
use std::mem::transmute;
fn a<T, Sized? U>(x: &[T]) -> &U {
fn a<T, U: ?Sized>(x: &[T]) -> &U {
unsafe { transmute(x) } //~ ERROR transmute called on types with potentially different sizes
}
fn b<Sized? T, Sized? U>(x: &T) -> &U {
fn b<T: ?Sized, U: ?Sized>(x: &T) -> &U {
unsafe { transmute(x) } //~ ERROR transmute called on types with potentially different sizes
}
@ -30,11 +30,11 @@ fn d<T, U>(x: &[T]) -> &[U] {
unsafe { transmute(x) }
}
fn e<Sized? T, U>(x: &T) -> &U {
fn e<T: ?Sized, U>(x: &T) -> &U {
unsafe { transmute(x) } //~ ERROR transmute called on types with potentially different sizes
}
fn f<T, Sized? U>(x: &T) -> &U {
fn f<T, U: ?Sized>(x: &T) -> &U {
unsafe { transmute(x) } //~ ERROR transmute called on types with potentially different sizes
}

View File

@ -14,11 +14,11 @@
use std::mem::transmute;
struct Foo<Sized? T> {
struct Foo<T: ?Sized> {
t: Box<T>
}
impl<Sized? T> Foo<T> {
impl<T: ?Sized> Foo<T> {
fn m(x: &T) -> &int where T : Sized {
// OK here, because T : Sized is in scope.
unsafe { transmute(x) }

View File

@ -18,9 +18,9 @@ trait Foo<T,U,V=T> {
fn dummy(&self, t: T, u: U, v: V);
}
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B>() where A : Eq<B> { }
trait Eq<X: ?Sized> for Sized? { }
impl<X: ?Sized> Eq<X> for X { }
fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { }
fn test<'a,'b>() {
// Parens are equivalent to omitting default in angle.

View File

@ -20,9 +20,9 @@ trait Foo<T,U> {
fn dummy(&self, t: T, u: U);
}
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }
trait Eq<X: ?Sized> for Sized? { }
impl<X: ?Sized> Eq<X> for X { }
fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
fn test<'a,'b>() {
// No errors expected:

View File

@ -20,9 +20,9 @@ trait Foo<T,U> {
fn dummy(&self, t: T, u: U);
}
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }
trait Eq<X: ?Sized> for Sized? { }
impl<X: ?Sized> Eq<X> for X { }
fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
fn main() {
eq::< for<'a> Foo<(&'a int,), &'a int>,

View File

@ -21,9 +21,9 @@ trait Foo<'a,T,U> {
fn dummy(&'a self) -> &'a (T,U);
}
trait Eq<Sized? X> for Sized? { }
impl<Sized? X> Eq<X> for X { }
fn eq<Sized? A,Sized? B:Eq<A>>() { }
trait Eq<X: ?Sized> for Sized? { }
impl<X: ?Sized> Eq<X> for X { }
fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
fn same_type<A,B:Eq<A>>(a: A, b: B) { }

View File

@ -9,5 +9,5 @@
// except according to those terms.
fn bar<T: Sized>() { }
fn foo<Sized? T>() { bar::<T>() } //~ ERROR the trait `core::kinds::Sized` is not implemented
fn foo<T: ?Sized>() { bar::<T>() } //~ ERROR the trait `core::kinds::Sized` is not implemented
fn main() { }

View File

@ -10,18 +10,18 @@
fn is_sized<T:Sized>() { }
fn not_sized<Sized? T>() { }
fn not_sized<T: ?Sized>() { }
enum Foo<U> { FooSome(U), FooNone }
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
fn foo2<Sized? T>() { not_sized::<Foo<T>>() }
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//
// Not OK: `T` is not sized.
enum Bar<Sized? U> { BarSome(U), BarNone }
fn bar1<Sized? T>() { not_sized::<Bar<T>>() }
fn bar2<Sized? T>() { is_sized::<Bar<T>>() }
enum Bar<U: ?Sized> { BarSome(U), BarNone }
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//
// Not OK: `Bar<T>` is not sized, but it should be.

View File

@ -14,7 +14,7 @@
struct S5<Y>;
impl<Sized? X> S5<X> { //~ ERROR not implemented
impl<X: ?Sized> S5<X> { //~ ERROR not implemented
}
fn main() { }

View File

@ -10,18 +10,18 @@
fn is_sized<T:Sized>() { }
fn not_sized<Sized? T>() { }
fn not_sized<T: ?Sized>() { }
struct Foo<T> { data: T }
fn foo1<T>() { not_sized::<Foo<T>>() } // Hunky dory.
fn foo2<Sized? T>() { not_sized::<Foo<T>>() }
fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//
// Not OK: `T` is not sized.
struct Bar<Sized? T> { data: T }
fn bar1<Sized? T>() { not_sized::<Bar<T>>() }
fn bar2<Sized? T>() { is_sized::<Bar<T>>() }
struct Bar<T: ?Sized> { data: T }
fn bar1<T: ?Sized>() { not_sized::<Bar<T>>() }
fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
//~^ ERROR the trait `core::kinds::Sized` is not implemented
//
// Not OK: `Bar<T>` is not sized, but it should be.

View File

@ -11,12 +11,12 @@
// Test sized-ness checking in substitution in impls.
// impl - struct
trait T3<Sized? Z> {
trait T3<Z: ?Sized> {
}
struct S5<Y>;
impl<Sized? X> T3<X> for S5<X> { //~ ERROR not implemented
impl<X: ?Sized> T3<X> for S5<X> { //~ ERROR not implemented
}
fn main() { }

View File

@ -13,8 +13,8 @@
// impl - unbounded
trait T2<Z> {
}
struct S4<Sized? Y>;
impl<Sized? X> T2<X> for S4<X> {
struct S4<Y: ?Sized>;
impl<X: ?Sized> T2<X> for S4<X> {
//~^ ERROR `core::kinds::Sized` is not implemented for the type `X`
}

View File

@ -12,7 +12,7 @@
// Unbounded.
fn f1<Sized? X>(x: &X) {
fn f1<X: ?Sized>(x: &X) {
f2::<X>(x);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
@ -21,7 +21,7 @@ fn f2<X>(x: &X) {
// Bounded.
trait T for Sized? {}
fn f3<Sized? X: T>(x: &X) {
fn f3<X: ?Sized + T>(x: &X) {
f4::<X>(x);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
@ -29,13 +29,13 @@ fn f4<X: T>(x: &X) {
}
// Test with unsized enum.
enum E<Sized? X> {
enum E<X: ?Sized> {
V(X),
}
fn f5<Y>(x: &Y) {}
fn f6<Sized? X>(x: &X) {}
fn f7<Sized? X>(x1: &E<X>, x2: &E<X>) {
fn f6<X: ?Sized>(x: &X) {}
fn f7<X: ?Sized>(x1: &E<X>, x2: &E<X>) {
f5(x1);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
f6(x2); // ok
@ -43,23 +43,23 @@ fn f7<Sized? X>(x1: &E<X>, x2: &E<X>) {
// Test with unsized struct.
struct S<Sized? X> {
struct S<X: ?Sized> {
x: X,
}
fn f8<Sized? X>(x1: &S<X>, x2: &S<X>) {
fn f8<X: ?Sized>(x1: &S<X>, x2: &S<X>) {
f5(x1);
//~^ ERROR the trait `core::kinds::Sized` is not implemented
f6(x2); // ok
}
// Test some tuples.
fn f9<Sized? X>(x1: Box<S<X>>, x2: Box<E<X>>) {
fn f9<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
f5(&(*x1, 34i));
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}
fn f10<Sized? X>(x1: Box<S<X>>, x2: Box<E<X>>) {
fn f10<X: ?Sized>(x1: Box<S<X>>, x2: Box<E<X>>) {
f5(&(32i, *x2));
//~^ ERROR the trait `core::kinds::Sized` is not implemented
}

View File

@ -11,7 +11,7 @@
// Test that bounds are sized-compatible.
trait T : Sized {}
fn f<Sized? Y: T>() {
fn f<Y: ?Sized + T>() {
//~^ERROR incompatible bounds on `Y`, bound `T` does not allow unsized type
}

View File

@ -10,11 +10,11 @@
// Test `Sized?` types not allowed in fields (except the last one).
struct S1<Sized? X> {
struct S1<X: ?Sized> {
f1: X, //~ ERROR `core::kinds::Sized` is not implemented
f2: int,
}
struct S2<Sized? X> {
struct S2<X: ?Sized> {
f: int,
g: X, //~ ERROR `core::kinds::Sized` is not implemented
h: int,
@ -27,10 +27,10 @@ struct S4 {
f: str, //~ ERROR `core::kinds::Sized` is not implemented
g: uint
}
enum E<Sized? X> {
enum E<X: ?Sized> {
V1(X, int), //~ERROR `core::kinds::Sized` is not implemented
}
enum F<Sized? X> {
enum F<X: ?Sized> {
V2{f1: X, f: int}, //~ERROR `core::kinds::Sized` is not implemented
}

View File

@ -13,30 +13,30 @@
trait T for Sized? {}
fn f1<Sized? X>(x: &X) {
fn f1<X: ?Sized>(x: &X) {
let _: X; // <-- this is OK, no bindings created, no initializer.
let _: (int, (X, int)); // same
let y: X; //~ERROR the trait `core::kinds::Sized` is not implemented
let y: (int, (X, int)); //~ERROR the trait `core::kinds::Sized` is not implemented
}
fn f2<Sized? X: T>(x: &X) {
fn f2<X: ?Sized + T>(x: &X) {
let y: X; //~ERROR the trait `core::kinds::Sized` is not implemented
let y: (int, (X, int)); //~ERROR the trait `core::kinds::Sized` is not implemented
}
fn f3<Sized? X>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
fn f3<X: ?Sized>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
let y: X = *x1; //~ERROR the trait `core::kinds::Sized` is not implemented
let y = *x2; //~ERROR the trait `core::kinds::Sized` is not implemented
let (y, z) = (*x3, 4i); //~ERROR the trait `core::kinds::Sized` is not implemented
}
fn f4<Sized? X: T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
fn f4<X: ?Sized + T>(x1: Box<X>, x2: Box<X>, x3: Box<X>) {
let y: X = *x1; //~ERROR the trait `core::kinds::Sized` is not implemented
let y = *x2; //~ERROR the trait `core::kinds::Sized` is not implemented
let (y, z) = (*x3, 4i); //~ERROR the trait `core::kinds::Sized` is not implemented
}
fn g1<Sized? X>(x: X) {} //~ERROR the trait `core::kinds::Sized` is not implemented
fn g2<Sized? X: T>(x: X) {} //~ERROR the trait `core::kinds::Sized` is not implemented
fn g1<X: ?Sized>(x: X) {} //~ERROR the trait `core::kinds::Sized` is not implemented
fn g2<X: ?Sized + T>(x: X) {} //~ERROR the trait `core::kinds::Sized` is not implemented
pub fn main() {
}

View File

@ -16,8 +16,8 @@ trait T for Sized? {}
// impl - bounded
trait T1<Z: T> {
}
struct S3<Sized? Y>;
impl<Sized? X: T> T1<X> for S3<X> {
struct S3<Y: ?Sized>;
impl<X: ?Sized + T> T1<X> for S3<X> {
//~^ ERROR `core::kinds::Sized` is not implemented for the type `X`
}

View File

@ -20,7 +20,7 @@ impl Drop for Foo {
trait Trait {}
impl Trait for Foo {}
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
f: T
}

View File

@ -17,7 +17,7 @@ impl Drop for Foo {
}
}
struct Fat<Sized? T> {
struct Fat<T: ?Sized> {
f: T
}

View File

@ -18,7 +18,7 @@
use std::ops::Deref;
pub trait MyEq<Sized? U=Self> for Sized? {
pub trait MyEq<U: ?Sized=Self> for Sized? {
fn eq(&self, u: &U) -> bool;
}

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub trait Borrow<Sized? Borrowed> {
pub trait Borrow<Borrowed: ?Sized> {
fn borrow(&self) -> &Borrowed;
}