1
Fork 0

Update compile fail tests to use isize.

This commit is contained in:
Huon Wilson 2015-01-08 21:54:35 +11:00 committed by Niko Matsakis
parent 4f5a57e80e
commit 0c70ce1424
552 changed files with 1323 additions and 1323 deletions

View file

@ -9,9 +9,9 @@
// except according to those terms. // except according to those terms.
struct sty(Vec<int> ); struct sty(Vec<isize> );
fn unpack<F>(_unpack: F) where F: FnOnce(&sty) -> Vec<int> {} fn unpack<F>(_unpack: F) where F: FnOnce(&sty) -> Vec<isize> {}
fn main() { fn main() {
let _foo = unpack(|s| { let _foo = unpack(|s| {

View file

@ -10,6 +10,6 @@
// error-pattern: parameters were supplied // error-pattern: parameters were supplied
fn f(x: int) { } fn f(x: isize) { }
fn main() { let i: (); i = f(); } fn main() { let i: (); i = f(); }

View file

@ -11,6 +11,6 @@
// error-pattern: mismatched types // error-pattern: mismatched types
fn f(x: int) { } fn f(x: isize) { }
fn main() { let i: (); i = f(()); } fn main() { let i: (); i = f(()); }

View file

@ -11,5 +11,5 @@
// Test that the old fixed length array syntax is a parsing error. // Test that the old fixed length array syntax is a parsing error.
fn main() { fn main() {
let _x: [int, ..3] = [0i, 1, 2]; //~ ERROR let _x: [isize, ..3] = [0i, 1, 2]; //~ ERROR
} }

View file

@ -10,15 +10,15 @@
#![feature(asm)] #![feature(asm)]
fn foo(x: int) { println!("{}", x); } fn foo(x: isize) { println!("{}", x); }
#[cfg(any(target_arch = "x86", #[cfg(any(target_arch = "x86",
target_arch = "x86_64", target_arch = "x86_64",
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64"))] target_arch = "aarch64"))]
pub fn main() { pub fn main() {
let x: int; let x: isize;
let y: int; let y: isize;
unsafe { unsafe {
asm!("mov $1, $0" : "=r"(x) : "=r"(5u)); //~ ERROR input operand constraint contains '=' asm!("mov $1, $0" : "=r"(x) : "=r"(5u)); //~ ERROR input operand constraint contains '='
asm!("mov $1, $0" : "=r"(y) : "+r"(5u)); //~ ERROR input operand constraint contains '+' asm!("mov $1, $0" : "=r"(y) : "+r"(5u)); //~ ERROR input operand constraint contains '+'

View file

@ -18,7 +18,7 @@
target_arch = "x86_64"))] target_arch = "x86_64"))]
pub fn main() { pub fn main() {
// assignment not dead // assignment not dead
let mut x: int = 0; let mut x: isize = 0;
unsafe { unsafe {
// extra colon // extra colon
asm!("mov $1, $0" : "=r"(x) : "r"(5u), "0"(x) : : "cc"); asm!("mov $1, $0" : "=r"(x) : "r"(5u), "0"(x) : : "cc");

View file

@ -10,14 +10,14 @@
#![feature(asm)] #![feature(asm)]
fn foo(x: int) { println!("{}", x); } fn foo(x: isize) { println!("{}", x); }
#[cfg(any(target_arch = "x86", #[cfg(any(target_arch = "x86",
target_arch = "x86_64", target_arch = "x86_64",
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64"))] target_arch = "aarch64"))]
pub fn main() { pub fn main() {
let x: int; let x: isize;
x = 1; //~ NOTE prior assignment occurs here x = 1; //~ NOTE prior assignment occurs here
foo(x); foo(x);
unsafe { unsafe {

View file

@ -10,14 +10,14 @@
#![feature(asm)] #![feature(asm)]
fn foo(x: int) { println!("{}", x); } fn foo(x: isize) { println!("{}", x); }
#[cfg(any(target_arch = "x86", #[cfg(any(target_arch = "x86",
target_arch = "x86_64", target_arch = "x86_64",
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64"))] target_arch = "aarch64"))]
pub fn main() { pub fn main() {
let x: int; let x: isize;
unsafe { unsafe {
asm!("mov $1, $0" : "r"(x) : "r"(5u)); //~ ERROR output operand constraint lacks '=' asm!("mov $1, $0" : "r"(x) : "r"(5u)); //~ ERROR output operand constraint lacks '='
} }

View file

@ -10,14 +10,14 @@
#![feature(asm)] #![feature(asm)]
fn foo(x: int) { println!("{}", x); } fn foo(x: isize) { println!("{}", x); }
#[cfg(any(target_arch = "x86", #[cfg(any(target_arch = "x86",
target_arch = "x86_64", target_arch = "x86_64",
target_arch = "arm", target_arch = "arm",
target_arch = "aarch64"))] target_arch = "aarch64"))]
pub fn main() { pub fn main() {
let x: int; let x: isize;
unsafe { unsafe {
asm!("mov $1, $0" : "=r"(x) : "r"(x)); //~ ERROR use of possibly uninitialized variable: `x` asm!("mov $1, $0" : "=r"(x) : "r"(x)); //~ ERROR use of possibly uninitialized variable: `x`
} }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
fn test() { fn test() {
let v: int; let v: isize;
v = 1; //~ NOTE prior assignment occurs here v = 1; //~ NOTE prior assignment occurs here
println!("v={}", v); println!("v={}", v);
v = 2; //~ ERROR re-assignment of immutable variable v = 2; //~ ERROR re-assignment of immutable variable

View file

@ -11,14 +11,14 @@
struct cat { struct cat {
meows : uint, meows : uint,
how_hungry : int, how_hungry : isize,
} }
impl cat { impl cat {
pub fn speak(&self) { self.meows += 1u; } pub fn speak(&self) { self.meows += 1u; }
} }
fn cat(in_x : uint, in_y : int) -> cat { fn cat(in_x : uint, in_y : isize) -> cat {
cat { cat {
meows: in_x, meows: in_x,
how_hungry: in_y how_hungry: in_y

View file

@ -13,7 +13,7 @@
struct Foo; struct Foo;
impl Foo { impl Foo {
type Bar = int; //~ERROR associated items are not allowed in inherent impls type Bar = isize; //~ERROR associated items are not allowed in inherent impls
} }
fn main() {} fn main() {}

View file

@ -11,7 +11,7 @@
// Test equality constraints on associated types in a where clause. // Test equality constraints on associated types in a where clause.
pub trait ToInt { pub trait ToInt {
fn to_int(&self) -> int; fn to_int(&self) -> isize;
} }
pub trait GetToInt pub trait GetToInt
@ -21,13 +21,13 @@ pub trait GetToInt
fn get(&self) -> <Self as GetToInt>::R; fn get(&self) -> <Self as GetToInt>::R;
} }
fn foo<G>(g: G) -> int fn foo<G>(g: G) -> isize
where G : GetToInt where G : GetToInt
{ {
ToInt::to_int(&g.get()) //~ ERROR not implemented ToInt::to_int(&g.get()) //~ ERROR not implemented
} }
fn bar<G : GetToInt>(g: G) -> int fn bar<G : GetToInt>(g: G) -> isize
where G::R : ToInt where G::R : ToInt
{ {
ToInt::to_int(&g.get()) // OK ToInt::to_int(&g.get()) // OK

View file

@ -18,7 +18,7 @@ pub trait Foo {
struct Bar; struct Bar;
impl Foo for int { impl Foo for isize {
type A = uint; type A = uint;
fn boo(&self) -> uint { 42 } fn boo(&self) -> uint { 42 }
} }

View file

@ -18,7 +18,7 @@ pub trait Foo {
struct Bar; struct Bar;
impl Foo for int { impl Foo for isize {
type A = uint; type A = uint;
fn boo(&self) -> uint { fn boo(&self) -> uint {
42 42

View file

@ -12,15 +12,15 @@
trait Foo { trait Foo {
type A; type A;
fn bar() -> int; fn bar() -> isize;
} }
impl Foo for int { impl Foo for isize {
type A = uint; type A = uint;
fn bar() -> int { 42 } fn bar() -> isize { 42 }
} }
pub fn main() { pub fn main() {
let x: int = Foo::<A=uint>::bar(); let x: isize = Foo::<A=uint>::bar();
//~^ERROR unexpected binding of associated item in expression path //~^ERROR unexpected binding of associated item in expression path
} }

View file

@ -17,43 +17,43 @@ pub trait TheTrait<T> {
} }
struct IntStruct { struct IntStruct {
x: int x: isize
} }
impl<'a> TheTrait<&'a int> for IntStruct { impl<'a> TheTrait<&'a isize> for IntStruct {
type A = &'a int; type A = &'a isize;
fn get(&self, t: &'a int) -> &'a int { fn get(&self, t: &'a isize) -> &'a isize {
t t
} }
} }
struct UintStruct { struct UintStruct {
x: int x: isize
} }
impl<'a> TheTrait<&'a int> for UintStruct { impl<'a> TheTrait<&'a isize> for UintStruct {
type A = &'a uint; type A = &'a uint;
fn get(&self, t: &'a int) -> &'a uint { fn get(&self, t: &'a isize) -> &'a uint {
panic!() panic!()
} }
} }
fn foo<T>() fn foo<T>()
where T : for<'x> TheTrait<&'x int, A = &'x int> where T : for<'x> TheTrait<&'x isize, A = &'x isize>
{ {
// ok for IntStruct, but not UintStruct // ok for IntStruct, but not UintStruct
} }
fn bar<T>() fn bar<T>()
where T : for<'x> TheTrait<&'x int, A = &'x uint> where T : for<'x> TheTrait<&'x isize, A = &'x uint>
{ {
// ok for UintStruct, but not IntStruct // ok for UintStruct, but not IntStruct
} }
fn baz<T>() fn baz<T>()
where T : for<'x,'y> TheTrait<&'x int, A = &'y int> where T : for<'x,'y> TheTrait<&'x isize, A = &'y isize>
{ {
// not ok for either struct, due to the use of two lifetimes // not ok for either struct, due to the use of two lifetimes
} }

View file

@ -19,7 +19,7 @@ pub trait Foo {
struct Bar; struct Bar;
impl Foo for int { impl Foo for isize {
type A = uint; type A = uint;
type B = char; type B = char;
fn boo(&self) -> uint { fn boo(&self) -> uint {

View file

@ -16,7 +16,7 @@ trait Foo<T> {
fn get_bar(&self) -> Self::Bar; fn get_bar(&self) -> Self::Bar;
} }
fn f<T:Foo<int>>(t: &T) { fn f<T:Foo<isize>>(t: &T) {
let u: <T as Foo<usize>>::Bar = t.get_bar(); let u: <T as Foo<usize>>::Bar = t.get_bar();
//~^ ERROR the trait `Foo<usize>` is not implemented for the type `T` //~^ ERROR the trait `Foo<usize>` is not implemented for the type `T`
} }

View file

@ -15,7 +15,7 @@ trait Trait {
type Type; type Type;
} }
impl Trait for int {} //~ ERROR missing: `Type` impl Trait for isize {} //~ ERROR missing: `Type`
fn main() {} fn main() {}

View file

@ -14,7 +14,7 @@ trait Get {
} }
struct Struct { struct Struct {
x: int, x: isize,
} }
impl Struct { impl Struct {

View file

@ -14,7 +14,7 @@ pub trait Foo {
type A; type A;
} }
impl Foo for int { impl Foo for isize {
type A = uint; type A = uint;
} }
@ -45,7 +45,7 @@ pub fn f1_uint_int() {
} }
pub fn f2_int() { pub fn f2_int() {
let _: int = f2(2is); let _: isize = f2(2is);
//~^ ERROR expected `isize`, found `usize` //~^ ERROR expected `isize`, found `usize`
} }

View file

@ -17,7 +17,7 @@ pub trait Foo<T> {
fn get(&self, t: T) -> Self::A; fn get(&self, t: T) -> Self::A;
} }
fn foo2<I>(x: <I as for<'x> Foo<&'x int>>::A) fn foo2<I>(x: <I as for<'x> Foo<&'x isize>>::A)
//~^ ERROR expected identifier, found keyword `for` //~^ ERROR expected identifier, found keyword `for`
//~| ERROR expected one of `::` or `>` //~| ERROR expected one of `::` or `>`
{ {

View file

@ -17,15 +17,15 @@ pub trait Foo<T> {
fn get(&self, t: T) -> Self::A; fn get(&self, t: T) -> Self::A;
} }
fn foo<'a, I : for<'x> Foo<&'x int>>( fn foo<'a, I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&'a int>>::A) x: <I as Foo<&'a isize>>::A)
{ {
let y: I::A = x; let y: I::A = x;
} }
fn bar<'a, 'b, I : for<'x> Foo<&'x int>>( fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&'a int>>::A, x: <I as Foo<&'a isize>>::A,
y: <I as Foo<&'b int>>::A, y: <I as Foo<&'b isize>>::A,
cond: bool) cond: bool)
{ {
// x and y here have two distinct lifetimes: // x and y here have two distinct lifetimes:

View file

@ -17,7 +17,7 @@ pub trait Foo<T> {
fn get(&self, t: T) -> Self::A; fn get(&self, t: T) -> Self::A;
} }
fn foo2<I : for<'x> Foo<&'x int>>( fn foo2<I : for<'x> Foo<&'x isize>>(
x: I::A) x: I::A)
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
{ {
@ -28,15 +28,15 @@ fn foo2<I : for<'x> Foo<&'x int>>(
// specifically for fn signatures. // specifically for fn signatures.
} }
fn foo3<I : for<'x> Foo<&'x int>>( fn foo3<I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&int>>::A) x: <I as Foo<&isize>>::A)
{ {
// OK, in this case we spelled out the precise regions involved, though we left one of // OK, in this case we spelled out the precise regions involved, though we left one of
// them anonymous. // them anonymous.
} }
fn foo4<'a, I : for<'x> Foo<&'x int>>( fn foo4<'a, I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&'a int>>::A) x: <I as Foo<&'a isize>>::A)
{ {
// OK, in this case we spelled out the precise regions involved. // OK, in this case we spelled out the precise regions involved.
} }

View file

@ -17,18 +17,18 @@ pub trait Foo<T> {
fn get(&self, t: T) -> Self::A; fn get(&self, t: T) -> Self::A;
} }
struct SomeStruct<I : for<'x> Foo<&'x int>> { struct SomeStruct<I : for<'x> Foo<&'x isize>> {
field: I::A field: I::A
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
} }
struct AnotherStruct<I : for<'x> Foo<&'x int>> { struct AnotherStruct<I : for<'x> Foo<&'x isize>> {
field: <I as Foo<&int>>::A field: <I as Foo<&isize>>::A
//~^ ERROR missing lifetime specifier //~^ ERROR missing lifetime specifier
} }
struct YetAnotherStruct<'a, I : for<'x> Foo<&'x int>> { struct YetAnotherStruct<'a, I : for<'x> Foo<&'x isize>> {
field: <I as Foo<&'a int>>::A field: <I as Foo<&'a isize>>::A
} }
pub fn main() {} pub fn main() {}

View file

@ -17,17 +17,17 @@ pub trait Foo<T> {
fn get(&self, t: T) -> Self::A; fn get(&self, t: T) -> Self::A;
} }
trait SomeTrait<I : for<'x> Foo<&'x int>> { trait SomeTrait<I : for<'x> Foo<&'x isize>> {
fn some_method(&self, arg: I::A); fn some_method(&self, arg: I::A);
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context //~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
} }
trait AnotherTrait<I : for<'x> Foo<&'x int>> { trait AnotherTrait<I : for<'x> Foo<&'x isize>> {
fn some_method(&self, arg: <I as Foo<&int>>::A); fn some_method(&self, arg: <I as Foo<&isize>>::A);
} }
trait YetAnotherTrait<I : for<'x> Foo<&'x int>> { trait YetAnotherTrait<I : for<'x> Foo<&'x isize>> {
fn some_method<'a>(&self, arg: <I as Foo<&'a int>>::A); fn some_method<'a>(&self, arg: <I as Foo<&'a isize>>::A);
} }
pub fn main() {} pub fn main() {}

View file

@ -12,15 +12,15 @@
trait Foo { trait Foo {
type A; type A;
fn bar() -> int; fn bar() -> isize;
} }
impl Foo for int { impl Foo for isize {
type A = uint; type A = uint;
fn bar() -> int { 42 } fn bar() -> isize { 42 }
} }
pub fn main() { pub fn main() {
let x: int = Foo::bar(); let x: isize = Foo::bar();
//~^ ERROR type annotations required //~^ ERROR type annotations required
} }

View file

@ -27,7 +27,7 @@ trait MyIter {
fn test(&self); fn test(&self);
} }
impl<'a> MyIter for &'a [int] { impl<'a> MyIter for &'a [isize] {
fn test_mut(&mut self) { } fn test_mut(&mut self) { }
fn test(&self) { } fn test(&self) { }
} }

View file

@ -28,7 +28,7 @@ fn main() {
assert_eq!(z, 21); assert_eq!(z, 21);
let forty: fish = fish{a: box 40}; let forty: fish = fish{a: box 40};
let two: fish = fish{a: box 2}; let two: fish = fish{a: box 2};
let answer: int = forty.a + two.a; let answer: isize = forty.a + two.a;
//~^ ERROR binary operation `+` cannot be applied to type `Box<isize>` //~^ ERROR binary operation `+` cannot be applied to type `Box<isize>`
println!("{}", answer); println!("{}", answer);
assert_eq!(answer, 42); assert_eq!(answer, 42);

View file

@ -10,7 +10,7 @@
// error-pattern: can't capture dynamic environment in a fn item; // error-pattern: can't capture dynamic environment in a fn item;
fn foo() { fn foo() {
let x: int; let x: isize;
fn bar() { log(debug, x); } fn bar() { log(debug, x); }
} }
fn main() { foo(); } fn main() { foo(); }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
// error-pattern: can't capture dynamic environment in a fn item; // error-pattern: can't capture dynamic environment in a fn item;
fn foo(x: int) { fn foo(x: isize) {
fn bar() { log(debug, x); } fn bar() { log(debug, x); }
} }
fn main() { foo(2); } fn main() { foo(2); }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
// error-pattern: can't capture dynamic environment in a fn item; // error-pattern: can't capture dynamic environment in a fn item;
fn foo(x: int) { fn foo(x: isize) {
fn mth() { fn mth() {
fn bar() { log(debug, x); } fn bar() { log(debug, x); }
} }

View file

@ -8,4 +8,4 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn main(x: int) { } //~ ERROR: main function expects type fn main(x: isize) { } //~ ERROR: main function expects type

View file

@ -11,7 +11,7 @@
// error-pattern: expected // error-pattern: expected
fn main() { fn main() {
let int x = 5; let isize x = 5;
match x; match x;
} }

View file

@ -33,11 +33,11 @@ trait Trait<T> {
} }
struct S2 { struct S2 {
contents: int, contents: isize,
} }
impl Trait<int> for S2 { impl Trait<isize> for S2 {
fn new<U>(x: int, _: U) -> S2 { fn new<U>(x: isize, _: U) -> S2 {
S2 { S2 {
contents: x, contents: x,
} }
@ -45,16 +45,16 @@ impl Trait<int> for S2 {
} }
fn foo<'a>() { fn foo<'a>() {
let _ = S::new::<int,f64>(1, 1.0); let _ = S::new::<isize,f64>(1, 1.0);
//~^ ERROR too many type parameters provided //~^ ERROR too many type parameters provided
let _ = S::<'a,int>::new::<f64>(1, 1.0); let _ = S::<'a,isize>::new::<f64>(1, 1.0);
//~^ ERROR too many lifetime parameters provided //~^ ERROR too many lifetime parameters provided
let _: S2 = Trait::new::<int,f64>(1, 1.0); let _: S2 = Trait::new::<isize,f64>(1, 1.0);
//~^ ERROR too many type parameters provided //~^ ERROR too many type parameters provided
let _: S2 = Trait::<'a,int>::new::<f64>(1, 1.0); let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0);
//~^ ERROR too many lifetime parameters provided //~^ ERROR too many lifetime parameters provided
} }

View file

@ -11,5 +11,5 @@
// error-pattern: expected // error-pattern: expected
fn main() { fn main() {
let x.y::<int>.z foo; let x.y::<isize>.z foo;
} }

View file

@ -9,5 +9,5 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
let x: [int 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3` let x: [isize 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3`
} }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
struct Foo { x: int } struct Foo { x: isize }
match (Foo { x: 10 }) { match (Foo { x: 10 }) {
Foo { ref x: ref x } => {}, //~ ERROR unexpected `:` Foo { ref x: ref x } => {}, //~ ERROR unexpected `:`
_ => {} _ => {}

View file

@ -11,7 +11,7 @@
// error-pattern: unresolved // error-pattern: unresolved
enum color { rgb(int, int, int), rgba(int, int, int, int), } enum color { rgb(isize, isize, isize), rgba(isize, isize, isize, isize), }
fn main() { fn main() {
let red: color = rgb(255, 0, 0); let red: color = rgb(255, 0, 0);

View file

@ -11,9 +11,9 @@
#![allow(unknown_features)] #![allow(unknown_features)]
#![feature(box_syntax)] #![feature(box_syntax)]
struct Foo(Box<int>, int); struct Foo(Box<isize>, isize);
struct Bar(int, int); struct Bar(isize, isize);
fn main() { fn main() {
let x = (box 1i, 2i); let x = (box 1i, 2i);

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
let i: int; let i: isize;
println!("{}", false && { i = 5; true }); println!("{}", false && { i = 5; true });
println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i` println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`

View file

@ -9,22 +9,22 @@
// except according to those terms. // except according to those terms.
struct Point { struct Point {
x: int, x: isize,
y: int, y: isize,
} }
fn a() { fn a() {
let mut p = vec!(1); let mut p = vec!(1);
// Create an immutable pointer into p's contents: // Create an immutable pointer into p's contents:
let q: &int = &p[0]; let q: &isize = &p[0];
p[0] = 5; //~ ERROR cannot borrow p[0] = 5; //~ ERROR cannot borrow
println!("{}", *q); println!("{}", *q);
} }
fn borrow<F>(_x: &[int], _f: F) where F: FnOnce() {} fn borrow<F>(_x: &[isize], _f: F) where F: FnOnce() {}
fn b() { fn b() {
// here we alias the mutable vector into an imm slice and try to // here we alias the mutable vector into an imm slice and try to

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
struct point { x: int, y: int } struct point { x: isize, y: isize }
fn a() { fn a() {
let mut p = point {x: 3, y: 4}; let mut p = point {x: 3, y: 4};
@ -16,7 +16,7 @@ fn a() {
// This assignment is illegal because the field x is not // This assignment is illegal because the field x is not
// inherently mutable; since `p` was made immutable, `p.x` is now // inherently mutable; since `p` was made immutable, `p.x` is now
// immutable. Otherwise the type of &_q.x (&int) would be wrong. // immutable. Otherwise the type of &_q.x (&isize) would be wrong.
p.x = 5; //~ ERROR cannot assign to `p.x` p.x = 5; //~ ERROR cannot assign to `p.x`
q.x; q.x;
} }

View file

@ -12,7 +12,7 @@
// borrowed (but otherwise non-aliasable) location is illegal. // borrowed (but otherwise non-aliasable) location is illegal.
struct S<'a> { struct S<'a> {
pointer: &'a mut int pointer: &'a mut isize
} }
fn a(s: &S) { fn a(s: &S) {

View file

@ -12,7 +12,7 @@
// borrowed (but otherwise non-aliasable) location is illegal. // borrowed (but otherwise non-aliasable) location is illegal.
struct S<'a> { struct S<'a> {
pointer: &'a mut int pointer: &'a mut isize
} }
fn copy_borrowed_ptr<'a>(p: &'a mut S<'a>) -> S<'a> { fn copy_borrowed_ptr<'a>(p: &'a mut S<'a>) -> S<'a> {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
static foo: int = 5; static foo: isize = 5;
fn main() { fn main() {
// assigning to various global constants // assigning to various global constants

View file

@ -11,7 +11,7 @@
// Tests that auto-ref can't create mutable aliases to immutable memory. // Tests that auto-ref can't create mutable aliases to immutable memory.
struct Foo { struct Foo {
x: int x: isize
} }
impl Foo { impl Foo {

View file

@ -10,7 +10,7 @@
fn force<F>(f: F) where F: FnOnce() { f(); } fn force<F>(f: F) where F: FnOnce() { f(); }
fn main() { fn main() {
let x: int; let x: isize;
force(|| { //~ ERROR capture of possibly uninitialized variable: `x` force(|| { //~ ERROR capture of possibly uninitialized variable: `x`
println!("{}", x); println!("{}", x);
}); });

View file

@ -17,8 +17,8 @@ struct Foo {
impl Copy for Foo {} impl Copy for Foo {}
struct Bar { struct Bar {
int1: int, int1: isize,
int2: int, int2: isize,
} }
impl Copy for Bar {} impl Copy for Bar {}

View file

@ -16,8 +16,8 @@ struct Foo {
impl Copy for Foo {} impl Copy for Foo {}
struct Bar { struct Bar {
int1: int, int1: isize,
int2: int, int2: isize,
} }
impl Copy for Bar {} impl Copy for Bar {}

View file

@ -11,9 +11,9 @@
// Test lifetimes are linked properly when we take reference // Test lifetimes are linked properly when we take reference
// to interior. // to interior.
struct Foo(int); struct Foo(isize);
fn foo<'a>() -> &'a int { fn foo<'a>() -> &'a isize {
let &Foo(ref x) = &Foo(3); //~ ERROR borrowed value does not live long enough let &Foo(ref x) = &Foo(3); //~ ERROR borrowed value does not live long enough
x x
} }

View file

@ -13,20 +13,20 @@
// //
// Example from src/middle/borrowck/doc.rs // Example from src/middle/borrowck/doc.rs
fn foo(t0: & &mut int) { fn foo(t0: & &mut isize) {
let t1 = t0; let t1 = t0;
let p: &int = &**t0; let p: &isize = &**t0;
**t1 = 22; //~ ERROR cannot assign **t1 = 22; //~ ERROR cannot assign
} }
fn foo3(t0: &mut &mut int) { fn foo3(t0: &mut &mut isize) {
let t1 = &mut *t0; let t1 = &mut *t0;
let p: &int = &**t0; //~ ERROR cannot borrow let p: &isize = &**t0; //~ ERROR cannot borrow
**t1 = 22; **t1 = 22;
} }
fn foo4(t0: & &mut int) { fn foo4(t0: & &mut isize) {
let x: &mut int = &mut **t0; //~ ERROR cannot borrow let x: &mut isize = &mut **t0; //~ ERROR cannot borrow
*x += 1; *x += 1;
} }

View file

@ -32,25 +32,25 @@ impl<T> DerefMut for Own<T> {
} }
struct Point { struct Point {
x: int, x: isize,
y: int y: isize
} }
impl Point { impl Point {
fn get(&self) -> (int, int) { fn get(&self) -> (isize, isize) {
(self.x, self.y) (self.x, self.y)
} }
fn set(&mut self, x: int, y: int) { fn set(&mut self, x: isize, y: isize) {
self.x = x; self.x = x;
self.y = y; self.y = y;
} }
fn x_ref(&self) -> &int { fn x_ref(&self) -> &isize {
&self.x &self.x
} }
fn y_mut(&mut self) -> &mut int { fn y_mut(&mut self) -> &mut isize {
&mut self.y &mut self.y
} }
} }
@ -67,15 +67,15 @@ fn deref_mut_field2(mut x: Own<Point>) {
let _i = &mut x.y; let _i = &mut x.y;
} }
fn deref_extend_field(x: &Own<Point>) -> &int { fn deref_extend_field(x: &Own<Point>) -> &isize {
&x.y &x.y
} }
fn deref_extend_mut_field1(x: &Own<Point>) -> &mut int { fn deref_extend_mut_field1(x: &Own<Point>) -> &mut isize {
&mut x.y //~ ERROR cannot borrow &mut x.y //~ ERROR cannot borrow
} }
fn deref_extend_mut_field2(x: &mut Own<Point>) -> &mut int { fn deref_extend_mut_field2(x: &mut Own<Point>) -> &mut isize {
&mut x.y &mut x.y
} }
@ -126,15 +126,15 @@ fn deref_mut_method2(mut x: Own<Point>) {
x.set(0, 0); x.set(0, 0);
} }
fn deref_extend_method(x: &Own<Point>) -> &int { fn deref_extend_method(x: &Own<Point>) -> &isize {
x.x_ref() x.x_ref()
} }
fn deref_extend_mut_method1(x: &Own<Point>) -> &mut int { fn deref_extend_mut_method1(x: &Own<Point>) -> &mut isize {
x.y_mut() //~ ERROR cannot borrow x.y_mut() //~ ERROR cannot borrow
} }
fn deref_extend_mut_method2(x: &mut Own<Point>) -> &mut int { fn deref_extend_mut_method2(x: &mut Own<Point>) -> &mut isize {
x.y_mut() x.y_mut()
} }

View file

@ -26,25 +26,25 @@ impl<T> Deref for Rc<T> {
} }
struct Point { struct Point {
x: int, x: isize,
y: int y: isize
} }
impl Point { impl Point {
fn get(&self) -> (int, int) { fn get(&self) -> (isize, isize) {
(self.x, self.y) (self.x, self.y)
} }
fn set(&mut self, x: int, y: int) { fn set(&mut self, x: isize, y: isize) {
self.x = x; self.x = x;
self.y = y; self.y = y;
} }
fn x_ref(&self) -> &int { fn x_ref(&self) -> &isize {
&self.x &self.x
} }
fn y_mut(&mut self) -> &mut int { fn y_mut(&mut self) -> &mut isize {
&mut self.y &mut self.y
} }
} }
@ -61,15 +61,15 @@ fn deref_mut_field2(mut x: Rc<Point>) {
let _i = &mut x.y; //~ ERROR cannot borrow let _i = &mut x.y; //~ ERROR cannot borrow
} }
fn deref_extend_field(x: &Rc<Point>) -> &int { fn deref_extend_field(x: &Rc<Point>) -> &isize {
&x.y &x.y
} }
fn deref_extend_mut_field1(x: &Rc<Point>) -> &mut int { fn deref_extend_mut_field1(x: &Rc<Point>) -> &mut isize {
&mut x.y //~ ERROR cannot borrow &mut x.y //~ ERROR cannot borrow
} }
fn deref_extend_mut_field2(x: &mut Rc<Point>) -> &mut int { fn deref_extend_mut_field2(x: &mut Rc<Point>) -> &mut isize {
&mut x.y //~ ERROR cannot borrow &mut x.y //~ ERROR cannot borrow
} }
@ -97,15 +97,15 @@ fn deref_mut_method2(mut x: Rc<Point>) {
x.set(0, 0); //~ ERROR cannot borrow x.set(0, 0); //~ ERROR cannot borrow
} }
fn deref_extend_method(x: &Rc<Point>) -> &int { fn deref_extend_method(x: &Rc<Point>) -> &isize {
x.x_ref() x.x_ref()
} }
fn deref_extend_mut_method1(x: &Rc<Point>) -> &mut int { fn deref_extend_mut_method1(x: &Rc<Point>) -> &mut isize {
x.y_mut() //~ ERROR cannot borrow x.y_mut() //~ ERROR cannot borrow
} }
fn deref_extend_mut_method2(x: &mut Rc<Point>) -> &mut int { fn deref_extend_mut_method2(x: &mut Rc<Point>) -> &mut isize {
x.y_mut() //~ ERROR cannot borrow x.y_mut() //~ ERROR cannot borrow
} }

View file

@ -31,39 +31,39 @@ impl<T> DerefMut for Own<T> {
} }
} }
fn deref_imm(x: Own<int>) { fn deref_imm(x: Own<isize>) {
let _i = &*x; let _i = &*x;
} }
fn deref_mut1(x: Own<int>) { fn deref_mut1(x: Own<isize>) {
let _i = &mut *x; //~ ERROR cannot borrow let _i = &mut *x; //~ ERROR cannot borrow
} }
fn deref_mut2(mut x: Own<int>) { fn deref_mut2(mut x: Own<isize>) {
let _i = &mut *x; let _i = &mut *x;
} }
fn deref_extend<'a>(x: &'a Own<int>) -> &'a int { fn deref_extend<'a>(x: &'a Own<isize>) -> &'a isize {
&**x &**x
} }
fn deref_extend_mut1<'a>(x: &'a Own<int>) -> &'a mut int { fn deref_extend_mut1<'a>(x: &'a Own<isize>) -> &'a mut isize {
&mut **x //~ ERROR cannot borrow &mut **x //~ ERROR cannot borrow
} }
fn deref_extend_mut2<'a>(x: &'a mut Own<int>) -> &'a mut int { fn deref_extend_mut2<'a>(x: &'a mut Own<isize>) -> &'a mut isize {
&mut **x &mut **x
} }
fn assign1<'a>(x: Own<int>) { fn assign1<'a>(x: Own<isize>) {
*x = 3; //~ ERROR cannot borrow *x = 3; //~ ERROR cannot borrow
} }
fn assign2<'a>(x: &'a Own<int>) { fn assign2<'a>(x: &'a Own<isize>) {
**x = 3; //~ ERROR cannot borrow **x = 3; //~ ERROR cannot borrow
} }
fn assign3<'a>(x: &'a mut Own<int>) { fn assign3<'a>(x: &'a mut Own<isize>) {
**x = 3; **x = 3;
} }

View file

@ -25,39 +25,39 @@ impl<T> Deref for Rc<T> {
} }
} }
fn deref_imm(x: Rc<int>) { fn deref_imm(x: Rc<isize>) {
let _i = &*x; let _i = &*x;
} }
fn deref_mut1(x: Rc<int>) { fn deref_mut1(x: Rc<isize>) {
let _i = &mut *x; //~ ERROR cannot borrow let _i = &mut *x; //~ ERROR cannot borrow
} }
fn deref_mut2(mut x: Rc<int>) { fn deref_mut2(mut x: Rc<isize>) {
let _i = &mut *x; //~ ERROR cannot borrow let _i = &mut *x; //~ ERROR cannot borrow
} }
fn deref_extend<'a>(x: &'a Rc<int>) -> &'a int { fn deref_extend<'a>(x: &'a Rc<isize>) -> &'a isize {
&**x &**x
} }
fn deref_extend_mut1<'a>(x: &'a Rc<int>) -> &'a mut int { fn deref_extend_mut1<'a>(x: &'a Rc<isize>) -> &'a mut isize {
&mut **x //~ ERROR cannot borrow &mut **x //~ ERROR cannot borrow
} }
fn deref_extend_mut2<'a>(x: &'a mut Rc<int>) -> &'a mut int { fn deref_extend_mut2<'a>(x: &'a mut Rc<isize>) -> &'a mut isize {
&mut **x //~ ERROR cannot borrow &mut **x //~ ERROR cannot borrow
} }
fn assign1<'a>(x: Rc<int>) { fn assign1<'a>(x: Rc<isize>) {
*x = 3; //~ ERROR cannot assign *x = 3; //~ ERROR cannot assign
} }
fn assign2<'a>(x: &'a Rc<int>) { fn assign2<'a>(x: &'a Rc<isize>) {
**x = 3; //~ ERROR cannot assign **x = 3; //~ ERROR cannot assign
} }
fn assign3<'a>(x: &'a mut Rc<int>) { fn assign3<'a>(x: &'a mut Rc<isize>) {
**x = 3; //~ ERROR cannot assign **x = 3; //~ ERROR cannot assign
} }

View file

@ -11,23 +11,23 @@
#![feature(box_syntax)] #![feature(box_syntax)]
struct A { struct A {
x: Box<int>, x: Box<isize>,
y: int, y: isize,
} }
struct B { struct B {
x: Box<int>, x: Box<isize>,
y: Box<int>, y: Box<isize>,
} }
struct C { struct C {
x: Box<A>, x: Box<A>,
y: int, y: isize,
} }
struct D { struct D {
x: Box<A>, x: Box<A>,
y: Box<int>, y: Box<isize>,
} }
fn copy_after_move() { fn copy_after_move() {

View file

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn foo() -> int { fn foo() -> isize {
let x: int; let x: isize;
while 1i != 2 { while 1i != 2 {
break; break;

View file

@ -8,8 +8,8 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn foo() -> int { fn foo() -> isize {
let x: int; let x: isize;
loop { loop {
break; break;

View file

@ -56,8 +56,8 @@ fn test6() {
} }
fn test7() { fn test7() {
fn foo<F>(_: F) where F: FnMut(Box<FnMut(int)>, int) {} fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
let mut f = |&mut: g: Box<FnMut(int)>, b: int| {}; let mut f = |&mut: g: Box<FnMut(isize)>, b: isize| {};
f(box |a| { //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable f(box |a| { //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
foo(f); //~ ERROR: cannot move out of captured outer variable foo(f); //~ ERROR: cannot move out of captured outer variable
}, 3); }, 3);

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
struct Foo { struct Foo {
x: int, x: isize,
} }
impl Foo { impl Foo {

View file

@ -13,11 +13,11 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn get(x: &int) -> int { fn get(x: &isize) -> isize {
*x *x
} }
fn set(x: &mut int) { fn set(x: &mut isize) {
*x = 4; *x = 4;
} }
@ -59,7 +59,7 @@ fn f() {
fn g() { fn g() {
struct Foo { struct Foo {
f: Box<int> f: Box<isize>
} }
let mut x = box Foo { f: box 3 }; let mut x = box Foo { f: box 3 };
@ -69,7 +69,7 @@ fn g() {
fn h() { fn h() {
struct Foo { struct Foo {
f: Box<int> f: Box<isize>
} }
let mut x = box Foo { f: box 3 }; let mut x = box Foo { f: box 3 };

View file

@ -11,15 +11,15 @@
// Tests that two closures cannot simultaneously have mutable // Tests that two closures cannot simultaneously have mutable
// and immutable access to the variable. Issue #6801. // and immutable access to the variable. Issue #6801.
fn get(x: &int) -> int { fn get(x: &isize) -> isize {
*x *x
} }
fn set(x: &mut int) { fn set(x: &mut isize) {
*x = 4; *x = 4;
} }
fn a(x: &int) { fn a(x: &isize) {
let c1 = |&mut:| set(&mut *x); let c1 = |&mut:| set(&mut *x);
//~^ ERROR cannot borrow //~^ ERROR cannot borrow
let c2 = |&mut:| set(&mut *x); let c2 = |&mut:| set(&mut *x);

View file

@ -20,7 +20,7 @@ fn a() {
let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once let c2 = |&mut:| x = 5; //~ ERROR cannot borrow `x` as mutable more than once
} }
fn set(x: &mut int) { fn set(x: &mut isize) {
*x = 4; *x = 4;
} }
@ -45,7 +45,7 @@ fn d() {
fn g() { fn g() {
struct Foo { struct Foo {
f: Box<int> f: Box<isize>
} }
let mut x = box Foo { f: box 3 }; let mut x = box Foo { f: box 3 };

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
struct Foo { struct Foo {
x: int, x: isize,
} }
pub fn main() { pub fn main() {

View file

@ -14,35 +14,35 @@
// may be *immutable*, but we cannot allow // may be *immutable*, but we cannot allow
// multiple borrows. // multiple borrows.
fn get(x: &int) -> int { fn get(x: &isize) -> isize {
*x *x
} }
fn set(x: &mut int) -> int { fn set(x: &mut isize) -> isize {
*x *x
} }
fn a(x: &mut int) { fn a(x: &mut isize) {
let c1 = |&mut:| get(x); let c1 = |&mut:| get(x);
let c2 = |&mut:| get(x); let c2 = |&mut:| get(x);
} }
fn b(x: &mut int) { fn b(x: &mut isize) {
let c1 = |&mut:| get(x); let c1 = |&mut:| get(x);
let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x` let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x`
} }
fn c(x: &mut int) { fn c(x: &mut isize) {
let c1 = |&mut:| get(x); let c1 = |&mut:| get(x);
let c2 = |&mut:| { get(x); set(x); }; //~ ERROR closure requires unique access to `x` let c2 = |&mut:| { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
} }
fn d(x: &mut int) { fn d(x: &mut isize) {
let c1 = |&mut:| set(x); let c1 = |&mut:| set(x);
let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x` let c2 = |&mut:| set(x); //~ ERROR closure requires unique access to `x`
} }
fn e(x: &mut int) { fn e(x: &mut isize) {
let c1 = |&mut:| x = panic!(); //~ ERROR closure cannot assign to immutable local variable let c1 = |&mut:| x = panic!(); //~ ERROR closure cannot assign to immutable local variable
} }

View file

@ -15,7 +15,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
struct Foo { struct Foo {
x: int x: isize
} }
impl Drop for Foo { impl Drop for Foo {

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
struct A { a: int, b: Box<int> } struct A { a: isize, b: Box<isize> }
fn deref_after_move() { fn deref_after_move() {
let x = A { a: 1, b: box 2 }; let x = A { a: 1, b: box 2 };

View file

@ -13,7 +13,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
struct Foo { struct Foo {
a: [Box<int>; 3], a: [Box<isize>; 3],
} }
fn main() { fn main() {

View file

@ -8,9 +8,9 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn foo(x: int) { println!("{}", x); } fn foo(x: isize) { println!("{}", x); }
fn main() { fn main() {
let x: int; if 1i > 2 { x = 10; } let x: isize; if 1i > 2 { x = 10; }
foo(x); //~ ERROR use of possibly uninitialized variable: `x` foo(x); //~ ERROR use of possibly uninitialized variable: `x`
} }

View file

@ -8,10 +8,10 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn foo(x: int) { println!("{}", x); } fn foo(x: isize) { println!("{}", x); }
fn main() { fn main() {
let x: int; let x: isize;
if 1i > 2 { if 1i > 2 {
println!("whoops"); println!("whoops");
} else { } else {

View file

@ -9,8 +9,8 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
let j = |&:| -> int { let j = |&:| -> isize {
let i: int; let i: isize;
i //~ ERROR use of possibly uninitialized variable: `i` i //~ ERROR use of possibly uninitialized variable: `i`
}; };
j(); j();

View file

@ -9,8 +9,8 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
let f = |&:| -> int { let f = |&:| -> isize {
let i: int; let i: isize;
i //~ ERROR use of possibly uninitialized variable: `i` i //~ ERROR use of possibly uninitialized variable: `i`
}; };
println!("{}", f()); println!("{}", f());

View file

@ -10,8 +10,8 @@
#[derive(Clone)] #[derive(Clone)]
struct point { struct point {
x: int, x: isize,
y: int, y: isize,
} }
fn main() { fn main() {

View file

@ -10,7 +10,7 @@
fn test() { fn test() {
let v: int; let v: isize;
v += 1; //~ ERROR use of possibly uninitialized variable: `v` v += 1; //~ ERROR use of possibly uninitialized variable: `v`
v.clone(); v.clone();
} }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
fn test() { fn test() {
let mut v: int; let mut v: isize;
v = v + 1; //~ ERROR use of possibly uninitialized variable: `v` v = v + 1; //~ ERROR use of possibly uninitialized variable: `v`
v.clone(); v.clone();
} }

View file

@ -12,11 +12,11 @@ extern crate collections;
use std::collections::HashSet; use std::collections::HashSet;
struct Foo { struct Foo {
n: HashSet<int>, n: HashSet<isize>,
} }
impl Foo { impl Foo {
pub fn foo<F>(&mut self, mut fun: F) where F: FnMut(&int) { pub fn foo<F>(&mut self, mut fun: F) where F: FnMut(&isize) {
for f in self.n.iter() { for f in self.n.iter() {
fun(f); fun(f);
} }

View file

@ -13,11 +13,11 @@
#![feature(box_syntax)] #![feature(box_syntax)]
struct A { a: int } struct A { a: isize }
struct B<'a> { a: Box<&'a mut int> } struct B<'a> { a: Box<&'a mut isize> }
fn borrow_in_var_from_var() { fn borrow_in_var_from_var() {
let mut x: int = 1; let mut x: isize = 1;
let y = box &mut x; let y = box &mut x;
let p = &y; let p = &y;
let q = &***p; let q = &***p;
@ -37,7 +37,7 @@ fn borrow_in_var_from_field() {
} }
fn borrow_in_field_from_var() { fn borrow_in_field_from_var() {
let mut x: int = 1; let mut x: isize = 1;
let y = B { a: box &mut x }; let y = B { a: box &mut x };
let p = &y.a; let p = &y.a;
let q = &***p; let q = &***p;

View file

@ -16,13 +16,13 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn borrow(_v: &int) {} fn borrow(_v: &isize) {}
fn borrow_mut(_v: &mut int) {} fn borrow_mut(_v: &mut isize) {}
fn cond() -> bool { panic!() } fn cond() -> bool { panic!() }
fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() } fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
fn produce<T>() -> T { panic!(); } fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<int>) { fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1); *v = box() (**v + 1);
} }

View file

@ -16,12 +16,12 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn borrow(_v: &int) {} fn borrow(_v: &isize) {}
fn borrow_mut(_v: &mut int) {} fn borrow_mut(_v: &mut isize) {}
fn cond() -> bool { panic!() } fn cond() -> bool { panic!() }
fn produce<T>() -> T { panic!(); } fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<int>) { fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1); *v = box() (**v + 1);
} }

View file

@ -16,13 +16,13 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn borrow(_v: &int) {} fn borrow(_v: &isize) {}
fn borrow_mut(_v: &mut int) {} fn borrow_mut(_v: &mut isize) {}
fn cond() -> bool { panic!() } fn cond() -> bool { panic!() }
fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() } fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
fn produce<T>() -> T { panic!(); } fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<int>) { fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1); *v = box() (**v + 1);
} }

View file

@ -12,7 +12,7 @@
use std::thread::Thread; use std::thread::Thread;
fn borrow<F>(v: &int, f: F) where F: FnOnce(&int) { fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
f(v); f(v);
} }

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn take(_v: Box<int>) { fn take(_v: Box<isize>) {
} }
fn box_imm() { fn box_imm() {

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn borrow<F>(v: &int, f: F) where F: FnOnce(&int) { fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
f(v); f(v);
} }

View file

@ -12,20 +12,20 @@ use std::ops::Add;
#[derive(Copy)] #[derive(Copy)]
struct Point { struct Point {
x: int, x: isize,
y: int, y: isize,
} }
impl Add<int> for Point { impl Add<isize> for Point {
type Output = int; type Output = isize;
fn add(self, z: int) -> int { fn add(self, z: isize) -> isize {
self.x + self.y + z self.x + self.y + z
} }
} }
impl Point { impl Point {
pub fn times(&self, z: int) -> int { pub fn times(&self, z: isize) -> isize {
self.x * self.y * z self.x * self.y * z
} }
} }

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
struct point { x: int, y: int } struct point { x: isize, y: isize }
trait methods { trait methods {
fn impurem(&self); fn impurem(&self);

View file

@ -12,17 +12,17 @@
// (locally rooted) mutable, unique vector, and that we then prevent // (locally rooted) mutable, unique vector, and that we then prevent
// modifications to the contents. // modifications to the contents.
fn takes_imm_elt<F>(_v: &int, f: F) where F: FnOnce() { fn takes_imm_elt<F>(_v: &isize, f: F) where F: FnOnce() {
f(); f();
} }
fn has_mut_vec_and_does_not_try_to_change_it() { fn has_mut_vec_and_does_not_try_to_change_it() {
let mut v: Vec<int> = vec!(1, 2, 3); let mut v: Vec<isize> = vec!(1, 2, 3);
takes_imm_elt(&v[0], || {}) takes_imm_elt(&v[0], || {})
} }
fn has_mut_vec_but_tries_to_change_it() { fn has_mut_vec_but_tries_to_change_it() {
let mut v: Vec<int> = vec!(1, 2, 3); let mut v: Vec<isize> = vec!(1, 2, 3);
takes_imm_elt( takes_imm_elt(
&v[0], &v[0],
|| { //~ ERROR cannot borrow `v` as mutable || { //~ ERROR cannot borrow `v` as mutable

View file

@ -11,11 +11,11 @@
// Test that immutable pattern bindings cannot be reassigned. // Test that immutable pattern bindings cannot be reassigned.
enum E { enum E {
Foo(int) Foo(isize)
} }
struct S { struct S {
bar: int, bar: isize,
} }
pub fn main() { pub fn main() {

View file

@ -13,6 +13,6 @@
pub fn main() { pub fn main() {
let bar = box 3; let bar = box 3;
let _g = |&mut:| { let _g = |&mut:| {
let _h = move |:| -> int { *bar }; //~ ERROR cannot move out of captured outer variable let _h = move |:| -> isize { *bar }; //~ ERROR cannot move out of captured outer variable
}; };
} }

View file

@ -45,7 +45,7 @@ fn move_in_match() {
// from issue-8064 // from issue-8064
struct A { struct A {
a: Box<int>, a: Box<isize>,
} }
fn free<T>(_: T) {} fn free<T>(_: T) {}

View file

@ -9,7 +9,7 @@
// except according to those terms. // except according to those terms.
fn foo(x: *const Box<int>) -> Box<int> { fn foo(x: *const Box<isize>) -> Box<isize> {
let y = *x; //~ ERROR dereference of unsafe pointer requires unsafe function or block let y = *x; //~ ERROR dereference of unsafe pointer requires unsafe function or block
return y; return y;
} }

View file

@ -10,7 +10,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn call_f<F:FnOnce() -> int>(f: F) -> int { fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
f() f()
} }

View file

@ -13,8 +13,8 @@
// //
// Example from src/middle/borrowck/doc.rs // Example from src/middle/borrowck/doc.rs
fn foo(t0: &mut int) { fn foo(t0: &mut isize) {
let p: &int = &*t0; // Freezes `*t0` let p: &isize = &*t0; // Freezes `*t0`
let t1 = t0; //~ ERROR cannot move out of `t0` let t1 = t0; //~ ERROR cannot move out of `t0`
*t1 = 22; *t1 = 22;
} }

View file

@ -13,7 +13,7 @@
use std::marker; use std::marker;
struct Foo { struct Foo {
foo: int, foo: isize,
nocopy: marker::NoCopy nocopy: marker::NoCopy
} }

View file

@ -14,7 +14,7 @@
#![feature(box_syntax)] #![feature(box_syntax)]
struct S { struct S {
x : Box<int> x : Box<isize>
} }
fn f<T>(_: T) {} fn f<T>(_: T) {}

View file

@ -9,8 +9,8 @@
// except according to those terms. // except according to those terms.
fn main() { fn main() {
let x: int = 3; let x: isize = 3;
let y: &mut int = &mut x; //~ ERROR cannot borrow let y: &mut isize = &mut x; //~ ERROR cannot borrow
*y = 5; *y = 5;
println!("{}", *y); println!("{}", *y);
} }

View file

@ -13,16 +13,16 @@
// //
// Example from src/middle/borrowck/doc.rs // Example from src/middle/borrowck/doc.rs
fn foo<'a>(mut t0: &'a mut int, fn foo<'a>(mut t0: &'a mut isize,
mut t1: &'a mut int) { mut t1: &'a mut isize) {
let p: &int = &*t0; // Freezes `*t0` let p: &isize = &*t0; // Freezes `*t0`
let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
**t2 += 1; // Mutates `*t0` **t2 += 1; // Mutates `*t0`
} }
fn bar<'a>(mut t0: &'a mut int, fn bar<'a>(mut t0: &'a mut isize,
mut t1: &'a mut int) { mut t1: &'a mut isize) {
let p: &mut int = &mut *t0; // Claims `*t0` let p: &mut isize = &mut *t0; // Claims `*t0`
let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
**t2 += 1; // Mutates `*t0` but not through `*p` **t2 += 1; // Mutates `*t0` but not through `*p`
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
fn write(v: &mut [int]) { fn write(v: &mut [isize]) {
v[0] += 1; v[0] += 1;
} }

View file

@ -9,11 +9,11 @@
// except according to those terms. // except according to those terms.
enum Enum<'a> { enum Enum<'a> {
A(&'a int), A(&'a isize),
B(bool), B(bool),
} }
fn foo() -> int { fn foo() -> isize {
let mut n = 42; let mut n = 42;
let mut x = Enum::A(&mut n); let mut x = Enum::A(&mut n);
match x { match x {

Some files were not shown because too many files have changed in this diff Show more