mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
Update rustc to 00b112c45a604fa6f4b59af2a40c9deeadfdb7c6/rustc-1.0.0-dev.
This commit is contained in:
parent
ff8cbff810
commit
95fc29fa0d
255 changed files with 3550 additions and 3362 deletions
|
@ -26,7 +26,7 @@ impl RangeIndex<int> for int {
|
|||
#[macro_export]
|
||||
macro_rules! int_range_index {
|
||||
($(#[$attr:meta])* struct $Self:ident($T:ty)) => (
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Copy)]
|
||||
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Copy)]
|
||||
$(#[$attr])*
|
||||
pub struct $Self(pub $T);
|
||||
|
||||
|
@ -74,37 +74,39 @@ macro_rules! int_range_index {
|
|||
}
|
||||
}
|
||||
|
||||
impl Add<$Self, $Self> for $Self {
|
||||
impl Add<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
|
||||
#[inline]
|
||||
fn add(&self, other: &$Self) -> $Self {
|
||||
fn add(self, other: $Self) -> $Self {
|
||||
$Self(self.get() + other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl Sub<$Self, $Self> for $Self {
|
||||
impl Sub<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
|
||||
#[inline]
|
||||
fn sub(&self, other: &$Self) -> $Self {
|
||||
fn sub(self, other: $Self) -> $Self {
|
||||
$Self(self.get() - other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<$Self, $Self> for $Self {
|
||||
impl Mul<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
|
||||
#[inline]
|
||||
fn mul(&self, other: &$Self) -> $Self {
|
||||
fn mul(self, other: $Self) -> $Self {
|
||||
$Self(self.get() * other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl Neg<$Self> for $Self {
|
||||
#[inline]
|
||||
fn neg(&self) -> $Self {
|
||||
$Self(-self.get())
|
||||
}
|
||||
}
|
||||
impl Neg for $Self {
|
||||
type Output = $Self;
|
||||
|
||||
impl ::std::num::One for $Self {
|
||||
fn one() -> $Self {
|
||||
$Self(1)
|
||||
#[inline]
|
||||
fn neg(self) -> $Self {
|
||||
$Self(-self.get())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,66 +126,75 @@ macro_rules! int_range_index {
|
|||
}
|
||||
}
|
||||
|
||||
impl Div<$Self, $Self> for $Self {
|
||||
fn div(&self, other: &$Self) -> $Self {
|
||||
impl Div<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
fn div(self, other: $Self) -> $Self {
|
||||
$Self(self.get() / other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl Rem<$Self, $Self> for $Self {
|
||||
fn rem(&self, other: &$Self) -> $Self {
|
||||
impl Rem<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
fn rem(self, other: $Self) -> $Self {
|
||||
$Self(self.get() % other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl Not<$Self> for $Self {
|
||||
fn not(&self) -> $Self {
|
||||
impl Not for $Self {
|
||||
type Output = $Self;
|
||||
fn not(self) -> $Self {
|
||||
$Self(!self.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl BitAnd<$Self, $Self> for $Self {
|
||||
fn bitand(&self, other: &$Self) -> $Self {
|
||||
impl BitAnd<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
fn bitand(self, other: $Self) -> $Self {
|
||||
$Self(self.get() & other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl BitOr<$Self, $Self> for $Self {
|
||||
fn bitor(&self, other: &$Self) -> $Self {
|
||||
impl BitOr<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
fn bitor(self, other: $Self) -> $Self {
|
||||
$Self(self.get() | other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl BitXor<$Self, $Self> for $Self {
|
||||
fn bitxor(&self, other: &$Self) -> $Self {
|
||||
impl BitXor<$Self> for $Self {
|
||||
type Output = $Self;
|
||||
fn bitxor(self, other: $Self) -> $Self {
|
||||
$Self(self.get() ^ other.get())
|
||||
}
|
||||
}
|
||||
|
||||
impl Shl<uint, $Self> for $Self {
|
||||
fn shl(&self, n: &uint) -> $Self {
|
||||
$Self(self.get() << *n)
|
||||
impl Shl<uint> for $Self {
|
||||
type Output = $Self;
|
||||
fn shl(self, n: uint) -> $Self {
|
||||
$Self(self.get() << n)
|
||||
}
|
||||
}
|
||||
|
||||
impl Shr<uint, $Self> for $Self {
|
||||
fn shr(&self, n: &uint) -> $Self {
|
||||
$Self(self.get() >> *n)
|
||||
impl Shr<uint> for $Self {
|
||||
type Output = $Self;
|
||||
fn shr(self, n: uint) -> $Self {
|
||||
$Self(self.get() >> n)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
/// A range of indices
|
||||
#[deriving(Clone, Encodable, Copy)]
|
||||
#[derive(Clone, RustcEncodable, Copy)]
|
||||
pub struct Range<I> {
|
||||
begin: I,
|
||||
length: I,
|
||||
}
|
||||
|
||||
#[old_impl_check]
|
||||
impl<I: RangeIndex<T>, T> fmt::Show for Range<I> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "[{} .. {})", self.begin(), self.end())
|
||||
write!(f, "[{:?} .. {:?})", self.begin(), self.end())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -196,7 +207,9 @@ pub fn each_index<T: Int, I: RangeIndex<T>>(start: I, stop: I) -> EachIndex<T, I
|
|||
EachIndex { it: iter::range(start.get(), stop.get()) }
|
||||
}
|
||||
|
||||
impl<T: Int, I: RangeIndex<T>> Iterator<I> for EachIndex<T, I> {
|
||||
impl<T: Int, I: RangeIndex<T>> Iterator for EachIndex<T, I> {
|
||||
type Item = I;
|
||||
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<I> {
|
||||
self.it.next().map(|i| RangeIndex::new(i))
|
||||
|
@ -208,6 +221,7 @@ impl<T: Int, I: RangeIndex<T>> Iterator<I> for EachIndex<T, I> {
|
|||
}
|
||||
}
|
||||
|
||||
#[old_impl_check]
|
||||
impl<I: RangeIndex<T>, T> Range<I> {
|
||||
/// Create a new range from beginning and length offsets. This could be
|
||||
/// denoted as `[begin, begin + length)`.
|
||||
|
@ -345,6 +359,7 @@ impl<I: RangeIndex<T>, T> Range<I> {
|
|||
}
|
||||
|
||||
/// Methods for `Range`s with indices based on integer values
|
||||
#[old_impl_check]
|
||||
impl<T: Int, I: RangeIndex<T>> Range<I> {
|
||||
/// Returns an iterater that increments over `[begin, end)`.
|
||||
#[inline]
|
||||
|
@ -363,8 +378,9 @@ impl<T: Int, I: RangeIndex<T>> Range<I> {
|
|||
&& self.length() <= len
|
||||
},
|
||||
None => {
|
||||
debug!("Range<T>::is_valid_for_string: string length (len={}) is longer than the \
|
||||
max value for the range index (max={})", s_len,
|
||||
debug!("Range<T>::is_valid_for_string: string length \
|
||||
(len={:?}) is longer than the max value for the range \
|
||||
index (max={:?})", s_len,
|
||||
{
|
||||
let max: T = Int::max_value();
|
||||
let val: I = RangeIndex::new(max);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue