Update infrastructure for fail -> panic

This includes updating the language items and marking what needs to
change after a snapshot.

If you do not use the standard library, the language items you need to
implement have changed. For example:

```rust
 #[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
```

is now

```rust
 #[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
```

Related, lesser-implemented language items `fail` and
`fail_bounds_check` have become `panic` and `panic_bounds_check`, as
well. These are implemented by `libcore`, so it is unlikely (though
possible!) that these two renamings will affect you.

[breaking-change]

Fix test suite
This commit is contained in:
Steve Klabnik 2014-10-28 14:07:33 -04:00
parent 7828c3dd28
commit 6ac7fc73f5
40 changed files with 104 additions and 60 deletions

View file

@ -14,8 +14,8 @@
#[lang="sized"]
pub trait Sized for Sized? {}
#[lang="fail"]
fn fail(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
#[lang="panic"]
fn panic(_: &(&'static str, &'static str, uint)) -> ! { loop {} }
#[lang = "stack_exhausted"]
extern fn stack_exhausted() {}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn foo() -> ! { fail!("quux"); }
fn foo() -> ! { panic!("quux"); }
fn main() {
foo() //~ ERROR the type of this value must be known in this context
==

View file

@ -9,6 +9,6 @@
// except according to those terms.
fn main() {
&fail!()
&panic!()
//~^ ERROR mismatched types: expected `()`, found `&<generic #2>` (expected (), found &-ptr)
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
// aux-build:weak-lang-items.rs
// error-pattern: language item required, but not found: `fail_fmt`
// error-pattern: language item required, but not found: `panic_fmt`
// error-pattern: language item required, but not found: `stack_exhausted`
// error-pattern: language item required, but not found: `eh_personality`

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'assertion failed: false'
// error-pattern:panicked at 'assertion failed: false'
fn main() {
assert!(false);

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'test-assert-fmt 42 rust'
// error-pattern:panicked at 'test-assert-fmt 42 rust'
fn main() {
assert!(false, "test-assert-fmt {} {}", 42i, "rust");

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'test-assert-owned'
// error-pattern:panicked at 'test-assert-owned'
fn main() {
assert!(false, "test-assert-owned".to_string());

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'test-assert-static'
// error-pattern:panicked at 'test-assert-static'
fn main() {
assert!(false, "test-assert-static");

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit failure
// error-pattern:explicit panic
trait Foo {
fn foo(self, x: int);

View file

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit panic
// error-pattern:explicit failure
fn f() -> ! { panic!() }
fn main() { f(); }

View file

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit panic
// error-pattern:explicit failure
fn f() -> ! { panic!() }
fn g() -> int { let x = if true { f() } else { 10 }; return x; }

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit panic
// error-pattern:explicit failure
fn main() { let _x = if false { 0i } else if true { panic!() } else { 10i }; }

View file

@ -8,10 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit panic
// error-pattern:explicit failure
fn f() -> ! { panic!() }
fn g() -> int { let x = match true { true => { f() } false => { 10 } }; return x; }

View file

@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit panic
// error-pattern:explicit failure
fn main() { let _x = match true { false => { 0i } true => { panic!() } }; }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'Box<Any>'
// error-pattern:panicked at 'Box<Any>'
fn main() {
panic!(box 612_i64);

View file

@ -8,8 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'Box<Any>'
// error-pattern:panicked at 'Box<Any>'
fn main() {
panic!(box 413i as Box<::std::any::Any+Send>);

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'explicit failure'
// error-pattern:panicked at 'explicit panic'
fn main() {
panic!();

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'test-fail-fmt 42 rust'
// error-pattern:panicked at 'test-fail-fmt 42 rust'
fn main() {
panic!("test-fail-fmt {} {}", 42i, "rust");

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'test-fail-owned'
// error-pattern:panicked at 'test-fail-owned'
fn main() {
panic!("test-fail-owned");

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:failed at 'test-fail-static'
// error-pattern:panicked at 'test-fail-static'
fn main() {
panic!("test-fail-static");

View file

@ -12,7 +12,7 @@
// Previously failed formating invalid utf8.
// cc #16877
// error-pattern:failed at 'hello<6C>'
// error-pattern:panicked at 'hello<6C>'
struct Foo;
impl std::fmt::Show for Foo {

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:task '<unnamed>' failed at 'test'
// error-pattern:task '<unnamed>' panicked at 'test'
use std::task;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:task 'owned name' failed at 'test'
// error-pattern:task 'owned name' panicked at 'test'
use std::task::TaskBuilder;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:task 'send name' failed at 'test'
// error-pattern:task 'send name' panicked at 'test'
fn main() {
let r: Result<int,_> =

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:task 'static name' failed at 'test'
// error-pattern:task 'static name' panicked at 'test'
fn main() {
let r: Result<int,_> =

View file

@ -14,7 +14,7 @@
//
// Expanded pretty printing causes resolve conflicts.
// error-pattern:fail works
// error-pattern:panic works
#![feature(globs)]
use std::*;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit failure
// error-pattern:explicit panic
pub fn main() {
panic!(); println!("{}", 1i);

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit failure
// error-pattern:explicit panic
use std::sync::Arc;

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:task '<main>' failed at
// error-pattern:task '<main>' panicked at
fn main() {
panic!()

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:explicit failure
// error-pattern:explicit panic
#![allow(unreachable_code)]
#![allow(unused_variable)]

View file

@ -9,7 +9,7 @@
// except according to those terms.
// ignore-android (FIXME #11419)
// error-pattern:explicit failure
// error-pattern:explicit panic
extern crate native;

View file

@ -9,7 +9,7 @@
// except according to those terms.
// check-stdout
// error-pattern:task 'test_foo' failed at
// error-pattern:task 'test_foo' panicked at
// compile-flags: --test
// ignore-pretty: does not work well with `--test`

View file

@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: fail
// error-pattern: panic
fn main() { box panic!(); }

View file

@ -19,4 +19,4 @@ pub extern fn bar() {}
#[lang = "stack_exhausted"] fn stack_exhausted() {}
#[lang = "eh_personality"] fn eh_personality() {}
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }

View file

@ -19,4 +19,4 @@ pub extern fn foo() {}
#[lang = "stack_exhausted"] fn stack_exhausted() {}
#[lang = "eh_personality"] fn eh_personality() {}
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }

View file

@ -22,7 +22,7 @@ extern "rust-intrinsic" { fn transmute<T, U>(t: T) -> U; }
#[lang = "stack_exhausted"] extern fn stack_exhausted() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "fail_fmt"] fn fail_fmt() -> ! { loop {} }
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
#[start]
#[no_stack_check]