diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2012-11-05 17:50:01 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2012-11-07 12:34:32 -0800 |
| commit | 29040955709a145842f93fe11d4cd803415020be (patch) | |
| tree | cd27b595087e924d76c4ae1fcb7a91806cb95a44 /src/libcore | |
| parent | 70886d314d0e49fe652f022139b03c2ddaca7b14 (diff) | |
rustc: Implement the Drop trait. r=brson
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/core.rs | 4 | ||||
| -rw-r--r-- | src/libcore/ops.rs | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libcore/core.rs b/src/libcore/core.rs index 12a426261c4..1be217dac9f 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -28,6 +28,8 @@ pub use to_str::ToStr; #[cfg(notest)] pub use ops::{Const, Copy, Send, Owned}; #[cfg(notest)] +pub use ops::{Drop}; +#[cfg(notest)] pub use ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr, BitXor}; #[cfg(notest)] pub use ops::{Shl, Shr, Index}; @@ -38,6 +40,8 @@ extern mod coreops(name = "core", vers = "0.5"); #[cfg(test)] pub use coreops::ops::{Const, Copy, Send, Owned}; #[cfg(test)] +pub use coreops::ops::{Drop}; +#[cfg(test)] pub use coreops::ops::{Add, Sub, Mul, Div, Modulo, Neg, BitAnd, BitOr}; #[cfg(test)] pub use coreops::ops::{BitXor}; diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 7c6bcf5bd51..96b96d0f27a 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -23,6 +23,11 @@ pub trait Owned { // Empty. } +#[lang="drop"] +pub trait Drop { + fn finalize(); // XXX: Rename to "drop"? --pcwalton +} + #[lang="add"] pub trait Add<RHS,Result> { pure fn add(rhs: &RHS) -> Result; |
