Fix warnings it tests

This commit is contained in:
Erick Tryzelaar 2013-08-17 08:37:42 -07:00
parent e20d46056d
commit ad5c676853
400 changed files with 701 additions and 581 deletions

View File

@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::comm::*;
use std::task;
pub fn foo<T:Send + Clone>(x: T) -> Port<T> {

View File

@ -9,8 +9,6 @@
// except according to those terms.
pub mod kitties {
use std::uint;
pub struct cat {
priv meows : uint,
how_hungry : int,
@ -26,5 +24,4 @@ pub mod kitties {
how_hungry: in_y
}
}
}

View File

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use std::to_str::*;
pub mod kitty {
pub struct cat {
priv meows : uint,

View File

@ -20,7 +20,7 @@ pub mod name_pool {
}
impl add for name_pool {
fn add(&self, s: ~str) {
fn add(&self, _s: ~str) {
}
}
}

View File

@ -25,7 +25,7 @@ pub enum e {
pub fn nominal() -> e { e_val }
pub fn nominal_eq(e1: e, e2: e) -> bool { true }
pub fn nominal_eq(_e1: e, _e2: e) -> bool { true }
impl Eq for e {
fn eq(&self, other: &e) -> bool { nominal_eq(*self, *other) }

View File

@ -29,6 +29,6 @@ impl Eq for e {
pub fn nominal() -> e { e_val }
pub fn nominal_neq(e1: e, e2: e) -> bool { false }
pub fn nominal_neq(_e1: e, _e2: e) -> bool { false }
pub fn f() -> int { 20 }

View File

@ -35,9 +35,7 @@ fn arc<T:Freeze>(_data: T) -> arc_destruct<T> {
}
fn init() -> arc_destruct<context_res> {
unsafe {
arc(context_res())
}
arc(context_res())
}
struct context_res {

View File

@ -14,7 +14,7 @@
enum maybe<T> { just(T), nothing }
impl <T:Clone> Index<uint,T> for maybe<T> {
fn index(&self, idx: &uint) -> T {
fn index(&self, _idx: &uint) -> T {
match self {
&just(ref t) => (*t).clone(),
&nothing => { fail!(); }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(unused_imports)];
extern mod issue_2316_a;
pub mod cloth {

View File

@ -23,5 +23,5 @@ impl Drop for S {
pub fn f() {
let x = S { x: 1 };
let y = x;
let z = y;
let _z = y;
}

View File

@ -19,7 +19,7 @@ impl A for Something {
trait B<T> {
fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
fn staticthing<U>(z: &Self, x: T, y: U) -> (T, U) { (x, y) }
fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
}
impl<T> B<T> for int { }

View File

@ -13,14 +13,11 @@
extern mod extra;
use extra::time::precise_time_s;
use std::int;
use std::io;
use std::os;
use std::rand::RngUtil;
use std::rand;
use std::result;
use std::str;
use std::uint;
use std::util;
use std::vec;

View File

@ -21,7 +21,6 @@ use extra::arc;
use extra::future;
use extra::time;
use std::cell::Cell;
use std::io;
use std::os;
use std::uint;

View File

@ -21,7 +21,6 @@ use extra::arc;
use extra::future;
use extra::time;
use std::cell::Cell;
use std::io;
use std::os;
use std::uint;

View File

@ -1,7 +1,6 @@
// Perlin noise benchmark from https://gist.github.com/1170424
use std::float;
use std::int;
use std::rand::{Rng, RngUtil};
use std::rand;

View File

@ -10,7 +10,6 @@
extern mod extra;
use std::task::spawn;
use std::os;
use std::uint;
use std::rt::test::spawntask_later;

View File

@ -10,7 +10,6 @@
extern mod extra;
use std::task::spawn;
use std::os;
use std::uint;
use std::rt::test::spawntask_later;

View File

@ -11,7 +11,6 @@
extern mod extra;
use std::int;
use std::io;
use std::os;
fn ack(m: int, n: int) -> int {

View File

@ -22,9 +22,7 @@ use std::io;
use std::os;
use std::rand::Rng;
use std::rand;
use std::result;
use std::str;
use std::uint;
static LINE_LENGTH: uint = 60u;

View File

@ -11,7 +11,6 @@
extern mod extra;
use std::int;
use std::io;
use std::os;
fn fib(n: int) -> int {

View File

@ -22,7 +22,6 @@ use std::io::ReaderUtil;
use std::io;
use std::option;
use std::os;
use std::result;
use std::str;
use std::task;
use std::util;

View File

@ -15,7 +15,6 @@ extern mod extra;
use std::io::{ReaderUtil, WriterUtil};
use std::io;
use std::os;
use std::u8;
use std::uint;
use std::unstable::intrinsics::cttz16;
use std::vec;

View File

@ -14,5 +14,5 @@ fn foo(x: int) -> int {
#[no_mangle]
fn test() {
let x = foo(10);
let _x = foo(10);
}

View File

@ -51,6 +51,8 @@
// debugger:print f64
// check:$15 = 3.5
#[allow(unused_variable)];
fn main() {
let b: bool = false;
let i: int = -1;

View File

@ -62,6 +62,8 @@
// debugger:print *f64_ref
// check:$15 = 3.5
#[allow(unused_variable)];
fn main() {
let bool_val: bool = true;
let bool_ref: &bool = &bool_val;

View File

@ -24,6 +24,8 @@
// debugger:print *the_c_ref
// check:$3 = TheC
#[allow(unused_variable)];
enum ABC { TheA, TheB, TheC }
fn main() {

View File

@ -24,6 +24,8 @@
// debugger:print *univariant_ref
// check:$3 = {4820353753753434}
#[allow(unused_variable)];
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when
// datatype layout should be predictable as in this case.

View File

@ -62,6 +62,7 @@
// debugger:print *f64_ref
// check:$15 = 3.5
#[allow(unused_variable)];
fn main() {
let bool_box: @bool = @true;

View File

@ -45,7 +45,7 @@
// debugger:print *unique_val_interior_ref_2
// check:$10 = 26.5
#[allow(unused_variable)];
struct SomeStruct {
x: int,

View File

@ -27,6 +27,8 @@
// debugger:print *unique_val_ref
// check:$4 = {-17, -22}
#[allow(unused_variable)];
fn main() {
let stack_val: (i16, f32) = (-14, -19f32);
let stack_val_ref: &(i16, f32) = &stack_val;

View File

@ -62,6 +62,8 @@
// debugger:print *f64_ref
// check:$15 = 3.5
#[allow(unused_variable)];
fn main() {
let bool_box: ~bool = ~true;

View File

@ -24,6 +24,8 @@
// debugger:print d->val
// check:$4 = false
#[allow(unused_variable)];
fn main() {
let a = ~1;
let b = ~(2, 3.5);

View File

@ -27,6 +27,8 @@
// debugger:print managed_dtor->val
// check:$4 = {x = 33, y = 333, z = 3333, w = 33333}
#[allow(unused_variable)];
struct StructWithSomePadding {
x: i16,
y: i32,

View File

@ -25,6 +25,8 @@
// debugger:print *((uint64_t[4]*)(unique->elements))
// check:$4 = {10, 11, 12, 13}
#[allow(unused_variable)];
fn main() {
let managed: @[i64] = @[7, 8, 9];

View File

@ -36,6 +36,8 @@
// debugger:print struct_with_drop
// check:$7 = {{a = OneHundred, b = Vienna}, 9}
#[allow(unused_variable)];
enum AnEnum {
OneHundred = 100,
OneThousand = 1000,

View File

@ -36,6 +36,8 @@
// debugger:print single_variant
// check:$7 = TheOnlyVariant
#[allow(unused_variable)];
enum AutoDiscriminant {
One,
Two,

View File

@ -181,6 +181,7 @@
// check:$49 = 62
// debugger:continue
#[allow(unused_variable)];
struct Struct {
a: i64,

View File

@ -125,6 +125,7 @@
// debugger:print *nn
// check:$43 = 56
#[allow(unused_variable)];
struct Struct {
a: i64,

View File

@ -30,6 +30,8 @@
// debugger:print struct_padded_at_end
// check:$5 = {x = {22, 23}, y = {24, 25}}
#[allow(unused_variable)];
struct NoPadding1 {
x: [u32, ..3],
y: i32,

View File

@ -24,6 +24,8 @@
// debugger:print univariant->val
// check:$3 = {-9747455}
#[allow(unused_variable)];
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when
// datatype layout should be predictable as in this case.

View File

@ -27,6 +27,8 @@
// debugger:print unique->val.elements[3]->val
// check:$4 = 13
#[allow(unused_variable)];
fn main() {
let unique: ~[@i64] = ~[@10, @11, @12, @13];

View File

@ -25,6 +25,8 @@
// debugger:print managed_within_unique.val->y->val
// check:$3 = -4
#[allow(unused_variable)];
struct ContainsManaged
{
x: int,

View File

@ -28,6 +28,8 @@
// debugger:print abc
// check:$3 = 30303
#[allow(unused_variable)];
fn function_one() {
let abc = 10101;
zzz();

View File

@ -28,6 +28,8 @@
// debugger:print c
// check:$3 = 30303
#[allow(unused_variable)];
fn function_one() {
let a = 10101;
zzz();

View File

@ -21,6 +21,8 @@
// debugger:print second
// check:$2 = {<No data fields>}
#[allow(unused_variable)];
enum ANilEnum {}
enum AnotherNilEnum {}

View File

@ -41,6 +41,8 @@
// debugger:print deeplyNested
// check:$8 = {a = {a = 1, b = {x = 2, y = 3, z = 4}, c = 5, d = {x = 6, y = 7, z = 8}}, b = {a = 9, b = {x = 10, y = 11, z = 12}, c = {x = 13, y = 14, z = 15}, d = 16}, c = {a = 17, b = {x = 18, y = 19, z = 20}, c = 21, d = {x = 22, y = 23, z = 24}}, d = {a = 25, b = {x = 26, y = 27, z = 28}, c = 29, d = {x = 30, y = 31, z = 32}}, e = {a = 33, b = {x = 34, y = 35, z = 36}, c = {x = 37, y = 38, z = 39}, d = 40}, f = {a = 41, b = {x = 42, y = 43, z = 44}, c = 45, d = {x = 46, y = 47, z = 48}}}
#[allow(unused_variable)];
#[packed]
struct Packed {
x: i16,

View File

@ -34,6 +34,8 @@
// debugger:print sizeof(packedInPacked)
// check:$6 = 40
#[allow(unused_variable)];
#[packed]
struct Packed {
x: i16,

View File

@ -34,6 +34,7 @@
// debugger:print padding_at_end
// check:$6 = {x = -10014, y = 10015}
#[allow(unused_variable)];
struct NoPadding16 {
x: u16,

View File

@ -33,6 +33,7 @@
// debugger:print paddingAtEnd
// check:$7 = {15, 16}
#[allow(unused_variable)];
fn main() {
let noPadding8: (i8, u8) = (-100, 100);

View File

@ -25,6 +25,8 @@
// debugger:print univariant
// check:$3 = {{x = 123, y = 456, z = 789}}
#[allow(unused_variable)];
struct Struct {
x: u32,
y: i32,

View File

@ -25,6 +25,7 @@
// debugger:print padding_at_end_parent
// check:$3 = {x = {x = 10, y = 11}, y = {x = 12, y = 13}, z = {x = 14, y = 15}}
#[allow(unused_variable)];
struct Simple {
x: i32

View File

@ -28,6 +28,8 @@
// debugger:print univariant
// check:$4 = {a = -1}
#[allow(unused_variable)];
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when
// datatype layout should be predictable as in this case.

View File

@ -26,6 +26,8 @@
// debugger:print nested
// check:$4 = {a = {a = {x = 7890, y = 9870}}}
#[allow(unused_variable)];
struct NoDestructor {
x: i32,
y: i64

View File

@ -41,6 +41,8 @@
// debugger:print mixed_padding
// check:$10 = {x = {{40, 41, 42}, {43, 44}}, y = {45, 46, 47, 48}}
#[allow(unused_variable)];
struct NoPadding1 {
x: (i32, i32),
y: i32,

View File

@ -33,6 +33,8 @@
// debugger:print padding_at_end2
// check:$7 = {{21, 22}, 23}
#[allow(unused_variable)];
fn main() {
let no_padding1: ((u32, u32), u32, u32) = ((0, 1), 2, 3);
let no_padding2: (u32, (u32, u32), u32) = (4, (5, 6), 7);

View File

@ -28,6 +28,8 @@
// debugger:print univariant
// check:$4 = {-1}
#[allow(unused_variable)];
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when
// datatype layout should be predictable as in this case.

View File

@ -24,6 +24,8 @@
// debugger:print *univariant
// check:$3 = {123234}
#[allow(unused_variable)];
// The first element is to ensure proper alignment, irrespective of the machines word size. Since
// the size of the discriminant value is machine dependent, this has be taken into account when
// datatype layout should be predictable as in this case.

View File

@ -47,6 +47,8 @@
// debugger:print padded_struct.data_ptr[1]
// check:$13 = {x = 13, y = 14, z = 15}
#[allow(unused_variable)];
struct AStruct {
x: i16,
y: i32,

View File

@ -18,6 +18,8 @@
// debugger:print a
// check:$1 = {1, 2, 3}
#[allow(unused_variable)];
fn main() {
let a = [1, 2, 3];

View File

@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn blk1(b: &fn()) -> @fn() { return || { }; }
fn blk1(_b: &fn()) -> @fn() { return || { }; }
fn test1() { (do blk1 { info!("hi"); })(); }

View File

@ -16,5 +16,5 @@
fn id(f: &fn() -> int) -> int { f() }
fn wsucc(n: int) -> int { (do id || { 1 }) - 0 }
fn wsucc(_n: int) -> int { (do id || { 1 }) - 0 }
fn main() { }

View File

@ -10,8 +10,8 @@
// pp-exact
fn from_foreign_fn(x: extern "Rust" fn()) { }
fn from_stack_closure(x: &fn()) { }
fn from_box_closure(x: @fn()) { }
fn from_unique_closure(x: ~fn()) { }
fn from_foreign_fn(_x: extern "Rust" fn()) { }
fn from_stack_closure(_x: &fn()) { }
fn from_box_closure(_x: @fn()) { }
fn from_unique_closure(_x: ~fn()) { }
fn main() { }

View File

@ -10,9 +10,11 @@
// pp-exact
fn f(v: &[int]) {
fn f(v: &[int]) -> int {
let mut n = 0;
for e in v.iter() {
n = *e; // This comment once triggered pretty printer bug
}
n
}

View File

@ -15,11 +15,11 @@
fn main() {
let x = Some(3);
let y =
let _y =
match x {
Some(_) =>
~"some" + ~"very" + ~"very" + ~"very" + ~"very" + ~"very" +
~"very" + ~"very" + ~"very" + ~"long" + ~"string",
~"some" + "very" + "very" + "very" + "very" + "very" + "very" +
"very" + "very" + "long" + "string",
None => ~"none"
};
}

View File

@ -12,5 +12,5 @@
fn main() {
let x = Some(3);
let y = match x { Some(_) => ~"some(_)", None => ~"none" };
let _y = match x { Some(_) => ~"some(_)", None => ~"none" };
}

View File

@ -5,6 +5,6 @@ struct Bar(int, int);
fn main() {
struct Foo2;
struct Bar2(int, int, int);
let a = Bar(5, 5);
let b = Foo;
let _a = Bar(5, 5);
let _b = Foo;
}

View File

@ -12,7 +12,7 @@
// Testing that comments are correctly interleaved
// pp-exact:vec-comments.pp
fn main() {
let v1 =
let _v1 =
~[
// Comment
0,
@ -20,11 +20,11 @@ fn main() {
1,
// Comment
2];
let v2 =
let _v2 =
~[0, // Comment
1, // Comment
2]; // Comment
let v3 =
let _v3 =
~[
/* Comment */
0,
@ -32,7 +32,7 @@ fn main() {
1,
/* Comment */
2];
let v4 =
let _v4 =
~[0, /* Comment */
1, /* Comment */
2]; /* Comment */

View File

@ -12,7 +12,7 @@
// Testing that comments are correctly interleaved
// pp-exact:vec-comments.pp
fn main() {
let v1 =
let _v1 =
~[
// Comment
0,
@ -20,11 +20,11 @@ fn main() {
1,
// Comment
2];
let v2 =
let _v2 =
~[0, // Comment
1, // Comment
2]; // Comment
let v3 =
let _v3 =
~[
/* Comment */
0,
@ -32,7 +32,7 @@ fn main() {
1,
/* Comment */
2];
let v4 =
let _v4 =
~[0, /* Comment */
1, /* Comment */
2]; /* Comment */

View File

@ -10,6 +10,6 @@
// pp-exact:vec-type.pp
fn f1(x: ~[int]) { }
fn f1(_x: ~[int]) { }
fn g1() { f1(~[1, 2, 3]); }

View File

@ -10,6 +10,6 @@
// pp-exact:vec-type.pp
fn f1(x: ~[int]) { }
fn f1(_x: ~[int]) { }
fn g1() { f1(~[1, 2, 3]); }

View File

@ -9,6 +9,6 @@
// except according to those terms.
// error-pattern:meep
fn f(a: int, b: int, c: @int) { fail!("moop"); }
fn f(_a: int, _b: int, _c: @int) { fail!("moop"); }
fn main() { f(1, fail!("meep"), @42); }

View File

@ -14,7 +14,7 @@ fn main() {
let c = @mut b;
// this should freeze `a` only
let x: &mut [int] = c[0];
let _x: &mut [int] = c[0];
// hence this should fail
a[0] = a[0];

View File

@ -9,7 +9,7 @@ struct S {
fn main() {
let x = @mut S { x: 3 };
let y: &S = x;
let _y: &S = x;
let z = x;
z.x = 5;
}

View File

@ -5,7 +5,7 @@
fn main() {
let x = @mut 3;
let y: &mut int = x;
let _y: &mut int = x;
let z = x;
*z = 5;
}

View File

@ -10,7 +10,7 @@ impl Foo for int {
}
}
fn it_takes_two(f: &Foo, g: &mut Foo) {
fn it_takes_two(_f: &Foo, _g: &mut Foo) {
}
fn main() {

View File

@ -14,6 +14,6 @@ fn add2(_:&mut int)
pub fn main()
{
let a = @mut 3;
let b = &*a; // freezes a
let _b = &*a; // freezes a
add1(a);
}

View File

@ -14,6 +14,6 @@ fn add2(_:&int)
pub fn main()
{
let a = @mut 3;
let b = &mut *a; // freezes a
let _b = &mut *a; // freezes a
add1(a);
}

View File

@ -19,6 +19,6 @@ struct chan_t<T> {
port: port_id,
}
fn send<T:Send>(ch: chan_t<T>, data: T) { fail!(); }
fn send<T:Send>(_ch: chan_t<T>, _data: T) { fail!(); }
fn main() { fail!("quux"); }

View File

@ -1,5 +1,5 @@
// error-pattern:test
fn main() {
let i: int = fail!("test");
let _i: int = fail!("test");
}

View File

@ -11,5 +11,5 @@
// error-pattern:attempted to divide by zero
fn main() {
let y = 0;
let z = 1 / y;
let _z = 1 / y;
}

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(unreachable_code)];
//error-pattern:One
fn main() {
fail!("One");

View File

@ -8,7 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(dead_assignment)];
#[allow(unused_variable)];
// error-pattern:wooooo
fn main() {
let mut a = 1; if 1 == 1 { a = 2; } fail!(~"woooo" + "o");
let mut a = 1;
if 1 == 1 { a = 2; }
fail!(~"woooo" + "o");
}

View File

@ -12,4 +12,4 @@
// error-pattern:explicit failure
fn main() { let x = if false { 0 } else if true { fail!() } else { 10 }; }
fn main() { let _x = if false { 0 } else if true { fail!() } else { 10 }; }

View File

@ -12,4 +12,4 @@
// error-pattern:explicit failure
fn main() { let x = match true { false => { 0 } true => { fail!() } }; }
fn main() { let _x = match true { false => { 0 } true => { fail!() } }; }

View File

@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(unnecessary_allocation)];
// error-pattern:explicit failure
// Don't double free the string
extern mod extra;

View File

@ -18,5 +18,5 @@ enum e<T> { e(arc::Arc<T>) }
fn foo() -> e<int> {fail!();}
fn main() {
let f = foo();
let _f = foo();
}

View File

@ -8,6 +8,10 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#[allow(unnecessary_allocation)];
#[allow(unreachable_code)];
#[allow(unused_variable)];
// error-pattern:so long
fn main() {
let mut x = ~[];

View File

@ -10,6 +10,8 @@
// error-pattern:beep boop
#[allow(unused_variable)];
struct Point { x: int, y: int }
fn main() {

View File

@ -10,6 +10,9 @@
// error-pattern:explicit failure
#[allow(unreachable_code)];
#[allow(unused_variable)];
fn foo(s: ~str) { }
fn main() {

View File

@ -11,5 +11,5 @@
// error-pattern:attempted remainder with a divisor of zero
fn main() {
let y = 0;
let z = 1 % y;
let _z = 1 % y;
}

View File

@ -12,6 +12,12 @@
// as a _|_-typed thing, not a str-typed thing
// error-pattern:bye
#[allow(unreachable_code)];
#[allow(unused_variable)];
struct T { t: ~str }
fn main() { let pth = fail!("bye"); let rs: T = T {t: pth}; }
fn main() {
let pth = fail!("bye");
let _rs: T = T {t: pth};
}

View File

@ -35,7 +35,7 @@ fn r(x:int) -> r {
fn main() {
error!(~"whatever");
do task::spawn {
let i = r(5);
let _i = r(5);
};
fail!();
}

View File

@ -10,7 +10,6 @@
// error-pattern:Ensure that the child task runs by failing
use std::str;
use std::task;
fn main() {

View File

@ -11,6 +11,6 @@
// error-pattern:fail
fn main() {
let a = @0;
let _a = @0;
assert!(false);
}

View File

@ -10,7 +10,7 @@
// error-pattern:fail
fn f(a: @int) {
fn f(_a: @int) {
fail!();
}

View File

@ -13,5 +13,5 @@
fn f() -> @int { fail!(); }
fn main() {
let a: @int = f();
let _a: @int = f();
}

View File

@ -11,7 +11,7 @@
// error-pattern:fail
fn main() {
let a: @int = {
let _a: @int = {
fail!();
};
}

View File

@ -15,8 +15,8 @@ fn a() { }
fn b() { fail!(); }
fn main() {
let x = ~[0];
let _x = ~[0];
a();
let y = ~[0];
let _y = ~[0];
b();
}

View File

@ -10,6 +10,9 @@
// error-pattern:fail
#[allow(unreachable_code)];
#[allow(unused_variable)];
fn x(it: &fn(int)) {
fail!();
it(0);

View File

@ -11,7 +11,7 @@
// error-pattern:fail
fn x(it: &fn(int)) {
let a = @0;
let _a = @0;
it(1);
}

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