Erk- / genfut

Generate bindings for Futhark
ISC License
37 stars 10 forks source link

Missing error checking when freeing Futhark objects #16

Closed athas closed 4 years ago

athas commented 4 years ago

At the C API level, freeing a Futhark value can also return an error code. This is not exposed in the Rust code, where the return code of the freeing functions is never checked. This is likely because the implicit resource management implied by the Drop trait is incompatible with checking deallocations for errors. Futhark has no documented reason for why deallocation should ever fail, and in practice it will only occur due to compiler bugs, or perhaps driver or hardware malfunction, and never under normal circumstances. Yet, it would be better to check the error code, and perform a Rust panic in the event of deallocation error.