Open ChienKaiMa opened 1 week ago
Hi! Yes, this would be a fine place to help add some better error messages. The error handling in the transpiler is not very robust at all and mostly done by panicking, so adding better error messages would definitely help. Something like .unwrap_or_else(|| panic!("better error message"))
would definitely be appreciated. Thanks!
I'm trying c2rust on an open source project https://github.com/berkeley-abc/abc I followed the instructions in README.md, installed c2rust from git (0.19.0), and generated
compile_commands.json
. c2rust panicked and I could not figure out which part of the C code caused the problem. Part of the command output ofRUST_BACKTRACE=full c2rust transpile compile_commands.json
I read the code https://github.com/ChienKaiMa/c2rust/blob/9eaf8a15ede349a3ed9bff4af4638a80c88b8b65/c2rust-transpile/src/translator/mod.rs#L233
I assumed that it is abnormal that this unwrap would fail, but it just happened to me. My idea is to return a error message containing
self.name
so that users are able to identify which C function caused the panic. I'm fairly new to Rust, so I'm not sure if the program behavior is as intended, or it is an opportunity for me to work on a patch.Full command output of
RUST_BACKTRACE=full c2rust transpile compile_commands.json