auto merge of #7163 : brson/rust/reinterpret-cast, r=thestinger

This commit is contained in:
bors 2013-06-16 06:31:00 -07:00
commit ebca26cd54

View File

@ -54,17 +54,14 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
* *
* The forget function will take ownership of the provided value but neglect * The forget function will take ownership of the provided value but neglect
* to run any required cleanup or memory-management operations on it. This * to run any required cleanup or memory-management operations on it. This
* can be used for various acts of magick, particularly when using * can be used for various acts of magick.
* reinterpret_cast on pointer types.
*/ */
#[inline(always)] #[inline(always)]
pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); } pub unsafe fn forget<T>(thing: T) { intrinsics::forget(thing); }
/** /**
* Force-increment the reference count on a shared box. If used * Force-increment the reference count on a shared box. If used
* carelessly, this can leak the box. Use this in conjunction with transmute * carelessly, this can leak the box.
* and/or reinterpret_cast when such calls would otherwise scramble a box's
* reference count
*/ */
#[inline(always)] #[inline(always)]
pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); } pub unsafe fn bump_box_refcount<T>(t: @T) { forget(t); }