summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-04-30 16:05:09 +0000
committerAlyssa Ross <hi@alyssa.is>2022-04-30 16:07:14 +0000
commit32b701064a15f0045bce2d811a94ac4b647ec1a1 (patch)
tree67b840a06a8184f1334d530f055b45603a3e22bb
parent75d2f40704178a78eb1e050fdf6a8c377fee55e4 (diff)
downloadspectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.tar
spectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.tar.gz
spectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.tar.bz2
spectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.tar.lz
spectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.tar.xz
spectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.tar.zst
spectrum-32b701064a15f0045bce2d811a94ac4b647ec1a1.zip
host/start-vm: abort on panic
There's nothing we could do to recover from a panic, and since we use
FFI extensively, to safely use unwinding panics we would have to wrap
every Rust function callable from C in a catch_unwind[1].

It's not currently possible[2] to use this with Rust unit tests, so we
keep panic=unwind there.  It's unlikely that a Rust unit test will
call C which calls Rust anyway.

[1]: https://doc.rust-lang.org/nomicon/unwinding.html
[2]: https://github.com/rust-lang/rust/issues/67650
-rw-r--r--host/start-vm/meson.build3
1 files changed, 2 insertions, 1 deletions
diff --git a/host/start-vm/meson.build b/host/start-vm/meson.build
index ea83e67..61b0ff7 100644
--- a/host/start-vm/meson.build
+++ b/host/start-vm/meson.build
@@ -5,13 +5,14 @@ project('start-vm', 'rust', 'c',
   default_options : ['rust_std=2018', 'warning_level=3'])
 
 add_project_arguments('-D_GNU_SOURCE', language : 'c')
+add_project_arguments('-C', 'panic=abort', language : 'rust')
 
 c_lib = static_library('start-vm-c', 'net.c', 'net-util.c')
 
 executable('start-vm', 'start-vm.rs', link_with : c_lib, install : true)
 
 test('Rust unit tests', executable('start-vm-test', 'start-vm.rs',
-  rust_args : ['--test'],
+  rust_args : ['--test', '-C', 'panic=unwind'],
   link_with : c_lib))
 
 subdir('tests')