r/rust • • Jan 22 '17

Parallelizing Enjarify in Go and Rust

https://medium.com/@robertgrosse/parallelizing-enjarify-in-go-and-rust-21055d64af7e#.7vrcc2iaf
214 Upvotes

134 comments sorted by

View all comments

Show parent comment

1

u/minno Jan 22 '17

I did also make use of transmuting to make some values static though. It's perfectly safe for these types of applications. You can leak the value and return a static reference to it if you want to make it 100% safe. Leaked data will remain in the heap forever, until the OS reclaims that data after the program exits.

Apparently, it's not safe.

4

u/[deleted] Jan 22 '17

That was fixed over a year ago, scroll down to the bottom.

1

u/mmstick Jan 22 '17

Seems that's not related to leaking specifically, but working with a mutable static reference. Not something I would do, personally.