Skip to content

Commit

Permalink
Add OnDrop
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Mar 16, 2018
1 parent a7170b0 commit 683ad94
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

0 comments on commit 683ad94

Please sign in to comment.