]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/util.rs
auto merge of #9354 : thestinger/rust/cleanup, r=alexcrichton
[rust.git] / src / libstd / util.rs
index 7a79ec96304ab38cfaf823a2beb371f1e007b3fb..64bdc7fe8cd8b118d51f648b7de0a39e93912308 100644 (file)
@@ -85,34 +85,6 @@ pub fn uninhabited(self) -> ! {
 }
 
 
-/**
-A utility function for indicating unreachable code. It will fail if
-executed. This is occasionally useful to put after loops that never
-terminate normally, but instead directly return from a function.
-
-# Example
-
-~~~ {.rust}
-fn choose_weighted_item(v: &[Item]) -> Item {
-    assert!(!v.is_empty());
-    let mut so_far = 0u;
-    for v.each |item| {
-        so_far += item.weight;
-        if so_far > 100 {
-            return item;
-        }
-    }
-    // The above loop always returns, so we must hint to the
-    // type checker that it isn't possible to get down here
-    util::unreachable();
-}
-~~~
-
-*/
-pub fn unreachable() -> ! {
-    fail!("internal error: entered unreachable code");
-}
-
 #[cfg(test)]
 mod tests {
     use super::*;