diff options
Diffstat (limited to 'src/libstd/util.rs')
| -rw-r--r-- | src/libstd/util.rs | 28 | 
1 files changed, 0 insertions, 28 deletions
| diff --git a/src/libstd/util.rs b/src/libstd/util.rs index e8bcceb85fa..4acc1f3abff 100644 --- a/src/libstd/util.rs +++ b/src/libstd/util.rs @@ -104,34 +104,6 @@ impl Void { } -/** -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::*; | 
