Passing an immutable reference (&p) to a function that mutates the data behind the pointer violates Rust's invariants.
This causes multiple tests in the test suite to crash when compiling it with optimizations (either --release mode or with opt-level of 2 or 3) with recent Rust versions, which is easy to reproduce, especially with nightly Rust:
$ cargo +nightly test --release --package glib
(...)
error: test failed, to rerun pass `--lib`
Caused by:
process didn't exit successfully: (...) (signal: 11, SIGSEGV: invalid memory reference)
Looks like this wasn't caught earlier because the wrapped C function is variadic and there's less type checking happening because of that.
Passing an immutable reference (&p) to a function that mutates the data behind the pointer violates Rust's invariants.
This causes multiple tests in the test suite to crash when compiling it with optimizations (either
--release
mode or withopt-level
of 2 or 3) with recent Rust versions, which is easy to reproduce, especially with nightly Rust:Looks like this wasn't caught earlier because the wrapped C function is variadic and there's less type checking happening because of that.