]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #9354 : thestinger/rust/cleanup, r=alexcrichton
authorbors <bors@rust-lang.org>
Sat, 21 Sep 2013 08:35:59 +0000 (01:35 -0700)
committerbors <bors@rust-lang.org>
Sat, 21 Sep 2013 08:35:59 +0000 (01:35 -0700)
I don't see the point of this function, and there are no users.

1  2 
src/libstd/util.rs

diff --combined src/libstd/util.rs
index 4acc1f3abfff21f182b990f16de9959eae909e73,7a79ec96304ab38cfaf823a2beb371f1e007b3fb..64bdc7fe8cd8b118d51f648b7de0a39e93912308
@@@ -23,25 -23,6 +23,6 @@@ pub fn id<T>(x: T) -> T { x 
  #[inline]
  pub fn ignore<T>(_x: T) { }
  
- /// Sets `*ptr` to `new_value`, invokes `op()`, and then restores the
- /// original value of `*ptr`.
- ///
- /// NB: This function accepts `@mut T` and not `&mut T` to avoid
- /// an obvious borrowck hazard. Typically passing in `&mut T` will
- /// cause borrow check errors because it freezes whatever location
- /// that `&mut T` is stored in (either statically or dynamically).
- #[inline]
- pub fn with<T,R>(
-     ptr: @mut T,
-     value: T,
-     op: &fn() -> R) -> R
- {
-     let prev = replace(ptr, value);
-     let result = op();
-     *ptr = prev;
-     return result;
- }
  /**
   * Swap the values at two mutable locations of the same type, without
   * deinitialising or copying either one.
@@@ -104,6 -85,34 +85,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::*;