fake_static/lib.rs
1fn helper<'a, 'b, T>(_: &'a &'b (), v: &'b T) -> &'a T { v }
2
3#[cfg(not(debug_assertions))]
4compile_error!("Don't deploy this shit to production you madman");
5
6/// Use black magic fuckery to turn any `&T` into a `&'static T`.
7/// May introduce undefined behavior.
8pub fn make_static<'a, T>(input: &'a T) -> &'static T {
9 let f: fn(_, &'a T) -> &'static T = helper;
10 f(&&(), input)
11}