1
Fork 0

run rustfmt on test/run-fail folder

This commit is contained in:
Srinivas Reddy Thatiparthy 2016-05-27 08:09:36 +05:30
parent 97e3a2401e
commit 73ef372f63
54 changed files with 278 additions and 107 deletions

View file

@ -14,6 +14,10 @@
#![allow(unknown_features)]
#![feature(box_syntax)]
fn f(_a: isize, _b: isize, _c: Box<isize>) { panic!("moop"); }
fn f(_a: isize, _b: isize, _c: Box<isize>) {
panic!("moop");
}
fn main() { f(1, panic!("meep"), box 42); }
fn main() {
f(1, panic!("meep"), box 42);
}

View file

@ -9,7 +9,9 @@
// except according to those terms.
// error-pattern:quux
fn foo() -> ! { panic!("quux"); }
fn foo() -> ! {
panic!("quux");
}
fn main() {
foo() == foo(); // these types wind up being defaulted to ()
}

View file

@ -9,5 +9,10 @@
// except according to those terms.
// error-pattern:quux
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
fn main() { 3_usize == my_err("bye".to_string()); }
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
3_usize == my_err("bye".to_string());
}

View file

@ -20,7 +20,7 @@ fn main() {
// address of the 0th cell in the array (even though the index is
// huge).
let x = vec!(1_usize,2_usize,3_usize);
let x = vec![1_usize, 2_usize, 3_usize];
let base = x.as_ptr() as usize;
let idx = base / mem::size_of::<usize>();

View file

@ -12,7 +12,9 @@
use std::marker::PhantomData;
fn test00_start(ch: chan_t<isize>, message: isize) { send(ch, message); }
fn test00_start(ch: chan_t<isize>, message: isize) {
send(ch, message);
}
type task_id = isize;
type port_id = isize;
@ -23,6 +25,10 @@ struct chan_t<T> {
marker: PhantomData<*mut T>,
}
fn send<T:Send>(_ch: chan_t<T>, _data: T) { panic!(); }
fn send<T: Send>(_ch: chan_t<T>, _data: T) {
panic!();
}
fn main() { panic!("quux"); }
fn main() {
panic!("quux");
}

View file

@ -14,6 +14,8 @@
// error-pattern:wooooo
fn main() {
let mut a = 1;
if 1 == 1 { a = 2; }
if 1 == 1 {
a = 2;
}
panic!(format!("woooo{}", "o"));
}

View file

@ -12,4 +12,6 @@
// error-pattern:explicit
fn main() { panic!(); }
fn main() {
panic!();
}

View file

@ -10,6 +10,10 @@
// error-pattern:explicit panic
fn f() -> ! { panic!() }
fn f() -> ! {
panic!()
}
fn main() { f(); }
fn main() {
f();
}

View file

@ -10,8 +10,19 @@
// error-pattern:explicit panic
fn f() -> ! { panic!() }
fn f() -> ! {
panic!()
}
fn g() -> isize { let x = if true { f() } else { 10 }; return x; }
fn g() -> isize {
let x = if true {
f()
} else {
10
};
return x;
}
fn main() { g(); }
fn main() {
g();
}

View file

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

View file

@ -10,8 +10,18 @@
// error-pattern:explicit panic
fn f() -> ! { panic!() }
fn f() -> ! {
panic!()
}
fn g() -> isize { let x = match true { true => { f() } false => { 10 } }; return x; }
fn g() -> isize {
let x = match true {
true => f(),
false => 10,
};
return x;
}
fn main() { g(); }
fn main() {
g();
}

View file

@ -10,4 +10,9 @@
// error-pattern:explicit panic
fn main() { let _x = match true { false => { 0 } true => { panic!() } }; }
fn main() {
let _x = match true {
false => 0,
true => panic!(),
};
}

View file

@ -10,4 +10,8 @@
// error-pattern:moop
fn main() { for _ in 0_usize..10_usize { panic!("moop"); } }
fn main() {
for _ in 0_usize..10_usize {
panic!("moop");
}
}

View file

@ -12,7 +12,11 @@
fn even(x: usize) -> bool {
if x < 2 {
return false;
} else if x == 2 { return true; } else { return even(x - 2); }
} else if x == 2 {
return true;
} else {
return even(x - 2);
}
}
fn foo(x: usize) {
@ -23,4 +27,6 @@ fn foo(x: usize) {
}
}
fn main() { foo(3); }
fn main() {
foo(3);
}

View file

@ -9,5 +9,11 @@
// except according to those terms.
// error-pattern:quux
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); }
fn main() { if my_err("bye".to_string()) { } }
fn my_err(s: String) -> ! {
println!("{}", s);
panic!("quux");
}
fn main() {
if my_err("bye".to_string()) {
}
}

View file

@ -11,5 +11,6 @@
// error-pattern:explicit panic
pub fn main() {
panic!(); println!("{}", 1);
panic!();
println!("{}", 1);
}

View file

@ -20,4 +20,4 @@ fn main() {
let pointer = other;
pointer();
}
extern fn other() {}
extern "C" fn other() {}

View file

@ -19,9 +19,7 @@ pub trait Parser {
impl Parser for () {
type Input = ();
fn parse(&mut self, input: ()) {
}
fn parse(&mut self, input: ()) {}
}
pub fn many() -> Box<Parser<Input = <() as Parser>::Input> + 'static> {
@ -29,6 +27,5 @@ pub fn many() -> Box<Parser<Input=<() as Parser>::Input> + 'static> {
}
fn main() {
many()
.parse(());
many().parse(());
}

View file

@ -12,9 +12,13 @@
use std::sync::Arc;
enum e<T> { ee(Arc<T>) }
enum e<T> {
ee(Arc<T>),
}
fn foo() -> e<isize> {panic!();}
fn foo() -> e<isize> {
panic!();
}
fn main() {
let _f = foo();

View file

@ -17,9 +17,14 @@ struct Parser<'i: 't, 't>(&'i u8, &'t u8);
impl<'i, 't> Parser<'i, 't> {
fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<T, ()>
where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T { panic!() }
where for<'tt> F: FnOnce(&mut Parser<'i, 'tt>) -> T
{
panic!()
}
fn expect_exhausted(&mut self) -> Result<(), ()> { Ok(()) }
fn expect_exhausted(&mut self) -> Result<(), ()> {
Ok(())
}
}
fn main() {

View file

@ -16,7 +16,7 @@
// error-pattern:so long
fn main() {
let mut x = Vec::new();
let y = vec!(3);
let y = vec![3];
panic!("so long");
x.extend(y.into_iter());
}

View file

@ -11,4 +11,6 @@
// error-pattern:explicit panic
fn foo<T>(t: T) {}
fn main() { foo(panic!()) }
fn main() {
foo(panic!())
}

View file

@ -12,7 +12,10 @@
#![allow(unused_variables)]
struct Point { x: isize, y: isize }
struct Point {
x: isize,
y: isize,
}
fn main() {
let origin = Point { x: 0, y: 0 };

View file

@ -16,7 +16,9 @@
fn foo(s: String) {}
fn main() {
let i =
match Some::<isize>(3) { None::<isize> => { panic!() } Some::<isize>(_) => { panic!() } };
let i = match Some::<isize>(3) {
None::<isize> => panic!(),
Some::<isize>(_) => panic!(),
};
foo(i);
}

View file

@ -9,6 +9,15 @@
// except according to those terms.
// error-pattern:quux
fn f() -> ! { panic!("quux") }
fn g() -> isize { match f() { true => { 1 } false => { 0 } } }
fn main() { g(); }
fn f() -> ! {
panic!("quux")
}
fn g() -> isize {
match f() {
true => 1,
false => 0,
}
}
fn main() {
g();
}

View file

@ -11,10 +11,18 @@
// error-pattern:squirrelcupcake
fn cmp() -> isize {
match (Some('a'), None::<char>) {
(Some(_), _) => { panic!("squirrelcupcake"); }
(_, Some(_)) => { panic!(); }
_ => { panic!("wat"); }
(Some(_), _) => {
panic!("squirrelcupcake");
}
(_, Some(_)) => {
panic!();
}
_ => {
panic!("wat");
}
}
}
fn main() { println!("{}", cmp()); }
fn main() {
println!("{}", cmp());
}

View file

@ -16,7 +16,15 @@
//[foo] error-pattern:bar
//[bar] error-pattern:foo
#[cfg(foo)] fn die() {panic!("foo");}
#[cfg(bar)] fn die() {panic!("bar");}
#[cfg(foo)]
fn die() {
panic!("foo");
}
#[cfg(bar)]
fn die() {
panic!("bar");
}
fn main() { die(); }
fn main() {
die();
}

View file

@ -15,7 +15,15 @@
//[foo] error-pattern:foo
//[bar] error-pattern:bar
#[cfg(foo)] fn die() {panic!("foo");}
#[cfg(bar)] fn die() {panic!("bar");}
#[cfg(foo)]
fn die() {
panic!("foo");
}
#[cfg(bar)]
fn die() {
panic!("bar");
}
fn main() { die(); }
fn main() {
die();
}

View file

@ -9,6 +9,10 @@
// except according to those terms.
// error-pattern:woe
fn f(a: isize) { println!("{}", a); }
fn f(a: isize) {
println!("{}", a);
}
fn main() { f(panic!("woe")); }
fn main() {
f(panic!("woe"));
}

View file

@ -9,4 +9,6 @@
// except according to those terms.
// error-pattern:moop
fn main() { panic!("moop"); }
fn main() {
panic!("moop");
}

View file

@ -13,11 +13,15 @@
// error-pattern:oops
fn bigpanic() {
while (panic!("oops")) { if (panic!()) {
match (panic!()) { () => {
while (panic!("oops")) {
if (panic!()) {
match (panic!()) {
() => {}
}
}
}
}};
}
fn main() { bigpanic(); }
fn main() {
bigpanic();
}

View file

@ -15,6 +15,7 @@ use std::thread;
fn main() {
let r: Result<(), _> = thread::spawn(move || {
panic!("test");
}).join();
})
.join();
assert!(r.is_ok());
}

View file

@ -13,9 +13,14 @@
use std::thread::Builder;
fn main() {
let r: () = Builder::new().name("owned name".to_string()).spawn(move|| {
let r: () = Builder::new()
.name("owned name".to_string())
.spawn(move || {
panic!("test");
()
}).unwrap().join().unwrap();
})
.unwrap()
.join()
.unwrap();
panic!();
}

View file

@ -9,4 +9,6 @@
// except according to those terms.
// error-pattern:1 == 2
fn main() { assert!(1 == 2); }
fn main() {
assert!(1 == 2);
}

View file

@ -15,7 +15,9 @@
#![allow(unreachable_code)]
#![allow(unused_variables)]
struct T { t: String }
struct T {
t: String,
}
fn main() {
let pth = panic!("bye");

View file

@ -17,5 +17,7 @@ mod m {
pub fn exported() {}
#[test]
fn unexported() { panic!("runned an unexported test"); }
fn unexported() {
panic!("runned an unexported test");
}
}

View file

@ -9,4 +9,6 @@
// except according to those terms.
// error-pattern:not yet implemented
fn main() { unimplemented!() }
fn main() {
unimplemented!()
}

View file

@ -10,4 +10,6 @@
// error-pattern: panic
fn main() { Box::new(panic!()); }
fn main() {
Box::new(panic!());
}

View file

@ -9,4 +9,6 @@
// except according to those terms.
// error-pattern:internal error: entered unreachable code
fn main() { unreachable!() }
fn main() {
unreachable!()
}

View file

@ -9,4 +9,6 @@
// except according to those terms.
// error-pattern:internal error: entered unreachable code: uhoh
fn main() { unreachable!("uhoh") }
fn main() {
unreachable!("uhoh")
}

View file

@ -9,4 +9,6 @@
// except according to those terms.
// error-pattern:internal error: entered unreachable code
fn main() { unreachable!() }
fn main() {
unreachable!()
}

View file

@ -12,11 +12,13 @@
fn a() {}
fn b() { panic!(); }
fn b() {
panic!();
}
fn main() {
let _x = vec!(0);
let _x = vec![0];
a();
let _y = vec!(0);
let _y = vec![0];
b();
}

View file

@ -15,10 +15,10 @@ fn build() -> Vec<isize> {
panic!();
}
struct Blk { node: Vec<isize> }
struct Blk {
node: Vec<isize>,
}
fn main() {
let _blk = Blk {
node: build()
};
let _blk = Blk { node: build() };
}

View file

@ -12,18 +12,21 @@
fn build1() -> Vec<isize> {
vec!(0,0,0,0,0,0,0)
vec![0, 0, 0, 0, 0, 0, 0]
}
fn build2() -> Vec<isize> {
panic!();
}
struct Blk { node: Vec<isize> , span: Vec<isize> }
struct Blk {
node: Vec<isize>,
span: Vec<isize>,
}
fn main() {
let _blk = Blk {
node: build1(),
span: build2()
span: build2(),
};
}

View file

@ -12,7 +12,7 @@
fn main() {
let v: Vec<isize> = vec!(10);
let v: Vec<isize> = vec![10];
let x: usize = 0;
assert_eq!(v[x], 10);
// Bounds-check panic.

View file

@ -11,4 +11,11 @@
#![allow(while_true)]
// error-pattern:quux
fn main() { let _x: isize = { while true { panic!("quux"); } ; 8 } ; }
fn main() {
let _x: isize = {
while true {
panic!("quux");
}
8
};
}

View file

@ -12,5 +12,10 @@
// error-pattern:giraffe
fn main() {
panic!({ while true { panic!("giraffe") }; "clandestine" });
panic!({
while true {
panic!("giraffe")
}
"clandestine"
});
}