mirror of https://github.com/rust-lang/rust.git
Update compile fail tests to use isize.
This commit is contained in:
parent
4f5a57e80e
commit
0c70ce1424
|
@ -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| {
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
|
||||
// error-pattern: parameters were supplied
|
||||
|
||||
fn f(x: int) { }
|
||||
fn f(x: isize) { }
|
||||
|
||||
fn main() { let i: (); i = f(); }
|
||||
|
|
|
@ -11,6 +11,6 @@
|
|||
|
||||
// error-pattern: mismatched types
|
||||
|
||||
fn f(x: int) { }
|
||||
fn f(x: isize) { }
|
||||
|
||||
fn main() { let i: (); i = f(()); }
|
||||
|
|
|
@ -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] = [0i, 1, 2]; //~ ERROR
|
||||
}
|
||||
|
|
|
@ -10,15 +10,15 @@
|
|||
|
||||
#![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 '+'
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
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");
|
||||
|
|
|
@ -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;
|
||||
x = 1; //~ NOTE prior assignment occurs here
|
||||
foo(x);
|
||||
unsafe {
|
||||
|
|
|
@ -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"(5u)); //~ ERROR output operand constraint lacks '='
|
||||
}
|
||||
|
|
|
@ -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`
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
struct cat {
|
||||
meows : uint,
|
||||
|
||||
how_hungry : int,
|
||||
how_hungry : isize,
|
||||
}
|
||||
|
||||
impl cat {
|
||||
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 {
|
||||
meows: in_x,
|
||||
how_hungry: in_y
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,7 +18,7 @@ pub trait Foo {
|
|||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for int {
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
fn boo(&self) -> uint { 42 }
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ pub trait Foo {
|
|||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for int {
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
fn boo(&self) -> uint {
|
||||
42
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
trait Foo {
|
||||
type A;
|
||||
fn bar() -> int;
|
||||
fn bar() -> isize;
|
||||
}
|
||||
|
||||
impl Foo for int {
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
fn bar() -> int { 42 }
|
||||
fn bar() -> isize { 42 }
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
impl<'a> TheTrait<&'a isize> for UintStruct {
|
||||
type A = &'a uint;
|
||||
|
||||
fn get(&self, t: &'a int) -> &'a uint {
|
||||
fn get(&self, t: &'a isize) -> &'a uint {
|
||||
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 uint>
|
||||
{
|
||||
// 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
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ pub trait Foo {
|
|||
|
||||
struct Bar;
|
||||
|
||||
impl Foo for int {
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
type B = char;
|
||||
fn boo(&self) -> uint {
|
||||
|
|
|
@ -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`
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ trait Trait {
|
|||
type Type;
|
||||
}
|
||||
|
||||
impl Trait for int {} //~ ERROR missing: `Type`
|
||||
impl Trait for isize {} //~ ERROR missing: `Type`
|
||||
|
||||
fn main() {}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ trait Get {
|
|||
}
|
||||
|
||||
struct Struct {
|
||||
x: int,
|
||||
x: isize,
|
||||
}
|
||||
|
||||
impl Struct {
|
||||
|
|
|
@ -14,7 +14,7 @@ pub trait Foo {
|
|||
type A;
|
||||
}
|
||||
|
||||
impl Foo for int {
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
}
|
||||
|
||||
|
@ -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`
|
||||
}
|
||||
|
||||
|
|
|
@ -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 `>`
|
||||
{
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
}
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -12,15 +12,15 @@
|
|||
|
||||
trait Foo {
|
||||
type A;
|
||||
fn bar() -> int;
|
||||
fn bar() -> isize;
|
||||
}
|
||||
|
||||
impl Foo for int {
|
||||
impl Foo for isize {
|
||||
type A = uint;
|
||||
fn bar() -> int { 42 }
|
||||
fn bar() -> isize { 42 }
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
let x: int = Foo::bar();
|
||||
let x: isize = Foo::bar();
|
||||
//~^ ERROR type annotations required
|
||||
}
|
||||
|
|
|
@ -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) { }
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(); }
|
||||
|
|
|
@ -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); }
|
||||
|
|
|
@ -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); }
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// error-pattern: expected
|
||||
|
||||
fn main() {
|
||||
let int x = 5;
|
||||
let isize x = 5;
|
||||
match x;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -11,5 +11,5 @@
|
|||
// error-pattern: expected
|
||||
|
||||
fn main() {
|
||||
let x.y::<int>.z foo;
|
||||
let x.y::<isize>.z foo;
|
||||
}
|
||||
|
|
|
@ -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`
|
||||
}
|
||||
|
|
|
@ -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 `:`
|
||||
_ => {}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -11,9 +11,9 @@
|
|||
#![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);
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
// Tests that auto-ref can't create mutable aliases to immutable memory.
|
||||
|
||||
struct Foo {
|
||||
x: int
|
||||
x: isize
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -17,8 +17,8 @@ struct Foo {
|
|||
impl Copy for Foo {}
|
||||
|
||||
struct Bar {
|
||||
int1: int,
|
||||
int2: int,
|
||||
int1: isize,
|
||||
int2: isize,
|
||||
}
|
||||
|
||||
impl Copy for Bar {}
|
||||
|
|
|
@ -16,8 +16,8 @@ struct Foo {
|
|||
impl Copy for Foo {}
|
||||
|
||||
struct Bar {
|
||||
int1: int,
|
||||
int2: int,
|
||||
int1: isize,
|
||||
int2: isize,
|
||||
}
|
||||
|
||||
impl Copy for Bar {}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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;
|
||||
|
||||
while 1i != 2 {
|
||||
break;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Foo {
|
||||
x: int,
|
||||
x: isize,
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
|
|
|
@ -13,11 +13,11 @@
|
|||
|
||||
#![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;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ fn f() {
|
|||
|
||||
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 };
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -20,7 +20,7 @@ fn a() {
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ fn d() {
|
|||
|
||||
fn g() {
|
||||
struct Foo {
|
||||
f: Box<int>
|
||||
f: Box<isize>
|
||||
}
|
||||
|
||||
let mut x = box Foo { f: box 3 };
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
struct Foo {
|
||||
x: int,
|
||||
x: isize,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#![feature(box_syntax)]
|
||||
|
||||
struct Foo {
|
||||
x: int
|
||||
x: isize
|
||||
}
|
||||
|
||||
impl Drop for Foo {
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#![feature(box_syntax)]
|
||||
|
||||
struct Foo {
|
||||
a: [Box<int>; 3],
|
||||
a: [Box<isize>; 3],
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -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 1i > 2 { x = 10; }
|
||||
foo(x); //~ ERROR use of possibly uninitialized variable: `x`
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
// 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;
|
||||
let x: isize;
|
||||
if 1i > 2 {
|
||||
println!("whoops");
|
||||
} else {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
|
||||
#[derive(Clone)]
|
||||
struct point {
|
||||
x: int,
|
||||
y: int,
|
||||
x: isize,
|
||||
y: isize,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
|
||||
fn test() {
|
||||
let v: int;
|
||||
let v: isize;
|
||||
v += 1; //~ ERROR use of possibly uninitialized variable: `v`
|
||||
v.clone();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
fn take(_v: Box<int>) {
|
||||
fn take(_v: Box<isize>) {
|
||||
}
|
||||
|
||||
fn box_imm() {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![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);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,20 +12,20 @@ use std::ops::Add;
|
|||
|
||||
#[derive(Copy)]
|
||||
struct Point {
|
||||
x: int,
|
||||
y: int,
|
||||
x: isize,
|
||||
y: isize,
|
||||
}
|
||||
|
||||
impl Add<int> for Point {
|
||||
type Output = int;
|
||||
impl Add<isize> for Point {
|
||||
type Output = isize;
|
||||
|
||||
fn add(self, z: int) -> int {
|
||||
fn add(self, z: isize) -> isize {
|
||||
self.x + self.y + z
|
||||
}
|
||||
}
|
||||
|
||||
impl Point {
|
||||
pub fn times(&self, z: int) -> int {
|
||||
pub fn times(&self, z: isize) -> isize {
|
||||
self.x * self.y * z
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
|
||||
struct point { x: int, y: int }
|
||||
struct point { x: isize, y: isize }
|
||||
|
||||
trait methods {
|
||||
fn impurem(&self);
|
||||
|
|
|
@ -12,17 +12,17 @@
|
|||
// (locally rooted) mutable, unique vector, and that we then prevent
|
||||
// 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();
|
||||
}
|
||||
|
||||
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], || {})
|
||||
}
|
||||
|
||||
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(
|
||||
&v[0],
|
||||
|| { //~ ERROR cannot borrow `v` as mutable
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
// Test that immutable pattern bindings cannot be reassigned.
|
||||
|
||||
enum E {
|
||||
Foo(int)
|
||||
Foo(isize)
|
||||
}
|
||||
|
||||
struct S {
|
||||
bar: int,
|
||||
bar: isize,
|
||||
}
|
||||
|
||||
pub fn main() {
|
||||
|
|
|
@ -13,6 +13,6 @@
|
|||
pub fn main() {
|
||||
let bar = box 3;
|
||||
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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ fn move_in_match() {
|
|||
|
||||
// from issue-8064
|
||||
struct A {
|
||||
a: Box<int>,
|
||||
a: Box<isize>,
|
||||
}
|
||||
|
||||
fn free<T>(_: T) {}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
// 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
|
||||
return y;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
#![feature(box_syntax)]
|
||||
|
||||
fn call_f<F:FnOnce() -> int>(f: F) -> int {
|
||||
fn call_f<F:FnOnce() -> isize>(f: F) -> isize {
|
||||
f()
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
//
|
||||
// Example from src/middle/borrowck/doc.rs
|
||||
|
||||
fn foo(t0: &mut int) {
|
||||
let p: &int = &*t0; // Freezes `*t0`
|
||||
fn foo(t0: &mut isize) {
|
||||
let p: &isize = &*t0; // Freezes `*t0`
|
||||
let t1 = t0; //~ ERROR cannot move out of `t0`
|
||||
*t1 = 22;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
use std::marker;
|
||||
|
||||
struct Foo {
|
||||
foo: int,
|
||||
foo: isize,
|
||||
nocopy: marker::NoCopy
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#![feature(box_syntax)]
|
||||
|
||||
struct S {
|
||||
x : Box<int>
|
||||
x : Box<isize>
|
||||
}
|
||||
|
||||
fn f<T>(_: T) {}
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
// except according to those terms.
|
||||
|
||||
fn main() {
|
||||
let x: int = 3;
|
||||
let y: &mut int = &mut x; //~ ERROR cannot borrow
|
||||
let x: isize = 3;
|
||||
let y: &mut isize = &mut x; //~ ERROR cannot borrow
|
||||
*y = 5;
|
||||
println!("{}", *y);
|
||||
}
|
||||
|
|
|
@ -13,16 +13,16 @@
|
|||
//
|
||||
// Example from src/middle/borrowck/doc.rs
|
||||
|
||||
fn foo<'a>(mut t0: &'a mut int,
|
||||
mut t1: &'a mut int) {
|
||||
let p: &int = &*t0; // Freezes `*t0`
|
||||
fn foo<'a>(mut t0: &'a mut isize,
|
||||
mut t1: &'a mut isize) {
|
||||
let p: &isize = &*t0; // Freezes `*t0`
|
||||
let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
|
||||
**t2 += 1; // Mutates `*t0`
|
||||
}
|
||||
|
||||
fn bar<'a>(mut t0: &'a mut int,
|
||||
mut t1: &'a mut int) {
|
||||
let p: &mut int = &mut *t0; // Claims `*t0`
|
||||
fn bar<'a>(mut t0: &'a mut isize,
|
||||
mut t1: &'a mut isize) {
|
||||
let p: &mut isize = &mut *t0; // Claims `*t0`
|
||||
let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
|
||||
**t2 += 1; // Mutates `*t0` but not through `*p`
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
fn write(v: &mut [int]) {
|
||||
fn write(v: &mut [isize]) {
|
||||
v[0] += 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,11 +9,11 @@
|
|||
// except according to those terms.
|
||||
|
||||
enum Enum<'a> {
|
||||
A(&'a int),
|
||||
A(&'a isize),
|
||||
B(bool),
|
||||
}
|
||||
|
||||
fn foo() -> int {
|
||||
fn foo() -> isize {
|
||||
let mut n = 42;
|
||||
let mut x = Enum::A(&mut n);
|
||||
match x {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue