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)] #![allow(unknown_features)]
#![feature(box_syntax)] #![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

@ -11,5 +11,5 @@
// error-pattern:assertion failed: `(left == right)` (left: `14`, right: `15`) // error-pattern:assertion failed: `(left == right)` (left: `14`, right: `15`)
fn main() { fn main() {
assert_eq!(14,15); assert_eq!(14, 15);
} }

View file

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

View file

@ -9,5 +9,10 @@
// except according to those terms. // except according to those terms.
// error-pattern:quux // error-pattern:quux
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); } fn my_err(s: String) -> ! {
fn main() { 3_usize == my_err("bye".to_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 // address of the 0th cell in the array (even though the index is
// huge). // 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 base = x.as_ptr() as usize;
let idx = base / mem::size_of::<usize>(); let idx = base / mem::size_of::<usize>();
@ -28,7 +28,7 @@ fn main() {
println!("ov1 idx = 0x{:x}", idx); println!("ov1 idx = 0x{:x}", idx);
println!("ov1 sizeof::<usize>() = 0x{:x}", mem::size_of::<usize>()); println!("ov1 sizeof::<usize>() = 0x{:x}", mem::size_of::<usize>());
println!("ov1 idx * sizeof::<usize>() = 0x{:x}", println!("ov1 idx * sizeof::<usize>() = 0x{:x}",
idx * mem::size_of::<usize>()); idx * mem::size_of::<usize>());
// This should panic. // This should panic.
println!("ov1 0x{:x}", x[idx]); println!("ov1 0x{:x}", x[idx]);

View file

@ -12,7 +12,9 @@
use std::marker::PhantomData; 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 task_id = isize;
type port_id = isize; type port_id = isize;
@ -23,6 +25,10 @@ struct chan_t<T> {
marker: PhantomData<*mut 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

@ -10,7 +10,7 @@
#![allow(unreachable_code)] #![allow(unreachable_code)]
//error-pattern:One // error-pattern:One
fn main() { fn main() {
panic!("One"); panic!("One");
panic!("Two"); panic!("Two");

View file

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

View file

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

View file

@ -10,6 +10,10 @@
// error-pattern:explicit panic // 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 // 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 // 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 // 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 // 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 // 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 { fn even(x: usize) -> bool {
if x < 2 { if x < 2 {
return false; 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) { 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. // except according to those terms.
// error-pattern:quux // error-pattern:quux
fn my_err(s: String) -> ! { println!("{}", s); panic!("quux"); } fn my_err(s: String) -> ! {
fn main() { if my_err("bye".to_string()) { } } println!("{}", s);
panic!("quux");
}
fn main() {
if my_err("bye".to_string()) {
}
}

View file

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

View file

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

View file

@ -19,16 +19,13 @@ pub trait Parser {
impl Parser for () { impl Parser for () {
type Input = (); type Input = ();
fn parse(&mut self, input: ()) { fn parse(&mut self, input: ()) {}
}
} }
pub fn many() -> Box<Parser<Input=<() as Parser>::Input> + 'static> { pub fn many() -> Box<Parser<Input = <() as Parser>::Input> + 'static> {
panic!("Hello, world!") panic!("Hello, world!")
} }
fn main() { fn main() {
many() many().parse(());
.parse(());
} }

View file

@ -12,10 +12,14 @@
use std::sync::Arc; 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() { fn main() {
let _f = foo(); let _f = foo();
} }

View file

@ -17,9 +17,14 @@ struct Parser<'i: 't, 't>(&'i u8, &'t u8);
impl<'i, 't> Parser<'i, 't> { impl<'i, 't> Parser<'i, 't> {
fn parse_nested_block<F, T>(&mut self, parse: F) -> Result<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() { fn main() {

View file

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

View file

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

View file

@ -12,9 +12,12 @@
#![allow(unused_variables)] #![allow(unused_variables)]
struct Point { x: isize, y: isize } struct Point {
x: isize,
y: isize,
}
fn main() { fn main() {
let origin = Point {x: 0, y: 0}; let origin = Point { x: 0, y: 0 };
let f: Point = Point {x: (panic!("beep boop")),.. origin}; let f: Point = Point { x: (panic!("beep boop")), ..origin };
} }

View file

@ -13,10 +13,12 @@
#![allow(unreachable_code)] #![allow(unreachable_code)]
#![allow(unused_variables)] #![allow(unused_variables)]
fn foo(s: String) { } fn foo(s: String) {}
fn main() { fn main() {
let i = let i = match Some::<isize>(3) {
match Some::<isize>(3) { None::<isize> => { panic!() } Some::<isize>(_) => { panic!() } }; None::<isize> => panic!(),
Some::<isize>(_) => panic!(),
};
foo(i); foo(i);
} }

View file

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

View file

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

View file

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

View file

@ -27,7 +27,7 @@ impl<'a> Drop for Droppable<'a> {
} }
#[rustc_mir] #[rustc_mir]
fn mir(){ fn mir() {
let (mut xv, mut yv) = (false, false); let (mut xv, mut yv) = (false, false);
let x = Droppable(&mut xv, 1); let x = Droppable(&mut xv, 1);
let y = Droppable(&mut yv, 2); let y = Droppable(&mut yv, 2);

View file

@ -26,7 +26,7 @@ impl<'a> Drop for Droppable<'a> {
} }
#[rustc_mir] #[rustc_mir]
fn mir<'a>(d: Droppable<'a>){ fn mir<'a>(d: Droppable<'a>) {
loop { loop {
let x = d; let x = d;
break; break;

View file

@ -33,7 +33,7 @@ fn may_panic<'a>() -> Droppable<'a> {
} }
#[rustc_mir] #[rustc_mir]
fn mir<'a>(d: Droppable<'a>){ fn mir<'a>(d: Droppable<'a>) {
let (mut a, mut b) = (false, false); let (mut a, mut b) = (false, false);
let y = Droppable(&mut a, 2); let y = Droppable(&mut a, 2);
let x = [Droppable(&mut b, 1), y, d, may_panic()]; let x = [Droppable(&mut b, 1), y, d, may_panic()];

View file

@ -9,6 +9,10 @@
// except according to those terms. // except according to those terms.
// error-pattern:woe // 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

@ -14,5 +14,5 @@
#![feature(box_syntax)] #![feature(box_syntax)]
fn main() { fn main() {
panic!(box 413 as Box<::std::any::Any+Send>); panic!(box 413 as Box<::std::any::Any + Send>);
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -13,5 +13,5 @@
use std::result::Result::Err; use std::result::Result::Err;
fn main() { fn main() {
println!("{}", Err::<isize,String>("kitty".to_string()).unwrap()); println!("{}", Err::<isize, String>("kitty".to_string()).unwrap());
} }

View file

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

View file

@ -14,8 +14,10 @@
// ignore-pretty: does not work well with `--test` // ignore-pretty: does not work well with `--test`
mod m { mod m {
pub fn exported() { } pub fn exported() {}
#[test] #[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. // except according to those terms.
// error-pattern:not yet implemented // error-pattern:not yet implemented
fn main() { unimplemented!() } fn main() {
unimplemented!()
}

View file

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

View file

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

View file

@ -9,4 +9,6 @@
// except according to those terms. // except according to those terms.
// error-pattern:internal error: entered unreachable code: uhoh // 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. // except according to those terms.
// error-pattern:internal error: entered unreachable code // error-pattern:internal error: entered unreachable code
fn main() { unreachable!() } fn main() {
unreachable!()
}

View file

@ -10,13 +10,15 @@
// error-pattern:fail // error-pattern:fail
fn a() { } fn a() {}
fn b() { panic!(); } fn b() {
panic!();
}
fn main() { fn main() {
let _x = vec!(0); let _x = vec![0];
a(); a();
let _y = vec!(0); let _y = vec![0];
b(); b();
} }

View file

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

View file

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

View file

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

View file

@ -11,4 +11,11 @@
#![allow(while_true)] #![allow(while_true)]
// error-pattern:quux // 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 // error-pattern:giraffe
fn main() { fn main() {
panic!({ while true { panic!("giraffe") }; "clandestine" }); panic!({
while true {
panic!("giraffe")
}
"clandestine"
});
} }