|
|
|
|
|
by Liquid_Fire
12 days ago
|
|
> if rustc emits machine code and then cargo immediately executes it, there's the same opportunity for end user memory being corrupted (due to miscompilation) as if rustc and cargo shared a code base Your tests run in an entirely separate process from the compiler (and from cargo). This makes it very different from memory corruption in the compiler: - The test process can only corrupt its own memory. - You don't need "unsafe" to run tests. Just the ability to start another process. - If you're cross-compiling, you wouldn't even be able to run the tests on the same machine (without emulation/compatibility layers) Does roc run tests in the same process as the compiler? |
|
We do for tests of pure functions, yes.
> Your tests run in an entirely separate process from the compiler (and from cargo).
That's a great point and a relevant distinction, although Rust tests can run arbitrary I/O, so it's not like having them be in a separate process means memory corruption is harmless! :)