Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
derkha
· 8y ago · 0 comments
You can convert a `String` into a `&'static str` using only safe stdlib functions via `Box::leak(s.into())`. This uses `unsafe` internally, of course... but so does almost any code.
Comments
[–]
C4K3
8y ago
Ah cool, I hadn't heard about Box::leak until now. Coming to stable in 1.26 it seems.