leak.rs 489 B

12345678910111213141516
  1. //! Traits for leakable types.
  2. //!
  3. //! In the context of writing a memory allocator, leaks are never ideal. To avoid these, we have a
  4. //! trait for types which are "leakable".
  5. use prelude::*;
  6. /// Types that have no destructor.
  7. ///
  8. /// This trait holds the invariant that our type carries no destructor.
  9. ///
  10. /// Since one cannot define mutually exclusive traits, we have this as a temporary hack.
  11. pub unsafe trait Leak {}
  12. unsafe impl Leak for Block {}
  13. unsafe impl<T: Copy> Leak for T {}