diff options
| author | Ben Striegel <ben.striegel@gmail.com> | 2012-11-13 21:38:18 -0500 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-11-14 16:15:34 -0800 |
| commit | 4589597785c4e485db82bc06c2c44ac2ebcced6a (patch) | |
| tree | 35053801b2b14b52e1ab6f05e0f06f2c3863ad68 /src/libstd/c_vec.rs | |
| parent | 4b0e1336b26b5bc29e14370e55d4811f15b1dce8 (diff) | |
| download | rust-4589597785c4e485db82bc06c2c44ac2ebcced6a.tar.gz rust-4589597785c4e485db82bc06c2c44ac2ebcced6a.zip | |
Convert libstd to use the Drop trait
Diffstat (limited to 'src/libstd/c_vec.rs')
| -rw-r--r-- | src/libstd/c_vec.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstd/c_vec.rs b/src/libstd/c_vec.rs index 06d56ed1ae5..2e94f07d2d8 100644 --- a/src/libstd/c_vec.rs +++ b/src/libstd/c_vec.rs @@ -39,12 +39,15 @@ pub enum CVec<T> { struct DtorRes { dtor: Option<fn@()>, - drop { +} + +impl DtorRes : Drop { + fn finalize() { match self.dtor { option::None => (), option::Some(f) => f() } - } + } } fn DtorRes(dtor: Option<fn@()>) -> DtorRes { |
