• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use std::mem;
2 
leak<T>(v: T) -> &'static T3 pub(super) fn leak<T>(v: T) -> &'static T {
4     unsafe {
5         let b = Box::new(v);
6         let p: *const T = &*b;
7         mem::forget(b); // leak our reference, so that `b` is never freed
8         &*p
9     }
10 }
11