Replace unreachable() calls with unreachable!().
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:
parent
4dacd73651
commit
e2807a4565
16 changed files with 28 additions and 63 deletions
|
|
@ -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!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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];
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
[.._] => (),
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue