about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_data_structures/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index 81246aea1b5..bf0b3726bb3 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -76,6 +76,14 @@ pub mod flock;
 pub mod sync;
 pub mod owning_ref;
 
+pub struct OnDrop<F: Fn()>(pub F);
+
+impl<F: Fn()> Drop for OnDrop<F> {
+      fn drop(&mut self) {
+            (self.0)();
+      }
+}
+
 // See comments in src/librustc/lib.rs
 #[doc(hidden)]
 pub fn __noop_fix_for_27438() {}