Merge remote-tracking branch 'origin/master' into 0.11.0-release

Conflicts:
	src/libstd/lib.rs
This commit is contained in:
Alex Crichton 2014-07-02 11:08:21 -07:00
commit ff1dd44b40
715 changed files with 10358 additions and 8207 deletions

View file

@ -23,5 +23,5 @@ pub fn leaf<V>(value: V) -> TreeItem<V> {
}
fn main() {
BTree::<int> { node: leaf(1) };
BTree::<int> { node: leaf(1i) };
}

View file

@ -22,6 +22,6 @@ mod other {
}
pub fn foo(){
1+1;
1i+1;
}
}

View file

@ -64,7 +64,7 @@ pub mod testtypes {
// As with ty_str, what type should be used for ty_vec?
// Tests ty_ptr
pub type FooPtr = *u8;
pub type FooPtr = *const u8;
// Skipping ty_rptr

View file

@ -18,13 +18,13 @@ static global0: int = 4;
pub static global2: &'static int = &global0;
pub fn verify_same(a: &'static int) {
let a = a as *int as uint;
let b = &global as *int as uint;
let a = a as *const int as uint;
let b = &global as *const int as uint;
assert_eq!(a, b);
}
pub fn verify_same2(a: &'static int) {
let a = a as *int as uint;
let b = global2 as *int as uint;
let a = a as *const int as uint;
let b = global2 as *const int as uint;
assert_eq!(a, b);
}

View file

@ -15,7 +15,7 @@
// This also serves as a pipes test, because Arcs are implemented with pipes.
// ignore-pretty FIXME #15189
// no-pretty-expanded FIXME #15189
extern crate time;

View file

@ -15,7 +15,7 @@
// This also serves as a pipes test, because Arcs are implemented with pipes.
// ignore-pretty FIXME #15189
// no-pretty-expanded FIXME #15189
extern crate time;

View file

@ -21,7 +21,7 @@ use std::uint;
// return.
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

@ -183,7 +183,7 @@ fn main() {
if line.len() == 0u { continue; }
match (line.as_slice()[0] as char, proc_mode) {
match (line.as_bytes()[0] as char, proc_mode) {
// start processing if this is the one
('>', false) => {

View file

@ -1,12 +1,43 @@
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
// The Computer Language Benchmarks Game
// http://benchmarksgame.alioth.debian.org/
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// contributed by the Rust Project Developers
// Copyright (c) 2012-2014 The Rust Project Developers
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// - Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in
// the documentation and/or other materials provided with the
// distribution.
//
// - Neither the name of "The Computer Language Benchmarks Game" nor
// the name of "The Computer Language Shootout Benchmarks" nor the
// names of its contributors may be used to endorse or promote
// products derived from this software without specific prior
// written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
#![feature(macro_rules)]
#![feature(simd)]
#![allow(experimental)]

View file

@ -38,7 +38,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ignore-pretty FIXME #15189
// no-pretty-expanded FIXME #15189
#![feature(phase)]
#[phase(plugin)] extern crate green;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-pretty FIXME #15189
// no-pretty-expanded FIXME #15189
#![feature(phase)]
#![allow(non_snake_case_functions)]

View file

@ -17,7 +17,7 @@ extern crate green;
extern crate rustuv;
#[start]
fn start(argc: int, argv: **u8) -> int {
fn start(argc: int, argv: *const *const u8) -> int {
green::start(argc, argv, rustuv::event_loop, main)
}

View file

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

View file

@ -9,9 +9,9 @@
// except according to those terms.
fn f() {
let mut a = [box 0, box 1];
let mut a = [box 0i, box 1i];
drop(a[0]);
a[1] = box 2;
a[1] = box 2i;
drop(a[0]); //~ ERROR use of moved value: `a[..]`
}

View file

@ -14,7 +14,7 @@
use std::ops::Deref;
struct Rc<T> {
value: *T
value: *const T
}
impl<T> Deref<T> for Rc<T> {

View file

@ -14,7 +14,7 @@
use std::ops::Deref;
struct Rc<T> {
value: *T
value: *const T
}
impl<T> Deref<T> for Rc<T> {

View file

@ -11,14 +11,14 @@
fn foo() -> int {
let x: int;
while 1 != 2 {
while 1i != 2 {
break;
x = 0;
}
println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
return 17;
return 17i;
}
fn main() { println!("{}", foo()); }

View file

@ -21,37 +21,37 @@ fn set(x: &mut int) {
}
fn a() {
let mut x = 3;
let mut x = 3i;
let c1 = || x = 4;
let c2 = || x * 5; //~ ERROR cannot borrow `x`
}
fn b() {
let mut x = 3;
let mut x = 3i;
let c1 = || set(&mut x);
let c2 = || get(&x); //~ ERROR cannot borrow `x`
}
fn c() {
let mut x = 3;
let mut x = 3i;
let c1 = || set(&mut x);
let c2 = || x * 5; //~ ERROR cannot borrow `x`
}
fn d() {
let mut x = 3;
let mut x = 3i;
let c2 = || x * 5;
x = 5; //~ ERROR cannot assign
}
fn e() {
let mut x = 3;
let mut x = 3i;
let c1 = || get(&x);
x = 5; //~ ERROR cannot assign
}
fn f() {
let mut x = box 3;
let mut x = box 3i;
let c1 = || get(&*x);
*x = 5; //~ ERROR cannot assign
}

View file

@ -14,7 +14,7 @@
fn a() {
let mut x = 3;
let mut x = 3i;
let c1 = || x = 4;
let c2 = || x = 5; //~ ERROR cannot borrow `x` as mutable more than once
}
@ -24,19 +24,19 @@ fn set(x: &mut int) {
}
fn b() {
let mut x = 3;
let mut x = 3i;
let c1 = || set(&mut x);
let c2 = || set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
}
fn c() {
let mut x = 3;
let mut x = 3i;
let c1 = || x = 5;
let c2 = || set(&mut x); //~ ERROR cannot borrow `x` as mutable more than once
}
fn d() {
let mut x = 3;
let mut x = 3i;
let c1 = || x = 5;
let c2 = || { let _y = || set(&mut x); }; // (nested closure)
//~^ ERROR cannot borrow `x` as mutable more than once

View file

@ -11,6 +11,6 @@
fn foo(x: int) { println!("{}", x); }
fn main() {
let x: int; if 1 > 2 { x = 10; }
let x: int; if 1i > 2 { x = 10; }
foo(x); //~ ERROR use of possibly uninitialized variable: `x`
}

View file

@ -14,7 +14,7 @@ fn foo(x: int) { println!("{:?}", x); }
fn main() {
let x: int;
if 1 > 2 {
if 1i > 2 {
println!("whoops");
} else {
x = 10;

View file

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

View file

@ -9,11 +9,11 @@
// except according to those terms.
fn main() {
let x = Some(box 1);
match x {
Some(ref _y) => {
let _a = x; //~ ERROR cannot move
}
_ => {}
}
let x = Some(box 1i);
match x {
Some(ref _y) => {
let _a = x; //~ ERROR cannot move
}
_ => {}
}
}

View file

@ -9,11 +9,11 @@
// except according to those terms.
fn main() {
let x = Some(box 1);
match x {
Some(ref y) => {
let _b = *y; //~ ERROR cannot move out
}
_ => {}
}
let x = Some(box 1i);
match x {
Some(ref y) => {
let _b = *y; //~ ERROR cannot move out
}
_ => {}
}
}

View file

@ -35,20 +35,20 @@ fn guard() {
// Here the guard performs a borrow. This borrow "infects" all
// subsequent arms (but not the prior ones).
let mut a = box 3;
let mut b = box 4;
let mut a = box 3u;
let mut b = box 4u;
let mut w = &*a;
match 22 {
match 22i {
_ if cond() => {
b = box 5;
b = box 5u;
}
_ if link(&*b, &mut w) => {
b = box 6; //~ ERROR cannot assign
b = box 6u; //~ ERROR cannot assign
}
_ => {
b = box 7; //~ ERROR cannot assign
b = box 7u; //~ ERROR cannot assign
}
}

View file

@ -9,9 +9,9 @@
// except according to those terms.
fn f() {
let x = [1].iter(); //~ ERROR borrowed value does not live long enough
//~^^ NOTE reference must be valid for the block
//~^^ NOTE consider using a `let` binding to increase its lifetime
let x = [1i].iter(); //~ ERROR borrowed value does not live long enough
//~^^ NOTE reference must be valid for the block
//~^^ NOTE consider using a `let` binding to increase its lifetime
}
fn main() {

View file

@ -24,10 +24,10 @@ fn foo<'a>(x: &'a Gc<int>) -> &'a int {
}
fn bar() {
let a = 3;
let a = 3i;
let mut y = &a;
if true {
let x = box(GC) 3;
let x = box(GC) 3i;
y = &*x; //~ ERROR `*x` does not live long enough
}
}

View file

@ -43,7 +43,7 @@ pub fn main() {
}
}
match [1,2,3] {
match [1i,2,3] {
[x,_,_] => {
x += 1; //~ ERROR re-assignment of immutable variable `x`
}

View file

@ -12,7 +12,7 @@
// borrowed path.
fn main() {
let a = box box 2;
let a = box box 2i;
let b = &a;
let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed

View file

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

View file

@ -11,6 +11,6 @@
use std::rc::Rc;
pub fn main() {
let _x = Rc::new(vec!(1, 2)).move_iter();
let _x = Rc::new(vec!(1i, 2)).move_iter();
//~^ ERROR cannot move out of dereference of `&`-pointer
}

View file

@ -13,9 +13,9 @@ use std::task;
fn borrow<T>(_: &T) { }
fn different_vars_after_borrows() {
let x1 = box 1;
let x1 = box 1i;
let p1 = &x1;
let x2 = box 2;
let x2 = box 2i;
let p2 = &x2;
task::spawn(proc() {
drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
@ -26,9 +26,9 @@ fn different_vars_after_borrows() {
}
fn different_vars_after_moves() {
let x1 = box 1;
let x1 = box 1i;
drop(x1);
let x2 = box 2;
let x2 = box 2i;
drop(x2);
task::spawn(proc() {
drop(x1); //~ ERROR capture of moved value: `x1`
@ -37,7 +37,7 @@ fn different_vars_after_moves() {
}
fn same_var_after_borrow() {
let x = box 1;
let x = box 1i;
let p = &x;
task::spawn(proc() {
drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
@ -47,7 +47,7 @@ fn same_var_after_borrow() {
}
fn same_var_after_move() {
let x = box 1;
let x = box 1i;
drop(x);
task::spawn(proc() {
drop(x); //~ ERROR capture of moved value: `x`

View file

@ -28,12 +28,12 @@ pub fn main() {
borrow(x.f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = box(GC) F {f: box 4};
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x.f) as *int != &(*b_x) as *int);
assert!(&(*x.f) as *const int != &(*b_x) as *const int);
})
}

View file

@ -28,12 +28,12 @@ pub fn main() {
borrow(x.f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
*x = box(GC) F{f: box 4};
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x.f) as *int != &(*b_x) as *int);
assert!(&(*x.f) as *const int != &(*b_x) as *const int);
})
}

View file

@ -26,12 +26,12 @@ pub fn main() {
borrow(x, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x) as *int, &(*b_x) as *int);
assert_eq!(&(*x) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = box(GC) 22;
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x) as *int != &(*b_x) as *int);
assert!(&(*x) as *const int != &(*b_x) as *const int);
})
}

View file

@ -28,12 +28,12 @@ pub fn main() {
borrow((*x).f, |b_x| {
//~^ ERROR cannot borrow `x` as mutable because `*x.f` is also borrowed as immutable
assert_eq!(*b_x, 3);
assert_eq!(&(*x.f) as *int, &(*b_x) as *int);
assert_eq!(&(*x.f) as *const int, &(*b_x) as *const int);
//~^ NOTE borrow occurs due to use of `x` in closure
x = box(GC) F {f: box 4};
println!("&*b_x = {:p}", &(*b_x));
assert_eq!(*b_x, 3);
assert!(&(*x.f) as *int != &(*b_x) as *int);
assert!(&(*x.f) as *const int != &(*b_x) as *const int);
})
}

View file

@ -12,7 +12,7 @@
fn borrow(_v: &int) {}
fn local() {
let mut v = box 3;
let mut v = box 3i;
borrow(v);
}
@ -31,27 +31,27 @@ fn local_recs() {
}
fn aliased_imm() {
let mut v = box 3;
let mut v = box 3i;
let _w = &v;
borrow(v);
}
fn aliased_mut() {
let mut v = box 3;
let mut v = box 3i;
let _w = &mut v;
borrow(v); //~ ERROR cannot borrow `*v`
}
fn aliased_other() {
let mut v = box 3;
let mut w = box 4;
let mut v = box 3i;
let mut w = box 4i;
let _x = &mut w;
borrow(v);
}
fn aliased_other_reassign() {
let mut v = box 3;
let mut w = box 4;
let mut v = box 3i;
let mut w = box 4i;
let mut _x = &mut w;
_x = &mut v;
borrow(v); //~ ERROR cannot borrow `*v`

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let mut a = [1, 2, 3, 4];
let mut a = [1i, 2, 3, 4];
let t = match a {
[1, 2, ..tail] => tail,
_ => unreachable!()

View file

@ -10,7 +10,7 @@
fn a() {
let mut vec = [box 1, box 2, box 3];
let mut vec = [box 1i, box 2, box 3];
match vec {
[box ref _a, _, _] => {
vec[0] = box 4; //~ ERROR cannot assign
@ -19,7 +19,7 @@ fn a() {
}
fn b() {
let mut vec = vec!(box 1, box 2, box 3);
let mut vec = vec!(box 1i, box 2, box 3);
let vec: &mut [Box<int>] = vec.as_mut_slice();
match vec {
[.._b] => {
@ -29,7 +29,7 @@ fn b() {
}
fn c() {
let mut vec = vec!(box 1, box 2, box 3);
let mut vec = vec!(box 1i, box 2, box 3);
let vec: &mut [Box<int>] = vec.as_mut_slice();
match vec {
[_a, //~ ERROR cannot move out
@ -47,7 +47,7 @@ fn c() {
}
fn d() {
let mut vec = vec!(box 1, box 2, box 3);
let mut vec = vec!(box 1i, box 2, box 3);
let vec: &mut [Box<int>] = vec.as_mut_slice();
match vec {
[.._a, //~ ERROR cannot move out
@ -58,7 +58,7 @@ fn d() {
}
fn e() {
let mut vec = vec!(box 1, box 2, box 3);
let mut vec = vec!(box 1i, box 2, box 3);
let vec: &mut [Box<int>] = vec.as_mut_slice();
match vec {
[_a, _b, _c] => {} //~ ERROR cannot move out

View file

@ -10,7 +10,7 @@
fn f() -> int {
let mut x: int;
while 1 == 1 { x = 10; }
while 1i == 1 { x = 10; }
return x; //~ ERROR use of possibly uninitialized variable: `x`
}

View file

@ -21,6 +21,6 @@ impl <T: Share> Foo for T { }
fn main() {
let (tx, rx) = channel();
1193182.foo(tx);
assert!(rx.recv() == 1193182);
1193182i.foo(tx);
assert!(rx.recv() == 1193182i);
}

View file

@ -10,7 +10,7 @@
#![feature(macro_rules)]
static A: uint = { 1; 2 };
static A: uint = { 1u; 2 };
//~^ ERROR: blocks in constants are limited to items and tail expressions
static B: uint = { { } 2 };
@ -21,7 +21,7 @@ macro_rules! foo {
}
static C: uint = { foo!() 2 };
static D: uint = { let x = 4; 2 };
static D: uint = { let x = 4u; 2 };
//~^ ERROR: blocks in constants are limited to items and tail expressions
pub fn main() {

View file

@ -9,8 +9,8 @@
// except according to those terms.
static a: &'static str = "foo";
static b: *u8 = a as *u8; //~ ERROR non-scalar cast
static c: *u8 = &a as *u8; //~ ERROR mismatched types
static b: *const u8 = a as *const u8; //~ ERROR non-scalar cast
static c: *const u8 = &a as *const u8; //~ ERROR mismatched types
fn main() {
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
static a: [u8, ..3] = ['h' as u8, 'i' as u8, 0 as u8];
static b: *i8 = &a as *i8; //~ ERROR mismatched types
static b: *const i8 = &a as *const i8; //~ ERROR mismatched types
fn main() {
}

View file

@ -27,6 +27,7 @@ enum Enum {
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
}
}

View file

@ -27,6 +27,7 @@ enum Enum {
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
)
}

View file

@ -26,6 +26,7 @@ struct Struct {
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
}
fn main() {}

View file

@ -26,6 +26,7 @@ struct Struct(
//~^^^^^ ERROR
//~^^^^^^ ERROR
//~^^^^^^^ ERROR
//~^^^^^^^^ ERROR
);
fn main() {}

View file

@ -0,0 +1,19 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
let a = "".to_string();
let b: Vec<&str> = a.as_slice().lines().collect();
drop(a); //~ ERROR cannot move out of `a` because it is borrowed
for s in b.iter() {
println!("{}", *s);
}
}

View file

@ -0,0 +1,19 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn read_lines_borrowed() -> Vec<&str> {
let raw_lines: Vec<String> = vec!("foo ".to_string(), " bar".to_string());
raw_lines.iter().map(|l| l.as_slice().trim()).collect()
//~^ ERROR `raw_lines` does not live long enough
}
fn main() {
println!("{}", read_lines_borrowed());
}

View file

@ -11,6 +11,6 @@
fn main() {
for
&1 //~ ERROR refutable pattern in `for` loop binding
in [1].iter() {}
&1i //~ ERROR refutable pattern in `for` loop binding
in [1i].iter() {}
}

View file

@ -0,0 +1,17 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn foo(_: *const ()) {}
fn main() {
let a = 3; //~ ERROR cannot determine a type for this local variable
foo(&a as *const _ as *const ());
}

View file

@ -0,0 +1,15 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
println!("{}", std::mem::size_of_val(&1));
//~^ ERROR cannot determine a type for this expression
}

View file

@ -17,10 +17,10 @@ pub fn main() {
assert_eq!(v.as_slice()[3u32], 3); //~ ERROR: mismatched types
assert_eq!(v.as_slice()[3i32], 3); //~ ERROR: mismatched types
println!("{}", v.as_slice()[3u8]); //~ ERROR: mismatched types
assert_eq!(s.as_slice()[3u], 'd' as u8);
assert_eq!(s.as_slice()[3u8], 'd' as u8); //~ ERROR: mismatched types
assert_eq!(s.as_slice()[3i8], 'd' as u8); //~ ERROR: mismatched types
assert_eq!(s.as_slice()[3u32], 'd' as u8); //~ ERROR: mismatched types
assert_eq!(s.as_slice()[3i32], 'd' as u8); //~ ERROR: mismatched types
println!("{}", s.as_slice()[3u8]); //~ ERROR: mismatched types
assert_eq!(s.as_bytes()[3u], 'd' as u8);
assert_eq!(s.as_bytes()[3u8], 'd' as u8); //~ ERROR: mismatched types
assert_eq!(s.as_bytes()[3i8], 'd' as u8); //~ ERROR: mismatched types
assert_eq!(s.as_bytes()[3u32], 'd' as u8); //~ ERROR: mismatched types
assert_eq!(s.as_bytes()[3i32], 'd' as u8); //~ ERROR: mismatched types
println!("{}", s.as_bytes()[3u8]); //~ ERROR: mismatched types
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let x = box 1;
let x = box 1i;
let f: proc() = proc() {
let _a = x;
drop(x);

View file

@ -11,6 +11,6 @@
// This file must never have a trailing newline
fn main() {
let x = Some(3);
let y = x.as_ref().unwrap_or(&5); //~ ERROR: borrowed value does not live long enough
let x = Some(3i);
let y = x.as_ref().unwrap_or(&5i); //~ ERROR: borrowed value does not live long enough
}

View file

@ -9,8 +9,8 @@
// except according to those terms.
fn main() {
let mut v = vec!(1);
let f = || v.push(2);
let mut v = vec!(1i);
let f = || v.push(2i);
let _w = v; //~ ERROR: cannot move out of `v`
f();

View file

@ -10,7 +10,7 @@
fn main() {
let r = {
let x = box 42;
let x = box 42i;
let f = proc() &x; //~ ERROR: `x` does not live long enough
f()
};

View file

@ -14,7 +14,7 @@ fn main() {
loop {
let tx = tx;
//~^ ERROR: use of moved value: `tx`
tx.send(1);
tx.send(1i);
}
});
}

View file

@ -0,0 +1,21 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// this code used to cause an ICE
fn main() {
let t = Err(0);
match t {
Some(k) => match k { //~ ERROR mismatched types
a => println!("{}", a)
},
None => () //~ ERROR mismatched types
}
}

View file

@ -24,7 +24,7 @@ impl BarTy {
fn b(&self) {}
}
impl Foo for *BarTy {
impl Foo for *const BarTy {
fn bar(&self) {
baz();
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?
@ -76,7 +76,7 @@ impl Foo for Box<BarTy> {
}
}
impl Foo for *int {
impl Foo for *const int {
fn bar(&self) {
baz();
//~^ ERROR: unresolved name `baz`. Did you mean to call `self.baz`?

View file

@ -0,0 +1,19 @@
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Foo {
a: uint,
}
fn main(){
let Foo {a: _, a: _} = Foo {a: 29};
//~^ ERROR field `a` bound twice in pattern
}

View file

@ -10,9 +10,9 @@
// compile-flags: -D while-true
fn main() {
let mut i = 0;
let mut i = 0i;
while true { //~ ERROR denote infinite loops with loop
i += 1;
if i == 5 { break; }
i += 1i;
if i == 5i { break; }
}
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn bad (p: *int) {
fn bad (p: *const int) {
let _q: &int = p as &int; //~ ERROR non-scalar cast
}

View file

@ -11,6 +11,6 @@
enum bottom { }
fn main() {
let x = &() as *() as *bottom;
let x = &() as *const () as *const bottom;
match x { } //~ ERROR non-exhaustive patterns
}

View file

@ -10,7 +10,7 @@
#[deriving(PartialEq)]
struct thing(uint);
impl PartialOrd for thing { //~ ERROR not all trait methods implemented, missing: `lt`
impl PartialOrd for thing { //~ ERROR not all trait methods implemented, missing: `partial_cmp`
fn le(&self, other: &thing) -> bool { true }
fn ge(&self, other: &thing) -> bool { true }
}

View file

@ -14,7 +14,7 @@ struct Obj {
impl Obj {
pub fn boom() -> bool {
return 1+1 == 2
return 1i+1 == 2
}
pub fn chirp(&self) {
self.boom(); //~ ERROR `&Obj` does not implement any method in scope named `boom`
@ -24,5 +24,5 @@ impl Obj {
fn main() {
let o = Obj { member: 0 };
o.chirp();
1 + 1;
1i + 1;
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
#[start]
fn start(argc: int, argv: **u8, crate_map: *u8) -> int {
//~^ ERROR start function expects type: `fn(int, **u8) -> int`
fn start(argc: int, argv: *const *const u8, crate_map: *const u8) -> int {
//~^ ERROR start function expects type: `fn(int, *const *const u8) -> int`
0
}

View file

@ -60,8 +60,8 @@ fn test<'a,T,U:Copy>(_: &'a int) {
assert_copy::<||>(); //~ ERROR does not fulfill
// unsafe ptrs are ok
assert_copy::<*int>();
assert_copy::<*&'a mut int>();
assert_copy::<*const int>();
assert_copy::<*const &'a mut int>();
// regular old ints and such are ok
assert_copy::<int>();

View file

@ -52,8 +52,8 @@ fn test<'a,T,U:Send>(_: &'a int) {
// assert_send::<Box<Dummy+'a>>(); // ERROR does not fulfill `Send`
// unsafe ptrs are ok unless they point at unsendable things
assert_send::<*int>();
assert_send::<*&'a int>(); //~ ERROR does not fulfill `Send`
assert_send::<*const int>();
assert_send::<*const &'a int>(); //~ ERROR does not fulfill `Send`
}
fn main() {

View file

@ -11,7 +11,7 @@
#![feature(linkage)]
extern {
#[linkage = "foo"] static foo: *i32;
#[linkage = "foo"] static foo: *const i32;
//~^ ERROR: invalid linkage specified
}

View file

@ -15,11 +15,11 @@ extern crate libc;
extern {
pub fn bare_type1(size: int); //~ ERROR: found rust type
pub fn bare_type2(size: uint); //~ ERROR: found rust type
pub fn ptr_type1(size: *int); //~ ERROR: found rust type
pub fn ptr_type2(size: *uint); //~ ERROR: found rust type
pub fn ptr_type1(size: *const int); //~ ERROR: found rust type
pub fn ptr_type2(size: *const uint); //~ ERROR: found rust type
pub fn good1(size: *libc::c_int);
pub fn good2(size: *libc::c_uint);
pub fn good1(size: *const libc::c_int);
pub fn good2(size: *const libc::c_uint);
}
fn main() {

View file

@ -35,9 +35,9 @@ static priv_static: int = 0; //~ ERROR: code is never used
static used_static: int = 0;
pub static used_static2: int = used_static;
static USED_STATIC: int = 0;
static STATIC_USED_IN_ENUM_DISCRIMINANT: uint = 10;
static STATIC_USED_IN_ENUM_DISCRIMINANT: int = 10;
pub type typ = *UsedStruct4;
pub type typ = *const UsedStruct4;
pub struct PubStruct;
struct PrivStruct; //~ ERROR: code is never used
struct UsedStruct1 {
@ -58,11 +58,11 @@ struct StructUsedInEnum;
struct StructUsedInGeneric;
pub struct PubStruct2 {
#[allow(dead_code)]
struct_used_as_field: *StructUsedAsField
struct_used_as_field: *const StructUsedAsField
}
pub enum pub_enum { foo1, bar1 }
pub enum pub_enum2 { a(*StructUsedInEnum) }
pub enum pub_enum2 { a(*const StructUsedInEnum) }
pub enum pub_enum3 { Foo = STATIC_USED_IN_ENUM_DISCRIMINANT }
enum priv_enum { foo2, bar2 } //~ ERROR: code is never used
enum used_enum { foo3, bar3 }
@ -77,7 +77,7 @@ pub fn pub_fn() {
let e = foo3;
SemiUsedStruct::la_la_la();
let i = 1;
let i = 1i;
match i {
USED_STATIC => (),
_ => ()
@ -106,4 +106,4 @@ fn h() {}
// Similarly, lang items are live
#[lang="fail_"]
fn fail(_: *u8, _: *u8, _: uint) -> ! { loop {} }
fn fail(_: *const u8, _: *const u8, _: uint) -> ! { loop {} }

View file

@ -36,7 +36,7 @@ fn dead_fn2() {} //~ ERROR: code is never used
fn used_fn() {}
#[start]
fn start(_: int, _: **u8) -> int {
fn start(_: int, _: *const *const u8) -> int {
used_fn();
let foo = Foo;
foo.bar2();

View file

@ -54,8 +54,8 @@ mod blah {
enum c_void {}
extern {
fn free(p: *c_void);
fn malloc(size: size_t) -> *c_void;
fn free(p: *const c_void);
fn malloc(size: size_t) -> *const c_void;
}
pub fn baz() {
@ -65,7 +65,7 @@ mod blah {
enum c_void {} //~ ERROR: code is never used
extern {
fn free(p: *c_void); //~ ERROR: code is never used
fn free(p: *const c_void); //~ ERROR: code is never used
}
// Check provided method

View file

@ -21,11 +21,11 @@ struct Foo {
struct Bar { x: Box<int> } //~ ERROR type uses owned
fn main() {
let _x : Bar = Bar {x : box 10}; //~ ERROR type uses owned
let _x : Bar = Bar {x : box 10i}; //~ ERROR type uses owned
box(GC) 2; //~ ERROR type uses managed
box(GC) 2i; //~ ERROR type uses managed
box 2; //~ ERROR type uses owned
box 2i; //~ ERROR type uses owned
fn g(_: Box<Clone>) {} //~ ERROR type uses owned
proc() {}; //~ ERROR type uses owned
}

View file

@ -14,7 +14,7 @@
#[deriving(Clone)]
struct Foo {
x: *int //~ ERROR use of `#[deriving]` with a raw pointer
x: *const int //~ ERROR use of `#[deriving]` with a raw pointer
}
#[deriving(Clone)]
@ -22,14 +22,14 @@ struct Bar(*mut int); //~ ERROR use of `#[deriving]` with a raw pointer
#[deriving(Clone)]
enum Baz {
A(*int), //~ ERROR use of `#[deriving]` with a raw pointer
A(*const int), //~ ERROR use of `#[deriving]` with a raw pointer
B { x: *mut int } //~ ERROR use of `#[deriving]` with a raw pointer
}
#[deriving(Clone)]
struct Buzz {
x: (*int, //~ ERROR use of `#[deriving]` with a raw pointer
*uint) //~ ERROR use of `#[deriving]` with a raw pointer
x: (*const int, //~ ERROR use of `#[deriving]` with a raw pointer
*const uint) //~ ERROR use of `#[deriving]` with a raw pointer
}
fn main() {}

View file

@ -10,19 +10,42 @@
#![deny(unnecessary_parens)]
#[deriving(Eq, PartialEq)]
struct X { y: bool }
impl X {
fn foo(&self) -> bool { self.y }
}
fn foo() -> int {
return (1); //~ ERROR unnecessary parentheses around `return` value
return (1i); //~ ERROR unnecessary parentheses around `return` value
}
fn bar() -> X {
return (X { y: true }); //~ ERROR unnecessary parentheses around `return` value
}
fn main() {
foo();
bar();
if (true) {} //~ ERROR unnecessary parentheses around `if` condition
while (true) {} //~ ERROR unnecessary parentheses around `while` condition
match (true) { //~ ERROR unnecessary parentheses around `match` head expression
_ => {}
}
let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
_a = (0); //~ ERROR unnecessary parentheses around assigned value
_a += (1); //~ ERROR unnecessary parentheses around assigned value
let v = X { y: false };
// struct lits needs parens, so these shouldn't warn.
if (v == X { y: true }) {}
if (X { y: true } == v) {}
if (X { y: false }.y) {}
while (X { y: false }.foo()) {}
while (true | X { y: false }.y) {}
match (X { y: false }) {
_ => {}
}
let mut _a = (0i); //~ ERROR unnecessary parentheses around assigned value
_a = (0i); //~ ERROR unnecessary parentheses around assigned value
_a += (1i); //~ ERROR unnecessary parentheses around assigned value
}

View file

@ -55,7 +55,7 @@ mod bar {
pub mod c {
use foo::Point;
use foo::Square; //~ ERROR unused import
pub fn cc(p: Point) -> int { return 2 * (p.x + p.y); }
pub fn cc(p: Point) -> int { return 2i * (p.x + p.y); }
}
#[allow(unused_imports)]
@ -66,8 +66,8 @@ mod bar {
fn main() {
cal(foo::Point{x:3, y:9});
let mut a = 3;
let mut b = 4;
let mut a = 3i;
let mut b = 4i;
swap(&mut a, &mut b);
test::C.b();
let _a = foo();

View file

@ -18,16 +18,16 @@
fn main() {
// negative cases
let mut a = 3; //~ ERROR: variable does not need to be mutable
let mut a = 2; //~ ERROR: variable does not need to be mutable
let mut b = 3; //~ ERROR: variable does not need to be mutable
let mut a = vec!(3); //~ ERROR: variable does not need to be mutable
let (mut a, b) = (1, 2); //~ ERROR: variable does not need to be mutable
let mut a = 3i; //~ ERROR: variable does not need to be mutable
let mut a = 2i; //~ ERROR: variable does not need to be mutable
let mut b = 3i; //~ ERROR: variable does not need to be mutable
let mut a = vec!(3i); //~ ERROR: variable does not need to be mutable
let (mut a, b) = (1i, 2i); //~ ERROR: variable does not need to be mutable
match 30 {
match 30i {
mut x => {} //~ ERROR: variable does not need to be mutable
}
match (30, 2) {
match (30i, 2i) {
(mut x, 1) | //~ ERROR: variable does not need to be mutable
(mut x, 2) |
(mut x, 3) => {
@ -35,28 +35,28 @@ fn main() {
_ => {}
}
let x = |mut y: int| 10; //~ ERROR: variable does not need to be mutable
let x = |mut y: int| 10i; //~ ERROR: variable does not need to be mutable
fn what(mut foo: int) {} //~ ERROR: variable does not need to be mutable
// positive cases
let mut a = 2;
a = 3;
let mut a = 2i;
a = 3i;
let mut a = Vec::new();
a.push(3);
a.push(3i);
let mut a = Vec::new();
callback(|| {
a.push(3);
a.push(3i);
});
let (mut a, b) = (1, 2);
let (mut a, b) = (1i, 2i);
a = 34;
match 30 {
match 30i {
mut x => {
x = 21;
x = 21i;
}
}
match (30, 2) {
match (30i, 2i) {
(mut x, 1) |
(mut x, 2) |
(mut x, 3) => {
@ -65,12 +65,12 @@ fn main() {
_ => {}
}
let x = |mut y: int| y = 32;
fn nothing(mut foo: int) { foo = 37; }
let x = |mut y: int| y = 32i;
fn nothing(mut foo: int) { foo = 37i; }
// leading underscore should avoid the warning, just like the
// unused variable lint.
let mut _allowed = 1;
let mut _allowed = 1i;
}
fn callback(f: ||) {}
@ -78,6 +78,6 @@ fn callback(f: ||) {}
// make sure the lint attribute can be turned off
#[allow(unused_mut)]
fn foo(mut a: int) {
let mut a = 3;
let mut b = vec!(2);
let mut a = 3i;
let mut b = vec!(2i);
}

View file

@ -29,40 +29,40 @@ fn f1d() {
}
fn f2() {
let x = 3;
let x = 3i;
//~^ ERROR unused variable: `x`
}
fn f3() {
let mut x = 3;
let mut x = 3i;
//~^ ERROR variable `x` is assigned to, but never used
x += 4;
x += 4i;
//~^ ERROR value assigned to `x` is never read
}
fn f3b() {
let mut z = 3;
let mut z = 3i;
//~^ ERROR variable `z` is assigned to, but never used
loop {
z += 4;
z += 4i;
}
}
#[allow(unused_variable)]
fn f3c() {
let mut z = 3;
loop { z += 4; }
let mut z = 3i;
loop { z += 4i; }
}
#[allow(unused_variable)]
#[allow(dead_assignment)]
fn f3d() {
let mut x = 3;
x += 4;
let mut x = 3i;
x += 4i;
}
fn f4() {
match Some(3) {
match Some(3i) {
Some(i) => {
//~^ ERROR unused variable: `i`
}
@ -75,7 +75,7 @@ enum tri {
}
fn f4b() -> int {
match a(3) {
match a(3i) {
a(i) | b(i) | c(i) => {
i
}

View file

@ -9,9 +9,9 @@
// except according to those terms.
fn main() {
match 1 {
1 => 1, //~ ERROR mismatched types between arms
2u => 1,
_ => 2,
match 1i {
1i => 1i,
2u => 1i, //~ ERROR mismatched types
_ => 2i,
};
}

View file

@ -9,6 +9,6 @@
// except according to those terms.
fn main() {
match 0 { 1 => () } //~ ERROR non-exhaustive patterns
match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns
match 0i { 1i => () } //~ ERROR non-exhaustive patterns
match 0i { 0i if false => () } //~ ERROR non-exhaustive patterns
}

View file

@ -39,9 +39,9 @@ fn main() {
_ => {}
};
match 1.0 {
0.01 .. 6.5 => {}
0.02 => {}
match 1.0f64 {
0.01f64 .. 6.5f64 => {}
0.02f64 => {}
_ => {}
};
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn a() {
let v = [1, 2, 3];
let v = [1i, 2, 3];
match v {
[_, _, _] => {}
[_, _, _] => {} //~ ERROR unreachable pattern

View file

@ -25,13 +25,13 @@ fn f10() {
fn f20() {
let x = "hi".to_string();
let _y = (x, 3);
let _y = (x, 3i);
touch(&x); //~ ERROR use of moved value: `x`
}
fn f21() {
let x = vec!(1, 2, 3);
let _y = (*x.get(0), 3);
let x = vec!(1i, 2, 3);
let _y = (*x.get(0), 3i);
touch(&x);
}
@ -62,9 +62,9 @@ fn f50(cond: bool) {
let x = "hi".to_string();
let y = "ho".to_string();
let _y = match cond {
_ if guard(x) => 10,
true => 10,
false => 20,
_ if guard(x) => 10i,
true => 10i,
false => 20i,
};
touch(&x); //~ ERROR use of moved value: `x`
touch(&y);

View file

@ -11,7 +11,7 @@
use std::cell::RefCell;
fn main() {
let m = RefCell::new(0);
let m = RefCell::new(0i);
let mut b = m.borrow_mut();
let b1 = &mut *b;
let b2 = &mut *b; //~ ERROR cannot borrow

View file

@ -13,6 +13,6 @@ use std::cell::RefCell;
fn f<T: Share>(_: T) {}
fn main() {
let x = RefCell::new(0);
let x = RefCell::new(0i);
f(x); //~ ERROR: which does not fulfill `Share`
}

View file

@ -11,7 +11,7 @@
use std::cell::RefCell;
fn main() {
let m = RefCell::new(0);
let m = RefCell::new(0i);
let p;
{
let b = m.borrow();

View file

@ -13,7 +13,7 @@ use std::rc::Rc;
fn bar<T: Send>(_: T) {}
fn main() {
let x = Rc::new(5);
let x = Rc::new(5i);
bar(x);
//~^ ERROR instantiating a type parameter with an incompatible type `alloc::rc::Rc<int>`,
// which does not fulfill `Send`

View file

@ -14,7 +14,7 @@ use std::cell::RefCell;
fn bar<T: Share>(_: T) {}
fn main() {
let x = Rc::new(RefCell::new(5));
let x = Rc::new(RefCell::new(5i));
bar(x);
//~^ ERROR instantiating a type parameter with an incompatible type
// `std::rc::Rc<std::cell::RefCell<int>>`, which does not fulfill `Share`

View file

@ -11,8 +11,8 @@
extern crate libc;
fn main() {
let x : *Vec<int> = &vec!(1,2,3);
let y : *libc::c_void = x as *libc::c_void;
let x : *const Vec<int> = &vec!(1,2,3);
let y : *const libc::c_void = x as *const libc::c_void;
unsafe {
let _z = (*y).clone();
//~^ ERROR does not implement any method in scope

View file

@ -16,10 +16,10 @@ fn main() {
match true { //~ ERROR non-exhaustive patterns: `false` not covered
true => {}
}
match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
match Some(10i) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
None => {}
}
match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
match (2i, 3i, 4i) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
(_, _, 4) => {}
}
match (a, a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered
@ -35,20 +35,20 @@ fn main() {
(_, a) => {}
(b, b) => {}
}
let vec = vec!(Some(42), None, Some(21));
let vec = vec!(Some(42i), None, Some(21i));
let vec: &[Option<int>] = vec.as_slice();
match vec { //~ ERROR non-exhaustive patterns: `[]` not covered
[Some(..), None, ..tail] => {}
[Some(..), Some(..), ..tail] => {}
[None] => {}
}
let vec = vec!(1);
let vec = vec!(1i);
let vec: &[int] = vec.as_slice();
match vec {
[_, ..tail] => (),
[] => ()
}
let vec = vec!(0.5);
let vec = vec!(0.5f32);
let vec: &[f32] = vec.as_slice();
match vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
[0.1, 0.2, 0.3] => (),
@ -56,7 +56,7 @@ fn main() {
[0.1] => (),
[] => ()
}
let vec = vec!(Some(42), None, Some(21));
let vec = vec!(Some(42i), None, Some(21i));
let vec: &[Option<int>] = vec.as_slice();
match vec {
[Some(..), None, ..tail] => {}

View file

@ -184,4 +184,4 @@ pub mod mytest {
}
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -33,5 +33,5 @@ fn test2() {
//~^ ERROR unresolved import `bar::glob::foo`. There is no `foo` in `bar::glob`
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -30,4 +30,4 @@ fn test1() {
gpriv();
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -29,4 +29,4 @@ fn test2() {
gpriv();
}
#[start] fn main(_: int, _: **u8) -> int { 3 }
#[start] fn main(_: int, _: *const *const u8) -> int { 3 }

View file

@ -13,6 +13,6 @@ fn func((1, (Some(1), 2..3)): (int, (Option<int>, int))) { }
//~^ ERROR refutable pattern in function argument: `(_, _)` not covered
fn main() {
let (1, (Some(1), 2..3)) = (1, (None, 2));
let (1i, (Some(1i), 2i..3i)) = (1i, (None, 2i));
//~^ ERROR refutable pattern in local binding: `(_, _)` not covered
}

View file

@ -13,9 +13,9 @@ fn env<'a>(blk: |p: ||: 'a|) {
// the lifetime `'a`, which outlives the current
// block.
let mut state = 0;
let mut state = 0i;
let statep = &mut state;
blk(|| *statep = 1); //~ ERROR cannot infer
blk(|| *statep = 1i); //~ ERROR cannot infer
}
fn no_env_no_for<'a>(blk: |p: |||: 'a) {
@ -31,7 +31,7 @@ fn repeating_loop() {
// external to the loop.
let closure;
let state = 0;
let state = 0i;
loop {
closure = || state; //~ ERROR cannot infer
@ -47,7 +47,7 @@ fn repeating_while() {
// external to the loop.
let closure;
let state = 0;
let state = 0i;
while true {
closure = || state; //~ ERROR cannot infer

View file

@ -9,7 +9,7 @@
// except according to those terms.
fn main() {
let x = 3;
let x = 3i;
// Here, the variable `p` gets inferred to a type with a lifetime
// of the loop body. The regionck then determines that this type
@ -17,7 +17,7 @@ fn main() {
let mut p = &x;
loop {
let x = 1 + *p;
let x = 1i + *p;
p = &x; //~ ERROR `x` does not live long enough
}
}

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