Created
August 16, 2016 15:13
-
-
Save kestein/0c0df0352b92df527424333889c8d95c to your computer and use it in GitHub Desktop.
Lel, make things static at runtime
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x = vec![String::from("asdf1234"), String::from("fdsa4312")]; | |
let mut y: Vec<&'static str> = Vec::new(); | |
for e in x { | |
unsafe { | |
let r = mem::transmute(&e as &str); | |
mem::forget(e); | |
y.push(r); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Based on http://stackoverflow.com/a/30527289