rust/src/lib/unsafe.rs

15 lines
342 B
Rust
Raw Normal View History

// Unsafe operations.
native "rust-intrinsic" mod rusti {
fn cast<T, U>(src: T) -> U;
}
native "rust" mod rustrt {
fn leak<@T>(thing: -T);
}
// Casts the value at `src` to U. The two types must have the same length.
fn reinterpret_cast<T, @U>(src: T) -> U { ret rusti::cast(src); }
2011-09-02 17:34:58 -05:00
fn leak<@T>(thing: -T) { rustrt::leak(thing); }