Update compile fail tests to use usize.
This commit is contained in:
parent
0c70ce1424
commit
85f961e2cc
162 changed files with 325 additions and 325 deletions
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct cat {
|
||||
meows : uint,
|
||||
meows : usize,
|
||||
|
||||
how_hungry : isize,
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ impl cat {
|
|||
pub fn speak(&self) { self.meows += 1u; }
|
||||
}
|
||||
|
||||
fn cat(in_x : uint, in_y : isize) -> cat {
|
||||
fn cat(in_x : usize, in_y : isize) -> cat {
|
||||
cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y
|
||||
|
|
|
@ -19,8 +19,8 @@ pub trait Foo {
|
|||
struct Bar;
|
||||
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
fn boo(&self) -> uint { 42 }
|
||||
type A = usize;
|
||||
fn boo(&self) -> usize { 42 }
|
||||
}
|
||||
|
||||
fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
|
||||
|
|
|
@ -19,8 +19,8 @@ pub trait Foo {
|
|||
struct Bar;
|
||||
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
fn boo(&self) -> uint {
|
||||
type A = usize;
|
||||
fn boo(&self) -> usize {
|
||||
42
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,11 +16,11 @@ trait Foo {
|
|||
}
|
||||
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
type A = usize;
|
||||
fn bar() -> isize { 42 }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x: isize = Foo::<A=uint>::bar();
|
||||
let x: isize = Foo::<A=usize>::bar();
|
||||
//~^ERROR unexpected binding of associated item in expression path
|
||||
}
|
||||
|
|
|
@ -33,9 +33,9 @@ struct UintStruct {
|
|||
}
|
||||
|
||||
impl<'a> TheTrait<&'a isize> for UintStruct {
|
||||
type A = &'a uint;
|
||||
type A = &'a usize;
|
||||
|
||||
fn get(&self, t: &'a isize) -> &'a uint {
|
||||
fn get(&self, t: &'a isize) -> &'a usize {
|
||||
panic!()
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ fn foo<T>()
|
|||
}
|
||||
|
||||
fn bar<T>()
|
||||
where T : for<'x> TheTrait<&'x isize, A = &'x uint>
|
||||
where T : for<'x> TheTrait<&'x isize, A = &'x usize>
|
||||
{
|
||||
// ok for UintStruct, but not IntStruct
|
||||
}
|
||||
|
|
|
@ -20,17 +20,17 @@ pub trait Foo {
|
|||
struct Bar;
|
||||
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
type A = usize;
|
||||
type B = char;
|
||||
fn boo(&self) -> uint {
|
||||
fn boo(&self) -> usize {
|
||||
42
|
||||
}
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let a = &42i as &Foo<A=uint, B=char>;
|
||||
let a = &42i as &Foo<A=usize, B=char>;
|
||||
|
||||
let b = &42i as &Foo<A=uint>;
|
||||
let b = &42i as &Foo<A=usize>;
|
||||
//~^ ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
|
||||
|
||||
let c = &42i as &Foo<B=char>;
|
||||
|
|
|
@ -15,7 +15,7 @@ pub trait Foo {
|
|||
}
|
||||
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
type A = usize;
|
||||
}
|
||||
|
||||
pub fn f1<T: Foo>(a: T, x: T::A) {}
|
||||
|
|
|
@ -16,7 +16,7 @@ trait Foo {
|
|||
}
|
||||
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
type A = usize;
|
||||
fn bar() -> isize { 42 }
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
|
||||
fn bad_bang(i: uint) -> ! {
|
||||
fn bad_bang(i: usize) -> ! {
|
||||
return 7u; //~ ERROR `return` in a function declared as diverging [E0166]
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Tests that a function with a ! annotation always actually fails
|
||||
|
||||
fn bad_bang(i: uint) -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||
fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging
|
||||
if i < 0u { } else { panic!(); }
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ trait bar {
|
|||
fn bar<T:Send>(&self);
|
||||
}
|
||||
|
||||
impl bar for uint {
|
||||
impl bar for usize {
|
||||
fn bar<T:Send>(&self) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// Tests that we can't assign to or mutably borrow upvars from `Fn`
|
||||
// closures (issue #17780)
|
||||
|
||||
fn set(x: &mut uint) { *x = 5; }
|
||||
fn set(x: &mut usize) { *x = 5; }
|
||||
|
||||
fn main() {
|
||||
// By-ref captures
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// Tests that we are able to distinguish when loans borrow different
|
||||
// anonymous fields of a tuple vs the same anonymous field.
|
||||
|
||||
struct Y(uint, uint);
|
||||
struct Y(usize, usize);
|
||||
|
||||
fn distinct_variant() {
|
||||
let mut y = Y(1, 2);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// anonymous fields of an enum variant vs the same anonymous field.
|
||||
|
||||
enum Foo {
|
||||
X, Y(uint, uint)
|
||||
X, Y(usize, usize)
|
||||
}
|
||||
|
||||
fn distinct_variant() {
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
|
||||
struct X(Either<(uint,uint), fn()>);
|
||||
struct X(Either<(usize,usize), fn()>);
|
||||
|
||||
impl X {
|
||||
pub fn with<F>(&self, blk: F) where F: FnOnce(&Either<(uint, uint), fn()>) {
|
||||
pub fn with<F>(&self, blk: F) where F: FnOnce(&Either<(usize, usize), fn()>) {
|
||||
let X(ref e) = *self;
|
||||
blk(e)
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
fn rewrite(v: &mut Box<uint>) -> uint {
|
||||
fn rewrite(v: &mut Box<usize>) -> usize {
|
||||
*v = box 22;
|
||||
**v
|
||||
}
|
||||
|
||||
fn add(v: &uint, w: uint) -> uint {
|
||||
fn add(v: &usize, w: usize) -> usize {
|
||||
*v + w
|
||||
}
|
||||
|
||||
|
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
fn rewrite(v: &mut Box<uint>) -> uint {
|
||||
fn rewrite(v: &mut Box<usize>) -> usize {
|
||||
*v = box 22;
|
||||
**v
|
||||
}
|
||||
|
||||
fn add(v: &uint, w: Box<uint>) -> uint {
|
||||
fn add(v: &usize, w: Box<usize>) -> usize {
|
||||
*v + *w
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ extern crate collections;
|
|||
use std::collections::HashMap;
|
||||
|
||||
fn main() {
|
||||
let mut buggy_map: HashMap<uint, &uint> = HashMap::new();
|
||||
let mut buggy_map: HashMap<usize, &usize> = HashMap::new();
|
||||
buggy_map.insert(42, &*box 1); //~ ERROR borrowed value does not live long enough
|
||||
|
||||
// but it is ok if we use a temporary
|
||||
|
|
|
@ -113,8 +113,8 @@ fn while_aliased_mut_cond(cond: bool, cond2: bool) {
|
|||
}
|
||||
}
|
||||
|
||||
fn loop_break_pops_scopes<'r, F>(_v: &'r mut [uint], mut f: F) where
|
||||
F: FnMut(&'r mut uint) -> bool,
|
||||
fn loop_break_pops_scopes<'r, F>(_v: &'r mut [usize], mut f: F) where
|
||||
F: FnMut(&'r mut usize) -> bool,
|
||||
{
|
||||
// Here we check that when you break out of an inner loop, the
|
||||
// borrows that go out of scope as you exit the inner loop are
|
||||
|
@ -123,7 +123,7 @@ fn loop_break_pops_scopes<'r, F>(_v: &'r mut [uint], mut f: F) where
|
|||
while cond() {
|
||||
while cond() {
|
||||
// this borrow is limited to the scope of `r`...
|
||||
let r: &'r mut uint = produce();
|
||||
let r: &'r mut usize = produce();
|
||||
if !f(&mut *r) {
|
||||
break; // ...so it is not live as exit the `while` loop here
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ fn loop_break_pops_scopes<'r, F>(_v: &'r mut [uint], mut f: F) where
|
|||
}
|
||||
}
|
||||
|
||||
fn loop_loop_pops_scopes<'r, F>(_v: &'r mut [uint], mut f: F) where F: FnMut(&'r mut uint) -> bool {
|
||||
fn loop_loop_pops_scopes<'r, F>(_v: &'r mut [usize], mut f: F) where F: FnMut(&'r mut usize) -> bool {
|
||||
// Similar to `loop_break_pops_scopes` but for the `loop` keyword
|
||||
|
||||
while cond() {
|
||||
while cond() {
|
||||
// this borrow is limited to the scope of `r`...
|
||||
let r: &'r mut uint = produce();
|
||||
let r: &'r mut usize = produce();
|
||||
if !f(&mut *r) {
|
||||
continue; // ...so it is not live as exit (and re-enter) the `while` loop here
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
use std::ops::Add;
|
||||
|
||||
#[derive(Clone)]
|
||||
struct foo(Box<uint>);
|
||||
struct foo(Box<usize>);
|
||||
|
||||
impl Add for foo {
|
||||
type Output = foo;
|
||||
|
|
|
@ -38,8 +38,8 @@ struct SFnOnce {
|
|||
x: String,
|
||||
}
|
||||
|
||||
impl FnOnce<(String,),uint> for SFnOnce {
|
||||
extern "rust-call" fn call_once(self, (z,): (String,)) -> uint {
|
||||
impl FnOnce<(String,),usize> for SFnOnce {
|
||||
extern "rust-call" fn call_once(self, (z,): (String,)) -> usize {
|
||||
self.x.len() + z.len()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,10 +16,10 @@ struct MyVec<T> {
|
|||
data: Vec<T>,
|
||||
}
|
||||
|
||||
impl<T> Index<uint> for MyVec<T> {
|
||||
impl<T> Index<usize> for MyVec<T> {
|
||||
type Output = T;
|
||||
|
||||
fn index(&self, &i: &uint) -> &T {
|
||||
fn index(&self, &i: &usize) -> &T {
|
||||
&self.data[i]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ trait noisy {
|
|||
}
|
||||
|
||||
struct cat {
|
||||
meows : uint,
|
||||
meows : usize,
|
||||
|
||||
how_hungry : isize,
|
||||
name : String,
|
||||
|
@ -50,7 +50,7 @@ impl cat {
|
|||
}
|
||||
}
|
||||
|
||||
fn cat(in_x : uint, in_y : isize, in_name: String) -> cat {
|
||||
fn cat(in_x : usize, in_y : isize, in_name: String) -> cat {
|
||||
cat {
|
||||
meows: in_x,
|
||||
how_hungry: in_y,
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
// error-pattern:nonexistent
|
||||
class cat : nonexistent {
|
||||
let meows: uint;
|
||||
new(in_x : uint) { self.meows = in_x; }
|
||||
let meows: usize;
|
||||
new(in_x : usize) { self.meows = in_x; }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -13,14 +13,14 @@ trait animal {
|
|||
}
|
||||
|
||||
struct cat {
|
||||
meows: uint,
|
||||
meows: usize,
|
||||
}
|
||||
|
||||
impl animal for cat {
|
||||
//~^ ERROR not all trait items implemented, missing: `eat`
|
||||
}
|
||||
|
||||
fn cat(in_x : uint) -> cat {
|
||||
fn cat(in_x : usize) -> cat {
|
||||
cat {
|
||||
meows: in_x
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct cat {
|
||||
meows : uint,
|
||||
meows : usize,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::default::Default;
|
|||
// for the same type (though this crate doesn't).
|
||||
|
||||
trait MyTrait {
|
||||
fn get(&self) -> uint;
|
||||
fn get(&self) -> usize;
|
||||
}
|
||||
|
||||
trait Even { }
|
||||
|
@ -25,14 +25,14 @@ trait Odd { }
|
|||
|
||||
impl Even for isize { }
|
||||
|
||||
impl Odd for uint { }
|
||||
impl Odd for usize { }
|
||||
|
||||
impl<T:Even> MyTrait for T { //~ ERROR E0119
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
impl<T:Odd> MyTrait for T {
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -16,7 +16,7 @@ use std::default::Default;
|
|||
// for the same type (though this crate doesn't implement them at all).
|
||||
|
||||
trait MyTrait {
|
||||
fn get(&self) -> uint;
|
||||
fn get(&self) -> usize;
|
||||
}
|
||||
|
||||
trait Even { }
|
||||
|
@ -24,11 +24,11 @@ trait Even { }
|
|||
trait Odd { }
|
||||
|
||||
impl<T:Even> MyTrait for T { //~ ERROR E0119
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
impl<T:Odd> MyTrait for T {
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -26,11 +26,11 @@ impl<T> MyTrait<T> for T { //~ ERROR E0119
|
|||
|
||||
#[derive(Clone)]
|
||||
struct MyType {
|
||||
dummy: uint
|
||||
dummy: usize
|
||||
}
|
||||
|
||||
impl MyTrait<MyType> for MyType {
|
||||
fn get(&self) -> uint { (*self).clone() }
|
||||
fn get(&self) -> usize { (*self).clone() }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -16,19 +16,19 @@ trait OtherTrait {
|
|||
}
|
||||
|
||||
trait MyTrait {
|
||||
fn get(&self) -> uint;
|
||||
fn get(&self) -> usize;
|
||||
}
|
||||
|
||||
impl<T:OtherTrait> MyTrait for T { //~ ERROR E0119
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
struct MyType {
|
||||
dummy: uint
|
||||
dummy: usize
|
||||
}
|
||||
|
||||
impl MyTrait for MyType {
|
||||
fn get(&self) -> uint { self.dummy }
|
||||
fn get(&self) -> usize { self.dummy }
|
||||
}
|
||||
|
||||
impl OtherTrait for MyType {
|
||||
|
|
|
@ -15,19 +15,19 @@ use std::default::Default;
|
|||
// specific T.
|
||||
|
||||
trait MyTrait {
|
||||
fn get(&self) -> uint;
|
||||
fn get(&self) -> usize;
|
||||
}
|
||||
|
||||
impl<T> MyTrait for T { //~ ERROR E0119
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
struct MyType {
|
||||
dummy: uint
|
||||
dummy: usize
|
||||
}
|
||||
|
||||
impl MyTrait for MyType {
|
||||
fn get(&self) -> uint { self.dummy }
|
||||
fn get(&self) -> usize { self.dummy }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -16,7 +16,7 @@ use lib::TheTrait;
|
|||
|
||||
struct TheType;
|
||||
|
||||
impl TheTrait<uint> for isize { } //~ ERROR E0117
|
||||
impl TheTrait<usize> for isize { } //~ ERROR E0117
|
||||
|
||||
impl TheTrait<TheType> for isize { } //~ ERROR E0117
|
||||
|
||||
|
|
|
@ -15,15 +15,15 @@ use std::default::Default;
|
|||
// specific T.
|
||||
|
||||
trait MyTrait {
|
||||
fn get(&self) -> uint;
|
||||
fn get(&self) -> usize;
|
||||
}
|
||||
|
||||
impl<T> MyTrait for (T,T) { //~ ERROR E0119
|
||||
fn get(&self) -> uint { 0 }
|
||||
fn get(&self) -> usize { 0 }
|
||||
}
|
||||
|
||||
impl<A,B> MyTrait for (A,B) {
|
||||
fn get(&self) -> uint { self.dummy }
|
||||
fn get(&self) -> usize { self.dummy }
|
||||
}
|
||||
|
||||
fn main() { }
|
||||
|
|
|
@ -8,18 +8,18 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static A: uint = { 1u; 2 };
|
||||
static A: usize = { 1u; 2 };
|
||||
//~^ ERROR: blocks in constants are limited to items and tail expressions
|
||||
|
||||
static B: uint = { { } 2 };
|
||||
static B: usize = { { } 2 };
|
||||
//~^ ERROR: blocks in constants are limited to items and tail expressions
|
||||
|
||||
macro_rules! foo {
|
||||
() => (()) //~ ERROR: blocks in constants are limited to items and tail expressions
|
||||
}
|
||||
static C: uint = { foo!(); 2 };
|
||||
static C: usize = { foo!(); 2 };
|
||||
|
||||
static D: uint = { let x = 4u; 2 };
|
||||
static D: usize = { let x = 4u; 2 };
|
||||
//~^ ERROR: blocks in constants are limited to items and tail expressions
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
@ -22,10 +22,10 @@ impl S { }
|
|||
impl T for S { }
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
static s: uint = 0u;
|
||||
static s: usize = 0u;
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
const c: uint = 0u;
|
||||
const c: usize = 0u;
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
mod m { }
|
||||
|
@ -34,7 +34,7 @@ mod m { }
|
|||
extern "C" { }
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
type A = uint;
|
||||
type A = usize;
|
||||
|
||||
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||
fn main() { }
|
||||
|
|
|
@ -22,7 +22,7 @@ struct B(isize);
|
|||
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
||||
|
||||
#[derive(FromPrimitive)]
|
||||
enum C { Foo(isize), Bar(uint) }
|
||||
enum C { Foo(isize), Bar(usize) }
|
||||
//~^^ ERROR `FromPrimitive` cannot be derived for enum variants with arguments
|
||||
//~^^^ ERROR `FromPrimitive` cannot be derived for enum variants with arguments
|
||||
|
||||
|
|
|
@ -18,10 +18,10 @@ struct S;
|
|||
|
||||
impl Copy for S {}
|
||||
|
||||
impl Index<uint> for S {
|
||||
impl Index<usize> for S {
|
||||
type Output = str;
|
||||
|
||||
fn index<'a>(&'a self, _: &uint) -> &'a str {
|
||||
fn index<'a>(&'a self, _: &usize) -> &'a str {
|
||||
"hello"
|
||||
}
|
||||
}
|
||||
|
@ -30,11 +30,11 @@ struct T;
|
|||
|
||||
impl Copy for T {}
|
||||
|
||||
impl Index<uint> for T {
|
||||
impl Index<usize> for T {
|
||||
type Output = Show + 'static;
|
||||
|
||||
fn index<'a>(&'a self, idx: &uint) -> &'a (Show + 'static) {
|
||||
static x: uint = 42;
|
||||
fn index<'a>(&'a self, idx: &usize) -> &'a (Show + 'static) {
|
||||
static x: usize = 42;
|
||||
&x
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,6 @@ enum Ei32 {
|
|||
// u64 currently allows negative numbers, and i64 allows numbers greater than `1<<63`. This is a
|
||||
// little counterintuitive, but since the discriminant can store all the bits, and extracting it
|
||||
// with a cast requires specifying the signedness, there is no loss of information in those cases.
|
||||
// This also applies to isize and uint on 64-bit targets.
|
||||
// This also applies to isize and usize on 64-bit targets.
|
||||
|
||||
pub fn main() { }
|
||||
|
|
|
@ -22,10 +22,10 @@ extern "rust-intrinsic" {
|
|||
|
||||
// Bounds aren't checked right now, so this should work
|
||||
// even though it's incorrect.
|
||||
fn size_of<T: Clone>() -> uint;
|
||||
fn size_of<T: Clone>() -> usize;
|
||||
|
||||
// Unresolved bounds should still error.
|
||||
fn align_of<T: NoSuchTrait>() -> uint;
|
||||
fn align_of<T: NoSuchTrait>() -> usize;
|
||||
//~^ ERROR attempt to bound type parameter with a nonexistent trait `NoSuchTrait`
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
mod u {
|
||||
type X = uint; //~ WARN the `uint` type is deprecated
|
||||
type X = usize; //~ WARN the `usize` type is deprecated
|
||||
struct Foo {
|
||||
x: uint //~ WARN the `uint` type is deprecated
|
||||
x: usize //~ WARN the `usize` type is deprecated
|
||||
}
|
||||
fn bar(x: uint) { //~ WARN the `uint` type is deprecated
|
||||
fn bar(x: usize) { //~ WARN the `usize` type is deprecated
|
||||
1u; //~ WARN the `u` suffix on integers is deprecated
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
// ignore-test
|
||||
|
||||
type T1 = uint;
|
||||
type T1 = usize;
|
||||
type T2 = isize;
|
||||
|
||||
fn bar(x: T1) -> T2 {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
struct Foo<'a> {
|
||||
map: HashMap<uint, &'a str>
|
||||
map: HashMap<usize, &'a str>
|
||||
}
|
||||
|
||||
impl<'a> Foo<'a> {
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
// error-pattern: too big for the current
|
||||
|
||||
fn main() {
|
||||
let fat : [u8; (1<<61)+(1<<31)] = [0; (1u64<<61) as uint +(1u64<<31) as uint];
|
||||
let fat : [u8; (1<<61)+(1<<31)] = [0; (1u64<<61) as usize +(1u64<<31) as usize];
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
mod circ1 {
|
||||
pub use circ2::f2;
|
||||
pub fn f1() { println!("f1"); }
|
||||
pub fn common() -> uint { return 0u; }
|
||||
pub fn common() -> usize { return 0u; }
|
||||
}
|
||||
|
||||
mod circ2 {
|
||||
pub use circ1::f1;
|
||||
pub fn f2() { println!("f2"); }
|
||||
pub fn common() -> uint { return 1u; }
|
||||
pub fn common() -> usize { return 1u; }
|
||||
}
|
||||
|
||||
mod test {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Make sure that indexing an array is only valid with a `uint`, not any other
|
||||
// Make sure that indexing an array is only valid with a `usize`, not any other
|
||||
// integral type.
|
||||
|
||||
fn main() {
|
||||
|
@ -16,10 +16,10 @@ fn main() {
|
|||
[0][0u8]; //~ ERROR: the trait `core::ops::Index<u8>` is not implemented
|
||||
//~^ ERROR: the trait `core::ops::Index<u8>` is not implemented
|
||||
|
||||
[0][0]; // should infer to be a uint
|
||||
[0][0]; // should infer to be a usize
|
||||
|
||||
let i = 0; // i is an IntVar
|
||||
[0][i]; // i should be locked to uint
|
||||
[0][i]; // i should be locked to usize
|
||||
bar::<isize>(i); // i should not be re-coerced back to an isize
|
||||
//~^ ERROR: mismatched types
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ trait to_opt {
|
|||
fn to_option(&self) -> Option<Self>;
|
||||
}
|
||||
|
||||
impl to_opt for uint {
|
||||
fn to_option(&self) -> Option<uint> {
|
||||
impl to_opt for usize {
|
||||
fn to_option(&self) -> Option<usize> {
|
||||
Some(*self)
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ impl<T:Clone> to_opt for Option<T> {
|
|||
}
|
||||
}
|
||||
|
||||
fn function<T:to_opt + Clone>(counter: uint, t: T) {
|
||||
fn function<T:to_opt + Clone>(counter: usize, t: T) {
|
||||
if counter > 0u {
|
||||
function(counter - 1u, t.to_option());
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Foo(bool);
|
||||
fn foo(_: uint) -> Foo { Foo(false) }
|
||||
fn foo(_: usize) -> Foo { Foo(false) }
|
||||
|
||||
fn main() {
|
||||
match Foo(true) {
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Obj { //~ NOTE: unclosed delimiter
|
||||
member: uint
|
||||
member: usize
|
||||
) //~ ERROR: incorrect close delimiter
|
||||
|
|
|
@ -18,7 +18,7 @@ extern {
|
|||
//~^ ERROR: patterns aren't allowed in foreign function declarations
|
||||
fn qux((x,y): ());
|
||||
//~^ ERROR: patterns aren't allowed in foreign function declarations
|
||||
fn this_is_actually_ok(a: uint);
|
||||
fn and_so_is_this(_: uint);
|
||||
fn this_is_actually_ok(a: usize);
|
||||
fn and_so_is_this(_: usize);
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
@ -16,6 +16,6 @@ fn main() {
|
|||
foo(1*(1 as isize));
|
||||
//~^ ERROR: mismatched types: expected `i16`, found `isize` (expected i16, found isize)
|
||||
|
||||
bar(1*(1 as uint));
|
||||
bar(1*(1 as usize));
|
||||
//~^ ERROR: mismatched types: expected `u32`, found `usize` (expected u32, found usize)
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// Regression test for issue #1362 - without that fix the span will be bogus
|
||||
// no-reformat
|
||||
fn main() {
|
||||
let x: uint = 20i; //~ ERROR mismatched types
|
||||
let x: usize = 20i; //~ ERROR mismatched types
|
||||
}
|
||||
// NOTE: Do not add any extra lines as the line number the error is
|
||||
// on is significant; an error later in the source file might not
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
fn main() {
|
||||
range(0, 4)
|
||||
.map(|x| x * 2)
|
||||
.collect::<Vec<'a, uint, 'b>>()
|
||||
.collect::<Vec<'a, usize, 'b>>()
|
||||
//~^ ERROR lifetime parameters must be declared prior to type parameters
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Regression test for issue #1448 and #1386
|
||||
|
||||
fn foo(a: uint) -> uint { a }
|
||||
fn foo(a: usize) -> usize { a }
|
||||
|
||||
fn main() {
|
||||
println!("{}", foo(10i)); //~ ERROR mismatched types
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Foo {
|
||||
a: uint,
|
||||
a: usize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub fn foo(params: Option<&[&str]>) -> uint {
|
||||
pub fn foo(params: Option<&[&str]>) -> usize {
|
||||
params.unwrap().first().unwrap().len()
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
fn main() {
|
||||
enum R { REB(()) }
|
||||
struct Tau { t: uint }
|
||||
struct Tau { t: usize }
|
||||
enum E { B(R, Tau) }
|
||||
|
||||
let e = E::B(R::REB(()), Tau { t: 3 });
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
// except according to those terms.
|
||||
|
||||
mod Y {
|
||||
type X = uint;
|
||||
type X = usize;
|
||||
extern {
|
||||
static x: *const uint;
|
||||
static x: *const usize;
|
||||
}
|
||||
fn foo(value: *const X) -> *const X {
|
||||
value
|
||||
|
|
|
@ -15,11 +15,11 @@ struct Col<D, C> {
|
|||
col: C,
|
||||
}
|
||||
|
||||
trait Collection { fn len(&self) -> uint; }
|
||||
trait Collection { fn len(&self) -> usize; }
|
||||
|
||||
impl<T, M: MatrixShape> Collection for Col<M, uint> {
|
||||
impl<T, M: MatrixShape> Collection for Col<M, usize> {
|
||||
//~^ ERROR type parameter `T` is not constrained
|
||||
fn len(&self) -> uint {
|
||||
fn len(&self) -> usize {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ trait ListItem<'a> {
|
|||
fn list_name() -> &'a str;
|
||||
}
|
||||
|
||||
trait Collection { fn len(&self) -> uint; }
|
||||
trait Collection { fn len(&self) -> usize; }
|
||||
|
||||
struct List<'a, T: ListItem<'a>> {
|
||||
//~^ ERROR the parameter type `T` may not live long enough
|
||||
|
@ -22,7 +22,7 @@ struct List<'a, T: ListItem<'a>> {
|
|||
}
|
||||
|
||||
impl<'a, T: ListItem<'a>> Collection for List<'a, T> {
|
||||
fn len(&self) -> uint {
|
||||
fn len(&self) -> usize {
|
||||
0
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static FOO: uint = FOO; //~ ERROR recursive constant
|
||||
static FOO: usize = FOO; //~ ERROR recursive constant
|
||||
|
||||
fn main() {
|
||||
let _x: [u8; FOO]; // caused stack overflow prior to fix
|
||||
let _y: uint = 1 + {
|
||||
static BAR: uint = BAR; //~ ERROR recursive constant
|
||||
let _y: usize = 1 + {
|
||||
static BAR: usize = BAR; //~ ERROR recursive constant
|
||||
let _z: [u8; BAR]; // caused stack overflow prior to fix
|
||||
1
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// within assignments in if expressions.
|
||||
|
||||
struct Foo {
|
||||
foo: uint
|
||||
foo: usize
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static X: uint = 0 as *const uint as uint;
|
||||
static X: usize = 0 as *const usize as usize;
|
||||
//~^ ERROR: can not cast a pointer to an integer in a constant expression
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -8,17 +8,17 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct S { a: uint }
|
||||
struct S { a: usize }
|
||||
static A: S = S { a: 3 };
|
||||
static B: &'static uint = &A.a;
|
||||
static B: &'static usize = &A.a;
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
static C: &'static uint = &(A.a);
|
||||
static C: &'static usize = &(A.a);
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
|
||||
static D: [uint; 1] = [1];
|
||||
static E: uint = D[0];
|
||||
static D: [usize; 1] = [1];
|
||||
static E: usize = D[0];
|
||||
//~^ ERROR: cannot refer to other statics by value
|
||||
static F: &'static uint = &D[0];
|
||||
static F: &'static usize = &D[0];
|
||||
//~^ ERROR: cannot refer to the interior of another static
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -8,11 +8,11 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const C1: &'static mut [uint] = &mut [];
|
||||
const C1: &'static mut [usize] = &mut [];
|
||||
//~^ ERROR: constants are not allowed to have mutable references
|
||||
|
||||
static mut S: uint = 3;
|
||||
const C2: &'static mut uint = &mut S;
|
||||
static mut S: usize = 3;
|
||||
const C2: &'static mut usize = &mut S;
|
||||
//~^ ERROR: constants cannot refer to other statics
|
||||
//~^^ ERROR: are not allowed to have mutable references
|
||||
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
use std::cell::UnsafeCell;
|
||||
|
||||
const A: UnsafeCell<uint> = UnsafeCell { value: 1 };
|
||||
const B: &'static UnsafeCell<uint> = &A;
|
||||
const A: UnsafeCell<usize> = UnsafeCell { value: 1 };
|
||||
const B: &'static UnsafeCell<usize> = &A;
|
||||
//~^ ERROR: cannot borrow a constant which contains interior mutability
|
||||
|
||||
struct C { a: UnsafeCell<uint> }
|
||||
struct C { a: UnsafeCell<usize> }
|
||||
const D: C = C { a: UnsafeCell { value: 1 } };
|
||||
const E: &'static UnsafeCell<uint> = &D.a;
|
||||
const E: &'static UnsafeCell<usize> = &D.a;
|
||||
//~^ ERROR: cannot borrow a constant which contains interior mutability
|
||||
const F: &'static C = &D;
|
||||
//~^ ERROR: cannot borrow a constant which contains interior mutability
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
const
|
||||
mut //~ ERROR: const globals cannot be mutable
|
||||
//~^ HELP did you mean to declare a static?
|
||||
FOO: uint = 3;
|
||||
FOO: usize = 3;
|
||||
|
||||
fn main() {
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use other::{
|
|||
};
|
||||
|
||||
mod a {
|
||||
const B: uint = 3;
|
||||
const B: usize = 3;
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const FOO: uint = 3;
|
||||
const FOO: usize = 3;
|
||||
|
||||
fn foo() -> &'static uint { &FOO }
|
||||
fn foo() -> &'static usize { &FOO }
|
||||
//~^ ERROR: borrowed value does not live long enough
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static A1: uint = 1;
|
||||
static mut A2: uint = 1;
|
||||
const A3: uint = 1;
|
||||
static A1: usize = 1;
|
||||
static mut A2: usize = 1;
|
||||
const A3: usize = 1;
|
||||
|
||||
fn main() {
|
||||
match 1u {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const A: uint = B; //~ ERROR: recursive constant
|
||||
const B: uint = A; //~ ERROR: recursive constant
|
||||
const A: usize = B; //~ ERROR: recursive constant
|
||||
const B: usize = A; //~ ERROR: recursive constant
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -8,21 +8,21 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Struct { a: uint }
|
||||
struct Struct { a: usize }
|
||||
|
||||
const C: uint = 1;
|
||||
static S: uint = 1;
|
||||
const C: usize = 1;
|
||||
static S: usize = 1;
|
||||
|
||||
const T1: &'static uint = &C;
|
||||
const T2: &'static uint = &S; //~ ERROR: constants cannot refer to other statics
|
||||
static T3: &'static uint = &C;
|
||||
static T4: &'static uint = &S;
|
||||
const T1: &'static usize = &C;
|
||||
const T2: &'static usize = &S; //~ ERROR: constants cannot refer to other statics
|
||||
static T3: &'static usize = &C;
|
||||
static T4: &'static usize = &S;
|
||||
|
||||
const T5: uint = C;
|
||||
const T6: uint = S; //~ ERROR: constants cannot refer to other statics
|
||||
const T5: usize = C;
|
||||
const T6: usize = S; //~ ERROR: constants cannot refer to other statics
|
||||
//~^ cannot refer to other statics
|
||||
static T7: uint = C;
|
||||
static T8: uint = S; //~ ERROR: cannot refer to other statics by value
|
||||
static T7: usize = C;
|
||||
static T8: usize = S; //~ ERROR: cannot refer to other statics by value
|
||||
|
||||
const T9: Struct = Struct { a: C };
|
||||
const T10: Struct = Struct { a: S }; //~ ERROR: cannot refer to other statics by value
|
||||
|
|
|
@ -12,7 +12,7 @@ use std::marker;
|
|||
|
||||
struct Foo { marker: marker::NoSync }
|
||||
|
||||
static FOO: uint = 3;
|
||||
static FOO: usize = 3;
|
||||
static BAR: Foo = Foo { marker: marker::NoSync };
|
||||
//~^ ERROR: the trait `core::marker::Sync` is not implemented
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
pub static X: uint = 1u;
|
||||
pub static X: usize = 1u;
|
||||
|
||||
fn main() {
|
||||
match 1u {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
enum Foo {
|
||||
Variant { x: uint }
|
||||
Variant { x: usize }
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
fn main() {
|
||||
const X: u32 = 1;
|
||||
const Y: uint = &X as *const u32 as uint; //~ ERROR E0018
|
||||
const Y: usize = &X as *const u32 as usize; //~ ERROR E0018
|
||||
println!("{}", Y);
|
||||
}
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
|
||||
use std::ops::Deref;
|
||||
|
||||
struct MyPtr<'a>(&'a mut uint);
|
||||
struct MyPtr<'a>(&'a mut usize);
|
||||
impl<'a> Deref for MyPtr<'a> {
|
||||
type Target = uint;
|
||||
type Target = usize;
|
||||
|
||||
fn deref<'b>(&'b self) -> &'b uint { self.0 }
|
||||
fn deref<'b>(&'b self) -> &'b usize { self.0 }
|
||||
}
|
||||
|
||||
trait Tr {
|
||||
fn poke(&self, s: &mut uint);
|
||||
fn poke(&self, s: &mut usize);
|
||||
}
|
||||
|
||||
impl Tr for uint {
|
||||
fn poke(&self, s: &mut uint) {
|
||||
impl Tr for usize {
|
||||
fn poke(&self, s: &mut usize) {
|
||||
*s = 2;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
const TUP: (uint,) = (42,);
|
||||
const TUP: (usize,) = (42,);
|
||||
|
||||
fn main() {
|
||||
let a: [isize; TUP.1];
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct MyStruct { field: uint }
|
||||
struct MyStruct { field: usize }
|
||||
const STRUCT: MyStruct = MyStruct { field: 42 };
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn foo(a: Option<uint>, b: Option<uint>) {
|
||||
fn foo(a: Option<usize>, b: Option<usize>) {
|
||||
match (a,b) {
|
||||
//~^ ERROR: non-exhaustive patterns: `(None, None)` not covered
|
||||
(Some(a), Some(b)) if a == b => { }
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#![allow(unused_variables)]
|
||||
#![allow(dead_code)]
|
||||
|
||||
fn fail_len(v: Vec<isize> ) -> uint {
|
||||
fn fail_len(v: Vec<isize> ) -> usize {
|
||||
let mut i = 3;
|
||||
panic!();
|
||||
for x in v.iter() { i += 1u; }
|
||||
|
|
|
@ -30,7 +30,7 @@ impl MaybeDog {
|
|||
}
|
||||
|
||||
impl Groom for cat {
|
||||
fn shave(&self, other: uint) {
|
||||
fn shave(&self, other: usize) {
|
||||
whiskers -= other;
|
||||
//~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`?
|
||||
shave(4);
|
||||
|
@ -75,7 +75,7 @@ impl cat {
|
|||
//~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`?
|
||||
}
|
||||
|
||||
pub fn grow_older(other:uint) {
|
||||
pub fn grow_older(other:usize) {
|
||||
whiskers = 4;
|
||||
//~^ ERROR: unresolved name `whiskers`. Did you mean `self.whiskers`?
|
||||
purr_louder();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct thing(uint);
|
||||
struct thing(usize);
|
||||
impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp`
|
||||
fn le(&self, other: &thing) -> bool { true }
|
||||
fn ge(&self, other: &thing) -> bool { true }
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Obj {
|
||||
member: uint
|
||||
member: usize
|
||||
}
|
||||
|
||||
impl Obj {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Foo {
|
||||
baz: uint
|
||||
baz: usize
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
|
|
|
@ -10,5 +10,5 @@
|
|||
|
||||
// Regression test for issue #4935
|
||||
|
||||
fn foo(a: uint) {}
|
||||
fn foo(a: usize) {}
|
||||
fn main() { foo(5, 6) } //~ ERROR this function takes 1 parameter but 2 parameters were supplied
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
enum Either<T, U> { Left(T), Right(U) }
|
||||
struct S(Either<uint, uint>);
|
||||
struct S(Either<usize, usize>);
|
||||
|
||||
fn main() {
|
||||
match S(Either::Left(5)) {
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct TrieMapIterator<'a> {
|
||||
node: &'a uint
|
||||
node: &'a usize
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
fn twice(x: Box<uint>) -> uint {
|
||||
fn twice(x: Box<usize>) -> usize {
|
||||
*x * 2
|
||||
}
|
||||
|
||||
fn invoke<F>(f: F) where F: FnOnce() -> uint {
|
||||
fn invoke<F>(f: F) where F: FnOnce() -> usize {
|
||||
f();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let x : Box<uint> = box 9;
|
||||
let x : Box<usize> = box 9;
|
||||
let sq = |:| { *x * *x };
|
||||
|
||||
twice(x); //~ ERROR: cannot move out of
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static x: &'static uint = &1;
|
||||
static y: uint = *x;
|
||||
static x: &'static usize = &1;
|
||||
static y: usize = *x;
|
||||
//~^ ERROR cannot refer to other statics by value,
|
||||
// use the address-of operator or a constant instead
|
||||
fn main() {}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// ignore-tidy-linelength
|
||||
|
||||
pub mod a {
|
||||
pub struct Foo { a: uint }
|
||||
pub struct Foo { a: usize }
|
||||
}
|
||||
|
||||
pub mod b {
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
pub extern crate core; //~ ERROR: `pub` visibility is not allowed
|
||||
|
||||
fn main() {
|
||||
pub use std::uint; //~ ERROR: imports in functions are never reachable
|
||||
pub use std::usize; //~ ERROR: imports in functions are never reachable
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
use std::rc::Rc;
|
||||
|
||||
fn foo(_x: Rc<uint>) {}
|
||||
fn foo(_x: Rc<usize>) {}
|
||||
|
||||
fn bar<F:FnOnce() + Send>(_: F) { }
|
||||
|
||||
|
|
|
@ -14,15 +14,15 @@ use std::iter::{Range,range};
|
|||
|
||||
trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; }
|
||||
|
||||
impl<'r> Itble<'r, uint, Range<uint>> for (uint, uint) {
|
||||
fn iter(&'r self) -> Range<uint> {
|
||||
impl<'r> Itble<'r, usize, Range<usize>> for (usize, usize) {
|
||||
fn iter(&'r self) -> Range<usize> {
|
||||
let &(min, max) = self;
|
||||
range(min, max)
|
||||
}
|
||||
}
|
||||
|
||||
fn check<'r, I: Iterator<Item=uint>, T: Itble<'r, uint, I>>(cont: &T) -> bool {
|
||||
//~^ HELP: consider using an explicit lifetime parameter as shown: fn check<'r, I: Iterator<Item = uint>, T: Itble<'r, uint, I>>(cont: &'r T)
|
||||
fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool {
|
||||
//~^ HELP: consider using an explicit lifetime parameter as shown: fn check<'r, I: Iterator<Item = usize>, T: Itble<'r, usize, I>>(cont: &'r T)
|
||||
let cont_iter = cont.iter(); //~ ERROR: cannot infer
|
||||
let result = cont_iter.fold(Some(0u16), |state, val| {
|
||||
state.map_or(None, |mask| {
|
||||
|
|
|
@ -14,9 +14,9 @@ extern crate libc;
|
|||
|
||||
extern {
|
||||
pub fn bare_type1(size: isize); //~ ERROR: found rust type
|
||||
pub fn bare_type2(size: uint); //~ ERROR: found rust type
|
||||
pub fn bare_type2(size: usize); //~ ERROR: found rust type
|
||||
pub fn ptr_type1(size: *const isize); //~ ERROR: found rust type
|
||||
pub fn ptr_type2(size: *const uint); //~ ERROR: found rust type
|
||||
pub fn ptr_type2(size: *const usize); //~ ERROR: found rust type
|
||||
|
||||
pub fn good1(size: *const libc::c_int);
|
||||
pub fn good2(size: *const libc::c_uint);
|
||||
|
|
|
@ -17,12 +17,12 @@ extern crate libc;
|
|||
use std::num::Int;
|
||||
|
||||
struct Foo {
|
||||
x: uint,
|
||||
x: usize,
|
||||
b: bool, //~ ERROR: struct field is never used
|
||||
marker: std::marker::NoCopy
|
||||
}
|
||||
|
||||
fn field_read(f: Foo) -> uint {
|
||||
fn field_read(f: Foo) -> usize {
|
||||
f.x.pow(2)
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ fn field_match_in_patterns(b: XYZ) -> String {
|
|||
}
|
||||
|
||||
struct Bar {
|
||||
x: uint, //~ ERROR: struct field is never used
|
||||
x: usize, //~ ERROR: struct field is never used
|
||||
b: bool,
|
||||
_guard: ()
|
||||
}
|
||||
|
|
|
@ -57,6 +57,6 @@ fn main() {
|
|||
let n = 1u8 << (4+4); //~ ERROR: bitshift exceeds the type's number of bits
|
||||
|
||||
let n = 1i << std::isize::BITS; //~ ERROR: bitshift exceeds the type's number of bits
|
||||
let n = 1u << std::uint::BITS; //~ ERROR: bitshift exceeds the type's number of bits
|
||||
let n = 1u << std::usize::BITS; //~ ERROR: bitshift exceeds the type's number of bits
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ enum Baz {
|
|||
#[derive(Clone)]
|
||||
struct Buzz {
|
||||
x: (*const isize, //~ ERROR use of `#[derive]` with a raw pointer
|
||||
*const uint) //~ ERROR use of `#[derive]` with a raw pointer
|
||||
*const usize) //~ ERROR use of `#[derive]` with a raw pointer
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
@ -174,7 +174,7 @@ mod inheritance {
|
|||
let _ = Experimental::ExperimentalVariant; //~ ERROR use of experimental item
|
||||
let _ = Experimental::StableVariant;
|
||||
|
||||
let x: uint = 0;
|
||||
let x: usize = 0;
|
||||
x.experimental(); //~ ERROR use of experimental item
|
||||
x.stable();
|
||||
}
|
||||
|
|
|
@ -28,6 +28,6 @@ use rand::isaac::IsaacRng;
|
|||
use other::*;
|
||||
|
||||
fn main() {
|
||||
let x: collecs::vec::Vec<uint> = Vec::new();
|
||||
let x: collecs::vec::Vec<usize> = Vec::new();
|
||||
let y = foo();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ mod test {
|
|||
|
||||
mod foo {
|
||||
pub struct Point{pub x: isize, pub y: isize}
|
||||
pub struct Square{pub p: Point, pub h: uint, pub w: uint}
|
||||
pub struct Square{pub p: Point, pub h: usize, pub w: usize}
|
||||
}
|
||||
|
||||
mod bar {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue