about summary refs log tree commit diff
path: root/src/libstd/unstable
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-21 22:28:21 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-04-23 10:03:43 -0700
commitb4ecbe93401a56181baaffc4ff7e275aeecc5182 (patch)
tree8dcae1c59342fc3de1954f500e74467c9d14f5fc /src/libstd/unstable
parent2b2d1e14c97b7692debf62dd2739049f1f377a5e (diff)
downloadrust-b4ecbe93401a56181baaffc4ff7e275aeecc5182.tar.gz
rust-b4ecbe93401a56181baaffc4ff7e275aeecc5182.zip
std: Change Finally to take `&mut self`
As with the previous commits, the Finally trait is primarily implemented for
closures, so the trait was modified from `&self` to `&mut self`. This will
require that any closure variable invoked with `finally` to be stored in a
mutable slot.

[breaking-change]
Diffstat (limited to 'src/libstd/unstable')
-rw-r--r--src/libstd/unstable/finally.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/libstd/unstable/finally.rs b/src/libstd/unstable/finally.rs
index c98ef880c10..96e52a4818e 100644
--- a/src/libstd/unstable/finally.rs
+++ b/src/libstd/unstable/finally.rs
@@ -35,19 +35,19 @@ use ops::Drop;
 #[cfg(test)] use task::failing;
 
 pub trait Finally<T> {
-    fn finally(&self, dtor: ||) -> T;
+    fn finally(&mut self, dtor: ||) -> T;
 }
 
 impl<'a,T> Finally<T> for ||: 'a -> T {
-    fn finally(&self, dtor: ||) -> T {
-        try_finally(&mut (), (),
-                    |_, _| (*self)(),
+    fn finally(&mut self, dtor: ||) -> T {
+        try_finally(&mut (), self,
+                    |_, f| (*f)(),
                     |_| dtor())
     }
 }
 
 impl<T> Finally<T> for fn() -> T {
-    fn finally(&self, dtor: ||) -> T {
+    fn finally(&mut self, dtor: ||) -> T {
         try_finally(&mut (), (),
                     |_, _| (*self)(),
                     |_| dtor())