auto merge of #5416 : Ms2ger/servo/int, r=jdm

This commit is contained in:
bors-servo 2015-03-28 13:58:02 -06:00
commit 674e52afa1
17 changed files with 64 additions and 70 deletions

View file

@ -192,7 +192,7 @@ fn test_lru_cache() {
let four = Cell::new("four");
// Test normal insertion.
let mut cache: LRUCache<uint,Cell<&str>> = LRUCache::new(2); // (_, _) (cache is empty)
let mut cache: LRUCache<usize,Cell<&str>> = LRUCache::new(2); // (_, _) (cache is empty)
cache.insert(1, one); // (1, _)
cache.insert(2, two); // (1, 2)
cache.insert(3, three); // (2, 3)

View file

@ -8,7 +8,6 @@
#![feature(core)]
#![feature(exit_status)]
#![feature(hash)]
#![feature(int_uint)]
#![feature(io)]
#![feature(optin_builtin_traits)]
#![feature(path)]

View file

@ -16,13 +16,13 @@ pub trait RangeIndex: Int + fmt::Debug {
fn get(self) -> Self::Index;
}
impl RangeIndex for int {
type Index = int;
impl RangeIndex for isize {
type Index = isize;
#[inline]
fn new(x: int) -> int { x }
fn new(x: isize) -> isize { x }
#[inline]
fn get(self) -> int { self }
fn get(self) -> isize { self }
}
/// Implements a range index type with operator overloads
@ -35,8 +35,8 @@ macro_rules! int_range_index {
impl $Self_ {
#[inline]
pub fn to_uint(self) -> uint {
self.get() as uint
pub fn to_usize(self) -> usize {
self.get() as usize
}
}
@ -172,16 +172,16 @@ macro_rules! int_range_index {
}
}
impl Shl<uint> for $Self_ {
impl Shl<usize> for $Self_ {
type Output = $Self_;
fn shl(self, n: uint) -> $Self_ {
fn shl(self, n: usize) -> $Self_ {
$Self_(self.get() << n)
}
}
impl Shr<uint> for $Self_ {
impl Shr<usize> for $Self_ {
type Output = $Self_;
fn shr(self, n: uint) -> $Self_ {
fn shr(self, n: usize) -> $Self_ {
$Self_(self.get() >> n)
}
}
@ -247,7 +247,7 @@ impl<T: Int, I: RangeIndex<Index=T>> Iterator for EachIndex<T, I> {
}
#[inline]
fn size_hint(&self) -> (uint, Option<uint>) {
fn size_hint(&self) -> (usize, Option<usize>) {
self.it.size_hint()
}
}
@ -399,7 +399,7 @@ impl<T: Int, I: RangeIndex<Index=T>> Range<I> {
#[inline]
pub fn is_valid_for_string(&self, s: &str) -> bool {
let s_len = s.len();
match num::cast::<uint, T>(s_len) {
match num::cast::<usize, T>(s_len) {
Some(len) => {
let len = RangeIndex::new(len);
self.begin() < len