rustc-rayon-core 0.2.0

Core APIs for Rayon - fork for rustc
Documentation
1
2
3
4
5
6
7
8
9
10
use std::mem;

pub fn leak<T>(v: T) -> &'static T {
    unsafe {
        let b = Box::new(v);
        let p: *const T = &*b;
        mem::forget(b); // leak our reference, so that `b` is never freed
        &*p
    }
}