rollup merge of #20754: nikomatsakis/int-feature

Conflicts:
	src/test/compile-fail/borrowck-move-out-of-overloaded-auto-deref.rs
	src/test/compile-fail/issue-2590.rs
	src/test/compile-fail/lint-stability.rs
	src/test/compile-fail/slice-mut-2.rs
	src/test/compile-fail/std-uncopyable-atomics.rs
This commit is contained in:
Alex Crichton 2015-01-08 09:24:08 -08:00
commit 4281bd1932
835 changed files with 2403 additions and 2134 deletions

View file

@ -15,6 +15,6 @@ pub use use_from_trait_xc::Trait;
fn main() {
match () {
Trait { x: 42u } => () //~ ERROR use of trait `Trait` in a struct pattern
Trait { x: 42us } => () //~ ERROR use of trait `Trait` in a struct pattern
}
}

View file

@ -9,9 +9,9 @@
// 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() {
let _foo = unpack(|s| {

View file

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

View file

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

View file

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

View file

@ -11,5 +11,5 @@
// Test that the old repeating array syntax gives an error.
fn main() {
let _ = [0i, ..3]; //~ ERROR
let _ = [0is, ..3]; //~ ERROR
}

View file

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

View file

@ -18,17 +18,17 @@
target_arch = "x86_64"))]
pub fn main() {
// assignment not dead
let mut x: int = 0;
let mut x: isize = 0;
unsafe {
// extra colon
asm!("mov $1, $0" : "=r"(x) : "r"(5u), "0"(x) : : "cc");
asm!("mov $1, $0" : "=r"(x) : "r"(5us), "0"(x) : : "cc");
//~^ WARNING unrecognized option
}
assert_eq!(x, 5);
unsafe {
// comma in place of a colon
asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8u) : "cc", "volatile");
asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8us) : "cc", "volatile");
//~^ WARNING expected a clobber, found an option
}
assert_eq!(x, 13);

View file

@ -10,18 +10,18 @@
#![feature(asm)]
fn foo(x: int) { println!("{}", x); }
fn foo(x: isize) { println!("{}", x); }
#[cfg(any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm",
target_arch = "aarch64"))]
pub fn main() {
let x: int;
let x: isize;
x = 1; //~ NOTE prior assignment occurs here
foo(x);
unsafe {
asm!("mov $1, $0" : "=r"(x) : "r"(5u)); //~ ERROR re-assignment of immutable variable `x`
asm!("mov $1, $0" : "=r"(x) : "r"(5us)); //~ ERROR re-assignment of immutable variable `x`
}
foo(x);
}

View file

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

View file

@ -10,14 +10,14 @@
#![feature(asm)]
fn foo(x: int) { println!("{}", x); }
fn foo(x: isize) { println!("{}", x); }
#[cfg(any(target_arch = "x86",
target_arch = "x86_64",
target_arch = "arm",
target_arch = "aarch64"))]
pub fn main() {
let x: int;
let x: isize;
unsafe {
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.
fn test() {
let v: int;
let v: isize;
v = 1; //~ NOTE prior assignment occurs here
println!("v={}", v);
v = 2; //~ ERROR re-assignment of immutable variable

View file

@ -9,16 +9,16 @@
// except according to those terms.
struct cat {
meows : uint,
meows : usize,
how_hungry : int,
how_hungry : isize,
}
impl cat {
pub fn speak(&self) { self.meows += 1u; }
pub fn speak(&self) { self.meows += 1us; }
}
fn cat(in_x : uint, in_y : int) -> cat {
fn cat(in_x : usize, in_y : isize) -> cat {
cat {
meows: in_x,
how_hungry: in_y
@ -26,6 +26,6 @@ fn cat(in_x : uint, in_y : int) -> cat {
}
fn main() {
let nyan : cat = cat(52u, 99);
let nyan : cat = cat(52us, 99);
nyan.speak = |&:| println!("meow"); //~ ERROR attempted to take value of method
}

View file

@ -13,7 +13,7 @@
struct 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() {}

View file

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

View file

@ -18,9 +18,9 @@ pub trait Foo {
struct Bar;
impl Foo for int {
type A = uint;
fn boo(&self) -> uint { 42 }
impl Foo for isize {
type A = usize;
fn boo(&self) -> usize { 42 }
}
fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}

View file

@ -18,9 +18,9 @@ pub trait Foo {
struct Bar;
impl Foo for int {
type A = uint;
fn boo(&self) -> uint {
impl Foo for isize {
type A = usize;
fn boo(&self) -> usize {
42
}
}
@ -40,7 +40,7 @@ pub fn baz(x: &Foo<A=Bar>) {
pub fn main() {
let a = 42i;
let a = 42is;
foo1(a); //~ERROR expected usize, found struct Bar
baz(&a); //~ERROR expected usize, found struct Bar
}

View file

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

View file

@ -17,43 +17,43 @@ pub trait TheTrait<T> {
}
struct IntStruct {
x: int
x: isize
}
impl<'a> TheTrait<&'a int> for IntStruct {
type A = &'a int;
impl<'a> TheTrait<&'a isize> for IntStruct {
type A = &'a isize;
fn get(&self, t: &'a int) -> &'a int {
fn get(&self, t: &'a isize) -> &'a isize {
t
}
}
struct UintStruct {
x: int
x: isize
}
impl<'a> TheTrait<&'a int> for UintStruct {
type A = &'a uint;
impl<'a> TheTrait<&'a isize> for UintStruct {
type A = &'a usize;
fn get(&self, t: &'a int) -> &'a uint {
fn get(&self, t: &'a isize) -> &'a usize {
panic!()
}
}
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
}
fn bar<T>()
where T : for<'x> TheTrait<&'x int, A = &'x uint>
where T : for<'x> TheTrait<&'x isize, A = &'x usize>
{
// ok for UintStruct, but not IntStruct
}
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
}

View file

@ -19,24 +19,24 @@ pub trait Foo {
struct Bar;
impl Foo for int {
type A = uint;
impl Foo for isize {
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 = &42is as &Foo<A=usize, B=char>;
let b = &42i as &Foo<A=uint>;
let b = &42is 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>;
let c = &42is as &Foo<B=char>;
//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
let d = &42i as &Foo;
let d = &42is as &Foo;
//~^ ERROR the value of the associated type `A` (from the trait `Foo`) must be specified
//~| ERROR the value of the associated type `B` (from the trait `Foo`) must be specified
}

View file

@ -16,7 +16,7 @@ trait Foo<T> {
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();
//~^ ERROR the trait `Foo<usize>` is not implemented for the type `T`
}

View file

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

View file

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

View file

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

View file

@ -17,7 +17,7 @@ pub trait Foo<T> {
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 one of `::` or `>`
{

View file

@ -17,15 +17,15 @@ pub trait Foo<T> {
fn get(&self, t: T) -> Self::A;
}
fn foo<'a, I : for<'x> Foo<&'x int>>(
x: <I as Foo<&'a int>>::A)
fn foo<'a, I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&'a isize>>::A)
{
let y: I::A = x;
}
fn bar<'a, 'b, I : for<'x> Foo<&'x int>>(
x: <I as Foo<&'a int>>::A,
y: <I as Foo<&'b int>>::A,
fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&'a isize>>::A,
y: <I as Foo<&'b isize>>::A,
cond: bool)
{
// 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 foo2<I : for<'x> Foo<&'x int>>(
fn foo2<I : for<'x> Foo<&'x isize>>(
x: I::A)
//~^ 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.
}
fn foo3<I : for<'x> Foo<&'x int>>(
x: <I as Foo<&int>>::A)
fn foo3<I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&isize>>::A)
{
// OK, in this case we spelled out the precise regions involved, though we left one of
// them anonymous.
}
fn foo4<'a, I : for<'x> Foo<&'x int>>(
x: <I as Foo<&'a int>>::A)
fn foo4<'a, I : for<'x> Foo<&'x isize>>(
x: <I as Foo<&'a isize>>::A)
{
// 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;
}
struct SomeStruct<I : for<'x> Foo<&'x int>> {
struct SomeStruct<I : for<'x> Foo<&'x isize>> {
field: I::A
//~^ ERROR cannot extract an associated type from a higher-ranked trait bound in this context
}
struct AnotherStruct<I : for<'x> Foo<&'x int>> {
field: <I as Foo<&int>>::A
struct AnotherStruct<I : for<'x> Foo<&'x isize>> {
field: <I as Foo<&isize>>::A
//~^ ERROR missing lifetime specifier
}
struct YetAnotherStruct<'a, I : for<'x> Foo<&'x int>> {
field: <I as Foo<&'a int>>::A
struct YetAnotherStruct<'a, I : for<'x> Foo<&'x isize>> {
field: <I as Foo<&'a isize>>::A
}
pub fn main() {}

View file

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

View file

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

View file

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

View file

@ -28,7 +28,7 @@ fn main() {
assert_eq!(z, 21);
let forty: fish = fish{a: box 40};
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>`
println!("{}", answer);
assert_eq!(answer, 42);

View file

@ -10,8 +10,8 @@
// Tests that a function with a ! annotation always actually fails
fn bad_bang(i: uint) -> ! {
return 7u; //~ ERROR `return` in a function declared as diverging [E0166]
fn bad_bang(i: usize) -> ! {
return 7us; //~ ERROR `return` in a function declared as diverging [E0166]
}
fn main() { bad_bang(5u); }
fn main() { bad_bang(5us); }

View file

@ -10,8 +10,8 @@
// 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
if i < 0u { } else { panic!(); }
fn bad_bang(i: usize) -> ! { //~ ERROR computation may converge in a function marked as diverging
if i < 0us { } else { panic!(); }
}
fn main() { bad_bang(5u); }
fn main() { bad_bang(5us); }

View file

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

View file

@ -9,7 +9,7 @@
// except according to those terms.
// 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 main() { foo(2); }

View file

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

View file

@ -8,4 +8,4 @@
// option. This file may not be copied, modified, or distributed
// 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
fn main() {
let int x = 5;
let isize x = 5;
match x;
}

View file

@ -9,14 +9,14 @@
// except according to those terms.
fn foo<T:'static>() {
1u.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
1us.bar::<T>(); //~ ERROR `core::marker::Send` is not implemented
}
trait bar {
fn bar<T:Send>(&self);
}
impl bar for uint {
impl bar for usize {
fn bar<T:Send>(&self) {
}
}

View file

@ -33,11 +33,11 @@ trait Trait<T> {
}
struct S2 {
contents: int,
contents: isize,
}
impl Trait<int> for S2 {
fn new<U>(x: int, _: U) -> S2 {
impl Trait<isize> for S2 {
fn new<U>(x: isize, _: U) -> S2 {
S2 {
contents: x,
}
@ -45,16 +45,16 @@ impl Trait<int> for S2 {
}
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
let _ = S::<'a,int>::new::<f64>(1, 1.0);
let _ = S::<'a,isize>::new::<f64>(1, 1.0);
//~^ 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
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
}

View file

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

View file

@ -9,6 +9,6 @@
// except according to those terms.
fn f() -> ! { //~ ERROR computation may converge in a function marked as diverging
3i
3is
}
fn main() { }

View file

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

View file

@ -11,7 +11,7 @@
// 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() {
let red: color = rgb(255, 0, 0);

View file

@ -13,29 +13,29 @@
// 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
{
let mut x = 0u;
let mut x = 0us;
let _f = |&:| x = 42; //~ ERROR cannot assign
let mut y = 0u;
let mut y = 0us;
let _g = |&:| set(&mut y); //~ ERROR cannot borrow
let mut z = 0u;
let mut z = 0us;
let _h = |&mut:| { set(&mut z); |&:| z = 42; }; //~ ERROR cannot assign
}
// By-value captures
{
let mut x = 0u;
let mut x = 0us;
let _f = move |&:| x = 42; //~ ERROR cannot assign
let mut y = 0u;
let mut y = 0us;
let _g = move |&:| set(&mut y); //~ ERROR cannot borrow
let mut z = 0u;
let mut z = 0us;
let _h = move |&mut:| { set(&mut z); move |&:| z = 42; }; //~ ERROR cannot assign
}
}

View file

@ -11,33 +11,33 @@
#![allow(unknown_features)]
#![feature(box_syntax)]
struct Foo(Box<int>, int);
struct Foo(Box<isize>, isize);
struct Bar(int, int);
struct Bar(isize, isize);
fn main() {
let x = (box 1i, 2i);
let x = (box 1is, 2is);
let r = &x.0;
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
let mut x = (1i, 2i);
let mut x = (1is, 2is);
let a = &x.0;
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
let mut x = (1i, 2i);
let mut x = (1is, 2is);
let a = &mut x.0;
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
let x = Foo(box 1i, 2i);
let x = Foo(box 1is, 2is);
let r = &x.0;
let y = x; //~ ERROR cannot move out of `x` because it is borrowed
let mut x = Bar(1i, 2i);
let mut x = Bar(1is, 2is);
let a = &x.0;
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
let mut x = Bar(1i, 2i);
let mut x = Bar(1is, 2is);
let a = &mut x.0;
let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
}

View file

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

View file

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

View file

@ -12,7 +12,7 @@
// anonymous fields of a tuple vs the same anonymous field.
fn distinct_variant() {
let mut y = (1i, 2i);
let mut y = (1is, 2is);
let a = match y {
(ref mut a, _) => a
@ -27,7 +27,7 @@ fn distinct_variant() {
}
fn same_variant() {
let mut y = (1i, 2i);
let mut y = (1is, 2is);
let a = match y {
(ref mut a, _) => a

View file

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

View file

@ -12,9 +12,9 @@
#![feature(box_syntax)]
fn f() {
let mut a = [box 0i, box 1i];
let mut a = [box 0is, box 1is];
drop(a[0]);
a[1] = box 2i;
a[1] = box 2is;
drop(a[0]); //~ ERROR use of moved value: `a[..]`
}

View file

@ -9,22 +9,22 @@
// except according to those terms.
struct Point {
x: int,
y: int,
x: isize,
y: isize,
}
fn a() {
let mut p = vec!(1);
// Create an immutable pointer into p's contents:
let q: &int = &p[0];
let q: &isize = &p[0];
p[0] = 5; //~ ERROR cannot borrow
println!("{}", *q);
}
fn borrow<F>(_x: &[int], _f: F) where F: FnOnce() {}
fn borrow<F>(_x: &[isize], _f: F) where F: FnOnce() {}
fn b() {
// 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
// except according to those terms.
struct point { x: int, y: int }
struct point { x: isize, y: isize }
fn a() {
let mut p = point {x: 3, y: 4};
@ -16,7 +16,7 @@ fn a() {
// This assignment is illegal because the field x is not
// 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`
q.x;
}

View file

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

View file

@ -12,7 +12,7 @@
// borrowed (but otherwise non-aliasable) location is illegal.
struct S<'a> {
pointer: &'a mut int
pointer: &'a mut isize
}
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
// except according to those terms.
static foo: int = 5;
static foo: isize = 5;
fn main() {
// assigning to various global constants

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -11,9 +11,9 @@
// Test lifetimes are linked properly when we take reference
// 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
x
}

View file

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

View file

@ -32,25 +32,25 @@ impl<T> DerefMut for Own<T> {
}
struct Point {
x: int,
y: int
x: isize,
y: isize
}
impl Point {
fn get(&self) -> (int, int) {
fn get(&self) -> (isize, isize) {
(self.x, self.y)
}
fn set(&mut self, x: int, y: int) {
fn set(&mut self, x: isize, y: isize) {
self.x = x;
self.y = y;
}
fn x_ref(&self) -> &int {
fn x_ref(&self) -> &isize {
&self.x
}
fn y_mut(&mut self) -> &mut int {
fn y_mut(&mut self) -> &mut isize {
&mut self.y
}
}
@ -67,15 +67,15 @@ fn deref_mut_field2(mut x: Own<Point>) {
let _i = &mut x.y;
}
fn deref_extend_field(x: &Own<Point>) -> &int {
fn deref_extend_field(x: &Own<Point>) -> &isize {
&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
}
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
}
@ -126,15 +126,15 @@ fn deref_mut_method2(mut x: Own<Point>) {
x.set(0, 0);
}
fn deref_extend_method(x: &Own<Point>) -> &int {
fn deref_extend_method(x: &Own<Point>) -> &isize {
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
}
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()
}

View file

@ -26,25 +26,25 @@ impl<T> Deref for Rc<T> {
}
struct Point {
x: int,
y: int
x: isize,
y: isize
}
impl Point {
fn get(&self) -> (int, int) {
fn get(&self) -> (isize, isize) {
(self.x, self.y)
}
fn set(&mut self, x: int, y: int) {
fn set(&mut self, x: isize, y: isize) {
self.x = x;
self.y = y;
}
fn x_ref(&self) -> &int {
fn x_ref(&self) -> &isize {
&self.x
}
fn y_mut(&mut self) -> &mut int {
fn y_mut(&mut self) -> &mut isize {
&mut self.y
}
}
@ -61,15 +61,15 @@ fn deref_mut_field2(mut x: Rc<Point>) {
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
}
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
}
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
}
@ -97,15 +97,15 @@ fn deref_mut_method2(mut x: Rc<Point>) {
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()
}
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
}
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
}

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;
}
fn deref_mut1(x: Own<int>) {
fn deref_mut1(x: Own<isize>) {
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;
}
fn deref_extend<'a>(x: &'a Own<int>) -> &'a int {
fn deref_extend<'a>(x: &'a Own<isize>) -> &'a isize {
&**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
}
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
}
fn assign1<'a>(x: Own<int>) {
fn assign1<'a>(x: Own<isize>) {
*x = 3; //~ ERROR cannot borrow
}
fn assign2<'a>(x: &'a Own<int>) {
fn assign2<'a>(x: &'a Own<isize>) {
**x = 3; //~ ERROR cannot borrow
}
fn assign3<'a>(x: &'a mut Own<int>) {
fn assign3<'a>(x: &'a mut Own<isize>) {
**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;
}
fn deref_mut1(x: Rc<int>) {
fn deref_mut1(x: Rc<isize>) {
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
}
fn deref_extend<'a>(x: &'a Rc<int>) -> &'a int {
fn deref_extend<'a>(x: &'a Rc<isize>) -> &'a isize {
&**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
}
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
}
fn assign1<'a>(x: Rc<int>) {
fn assign1<'a>(x: Rc<isize>) {
*x = 3; //~ ERROR cannot assign
}
fn assign2<'a>(x: &'a Rc<int>) {
fn assign2<'a>(x: &'a Rc<isize>) {
**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
}

View file

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

View file

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

View file

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

View file

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

View file

@ -56,8 +56,8 @@ fn test6() {
}
fn test7() {
fn foo<F>(_: F) where F: FnMut(Box<FnMut(int)>, int) {}
let mut f = |&mut: g: Box<FnMut(int)>, b: int| {};
fn foo<F>(_: F) where F: FnMut(Box<FnMut(isize)>, isize) {}
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
foo(f); //~ ERROR: cannot move out of captured outer variable
}, 3);

View file

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

View file

@ -13,53 +13,53 @@
#![feature(box_syntax)]
fn get(x: &int) -> int {
fn get(x: &isize) -> isize {
*x
}
fn set(x: &mut int) {
fn set(x: &mut isize) {
*x = 4;
}
fn a() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| x = 4;
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
}
fn b() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| set(&mut x);
let c2 = |&mut:| get(&x); //~ ERROR cannot borrow `x`
}
fn c() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| set(&mut x);
let c2 = |&mut:| x * 5; //~ ERROR cannot borrow `x`
}
fn d() {
let mut x = 3i;
let mut x = 3is;
let c2 = |&mut:| x * 5;
x = 5; //~ ERROR cannot assign
}
fn e() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| get(&x);
x = 5; //~ ERROR cannot assign
}
fn f() {
let mut x = box 3i;
let mut x = box 3is;
let c1 = |&mut:| get(&*x);
*x = 5; //~ ERROR cannot assign
}
fn g() {
struct Foo {
f: Box<int>
f: Box<isize>
}
let mut x = box Foo { f: box 3 };
@ -69,7 +69,7 @@ fn g() {
fn h() {
struct Foo {
f: Box<int>
f: Box<isize>
}
let mut x = box Foo { f: box 3 };

View file

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

View file

@ -15,29 +15,29 @@
#![feature(box_syntax)]
fn a() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| x = 4;
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;
}
fn b() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| set(&mut x);
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
}
fn c() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| x = 5;
let c2 = |&mut:| set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
}
fn d() {
let mut x = 3i;
let mut x = 3is;
let c1 = |&mut:| x = 5;
let c2 = |&mut:| { let _y = |&mut:| set(&mut x); }; // (nested closure)
//~^ ERROR cannot borrow `x` as mutable more than once
@ -45,7 +45,7 @@ fn d() {
fn g() {
struct Foo {
f: Box<int>
f: Box<isize>
}
let mut x = box Foo { f: box 3 };

View file

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

View file

@ -14,35 +14,35 @@
// may be *immutable*, but we cannot allow
// multiple borrows.
fn get(x: &int) -> int {
fn get(x: &isize) -> isize {
*x
}
fn set(x: &mut int) -> int {
fn set(x: &mut isize) -> isize {
*x
}
fn a(x: &mut int) {
fn a(x: &mut isize) {
let c1 = |&mut:| get(x);
let c2 = |&mut:| get(x);
}
fn b(x: &mut int) {
fn b(x: &mut isize) {
let c1 = |&mut:| get(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 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 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
}

View file

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

View file

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

View file

@ -13,11 +13,11 @@
#![feature(box_syntax)]
struct Foo {
a: [Box<int>; 3],
a: [Box<isize>; 3],
}
fn main() {
let mut y = 1i;
let mut y = 1is;
let x = Some(&mut y);
for &a in x.iter() { //~ ERROR cannot move out
}
@ -28,7 +28,7 @@ fn main() {
for &a in f.a.iter() { //~ ERROR cannot move out
}
let x = Some(box 1i);
let x = Some(box 1is);
for &a in x.iter() { //~ ERROR cannot move out
}
}

View file

@ -11,11 +11,11 @@
use std::iter::repeat;
fn main() {
let mut vector = vec![1u, 2];
let mut vector = vec![1us, 2];
for &x in vector.iter() {
let cap = vector.capacity();
vector.extend(repeat(0)); //~ ERROR cannot borrow
vector[1u] = 5u; //~ ERROR cannot borrow
vector[1us] = 5us; //~ ERROR cannot borrow
}
}

View file

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

View file

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

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let mut _a = 3i;
let mut _a = 3is;
let _b = &mut _a;
{
let _c = &*_b;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -12,11 +12,11 @@ extern crate collections;
use std::collections::HashSet;
struct Foo {
n: HashSet<int>,
n: HashSet<isize>,
}
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() {
fun(f);
}

View file

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

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = Some(box 1i);
let x = Some(box 1is);
match x {
Some(ref _y) => {
let _a = x; //~ ERROR cannot move

View file

@ -11,7 +11,7 @@
#![feature(box_syntax)]
fn main() {
let x = Some(box 1i);
let x = Some(box 1is);
match x {
Some(ref y) => {
let _b = *y; //~ ERROR cannot move out

View file

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

View file

@ -16,12 +16,12 @@
#![feature(box_syntax)]
fn borrow(_v: &int) {}
fn borrow_mut(_v: &mut int) {}
fn borrow(_v: &isize) {}
fn borrow_mut(_v: &mut isize) {}
fn cond() -> bool { panic!() }
fn produce<T>() -> T { panic!(); }
fn inc(v: &mut Box<int>) {
fn inc(v: &mut Box<isize>) {
*v = box() (**v + 1);
}
@ -41,7 +41,7 @@ fn block_overarching_alias_mut() {
let mut v = box 3;
let mut x = &mut v;
for _ in range(0i, 3) {
for _ in range(0is, 3) {
borrow(&*v); //~ ERROR cannot borrow
}
*x = box 5;
@ -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,15 @@ 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
}

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