2011-07-10 03:32:35 -05:00
|
|
|
// Unsafe operations.
|
|
|
|
|
|
|
|
native "rust-intrinsic" mod rusti {
|
2011-08-12 08:37:10 -05:00
|
|
|
fn cast<T, U>(src: &T) -> U;
|
2011-07-10 03:32:35 -05:00
|
|
|
}
|
|
|
|
|
2011-08-22 20:05:34 -05:00
|
|
|
native "rust" mod rustrt {
|
|
|
|
fn leak<@T>(thing: -T);
|
|
|
|
}
|
|
|
|
|
2011-07-10 03:32:35 -05:00
|
|
|
// Casts the value at `src` to U. The two types must have the same length.
|
2011-08-23 17:58:53 -05:00
|
|
|
fn reinterpret_cast<T, @U>(src: &T) -> U { ret rusti::cast(src); }
|
2011-07-10 03:32:35 -05:00
|
|
|
|
2011-09-02 17:34:58 -05:00
|
|
|
fn leak<@T>(thing: -T) { rustrt::leak(thing); }
|