auto merge of #9320 : chris-morgan/rust/unreachable-macro-part-two-of-two-containing-the-destruction-of-the-unreachable-function, r=alexcrichton

This is the second of two parts of #8991, now possible as a new snapshot
has been made. (The first part implemented the unreachable!() macro; it
was #8992, 6b7b8f2682.)

``std::util::unreachable()`` is removed summarily; any code which used
it should now use the ``unreachable!()`` macro.

Closes #9312.

Closes #8991.
This commit is contained in:
bors 2013-09-20 00:36:11 -07:00
commit e5fdc7dee5
16 changed files with 28 additions and 63 deletions

View file

@ -19,14 +19,14 @@ pub fn main() {
//~^^ ERROR cannot move out of dereference of & pointer
}
_ => {
::std::util::unreachable();
unreachable!();
}
}
let z = tail[0].clone();
info!(fmt!("%?", z));
}
_ => {
::std::util::unreachable();
unreachable!();
}
}
}

View file

@ -2,7 +2,7 @@ fn main() {
let mut a = [1, 2, 3, 4];
let t = match a {
[1, 2, ..tail] => tail,
_ => std::util::unreachable()
_ => unreachable!()
};
a[0] = 0; //~ ERROR cannot assign to `a[]` because it is borrowed
t[0];

View file

@ -78,8 +78,6 @@
// check:$16 = -1
// debugger:continue
use std::util;
fn main() {
let x = 999;
@ -102,14 +100,14 @@ fn main() {
zzz();
sentinel();
} else {
util::unreachable();
unreachable!();
}
zzz();
sentinel();
if x > 1000 {
util::unreachable();
unreachable!();
} else {
zzz();
sentinel();

View file

@ -1,12 +1,12 @@
fn a() {
let x = [1, 2, 3];
match x {
[1, 2, 4] => ::std::util::unreachable(),
[0, 2, 3, .._] => ::std::util::unreachable(),
[0, .._, 3] => ::std::util::unreachable(),
[0, .._] => ::std::util::unreachable(),
[1, 2, 4] => unreachable!(),
[0, 2, 3, .._] => unreachable!(),
[0, .._, 3] => unreachable!(),
[0, .._] => unreachable!(),
[1, 2, 3] => (),
[_, _, _] => ::std::util::unreachable(),
[_, _, _] => unreachable!(),
}
match x {
[.._] => (),

View file

@ -3,7 +3,7 @@ pub fn main() {
if !x.is_empty() {
let el = match x {
[1, ..ref tail] => &tail[0],
_ => ::std::util::unreachable()
_ => unreachable!()
};
printfln!("%d", *el);
}

View file

@ -17,19 +17,19 @@ pub fn main() {
match tail {
[Foo { _ }, _, Foo { _ }, .. _tail] => {
::std::util::unreachable();
unreachable!();
}
[Foo { string: ref a }, Foo { string: ref b }] => {
assert_eq!("bar", a.slice(0, a.len()));
assert_eq!("baz", b.slice(0, b.len()));
}
_ => {
::std::util::unreachable();
unreachable!();
}
}
}
_ => {
::std::util::unreachable();
unreachable!();
}
}
}