summaryrefslogtreecommitdiff
path: root/src/hir/crate_ptr.hpp
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-05-21 23:44:51 +0800
committerJohn Hodge <tpg@mutabah.net>2016-05-21 23:44:51 +0800
commit1b744f3c07e7e34dad26f33d9988c3d34871e062 (patch)
treee7747ded50796553d35f27289c67a004867aceef /src/hir/crate_ptr.hpp
parentad93bc7fda1988e49b4e3a0d85344d7e3dc7df10 (diff)
downloadmrust-1b744f3c07e7e34dad26f33d9988c3d34871e062.tar.gz
All - Cleanup of memory leaks and similar
Diffstat (limited to 'src/hir/crate_ptr.hpp')
-rw-r--r--src/hir/crate_ptr.hpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/hir/crate_ptr.hpp b/src/hir/crate_ptr.hpp
index ca95074d..df60329e 100644
--- a/src/hir/crate_ptr.hpp
+++ b/src/hir/crate_ptr.hpp
@@ -14,8 +14,18 @@ class CratePtr
public:
CratePtr();
CratePtr(Crate c);
- CratePtr(CratePtr&&) = default;
- CratePtr& operator=(CratePtr&&) = default;
+ CratePtr(CratePtr&& x):
+ m_ptr( x.m_ptr )
+ {
+ x.m_ptr = nullptr;
+ }
+ CratePtr& operator=(CratePtr&& x)
+ {
+ this->~CratePtr();
+ m_ptr = x.m_ptr;
+ x.m_ptr = nullptr;
+ return *this;
+ }
~CratePtr();
};