Live data from Hacker News

Show HN: I built a Rust crate for running unsafe code safely

github.com

1–10 of 72 posts

Re: Show HN: I built a Rust crate for running unsafe code safely

#3

This is cool from a theoretical perspective, but `fork()` can be prohibitively expensive, at least on the hot path. This is a cool tool that should be used with care.

The author seems aware of this given their "Run your code 1ms slower" remark in the use cases section.

Re: Show HN: I built a Rust crate for running unsafe code safely

#4
Forking and this package can be useful if you know that the unsafe code is really unsafe and have no hope of making it better.

But I wouldn't use this often. I'd be willing to bet that you'd lose all performance benefits of using Rust versus something like Python or Ruby that uses forking extensively for parallelism.

Re: Show HN: I built a Rust crate for running unsafe code safely

#5
this seems like a good place to ask, I don’t write very much unsafe Rust code… but when I do, it’s because I’m calling the Win32 API.

Tools like valgrind do not work on windows, and I am nowhere near smart enough to know the entire layout of memory that should exist.

When using Windows and calling system system functions, there’s a lot of casting involved; to convert wide characters and DWORDS to rust primitives for example. And given that I don’t have a good debugging situation, I’m terrified that I’m corrupting or leaking memory.

does anyone know any good tools that work on windows to help me out here?

Re: Show HN: I built a Rust crate for running unsafe code safely

#7
post #5

this seems like a good place to ask, I don’t write very much unsafe Rust code… but when I do, it’s because I’m calling the Win32 API. Tools like valgrind do not work on windows, and I am nowhere near smart enough to know the entire layout of memory that should exist. When using Windows and calling system system functions, there’s a lot of casting involved; to convert wide characters and DWORDS to rust primitives for…

There are plenty of tools, but they are C and C++ specific.

Starts with Visual C++ analysers, SAL annotations, hardned runtime.

Then commercial tooling like PVS Studio, Parasoft for example.

Re: Show HN: I built a Rust crate for running unsafe code safely

#9

This is cool from a theoretical perspective, but `fork()` can be prohibitively expensive, at least on the hot path. This is a cool tool that should be used with care.

Which pretty much makes this whole thing pointless since a lot of unsafe code exists purely for performance reasons.

Re: Show HN: I built a Rust crate for running unsafe code safely

#10
post #9

This is cool from a theoretical perspective, but `fork()` can be prohibitively expensive, at least on the hot path. This is a cool tool that should be used with care.

Which pretty much makes this whole thing pointless since a lot of unsafe code exists purely for performance reasons.

Far from all of it, seems like a big leap to write it off as pointless because of one subset.
Post reply on HN