docs: update the Rust bindgen docs to talk about assertions

Since we now guarantee that Rust and C/C++ will have assertions both on
or both off, we can give guidance about using `cfg(debug_assertions)` to
wrap code using `#ifdef NDEBUG`.
pull/11716/head
Dylan Baker 2 years ago committed by Nirbheek Chauhan
parent 73981b2c34
commit 474e3ea8af
  1. 9
      docs/markdown/Rust-module.md

@ -41,6 +41,7 @@ libraries. This has two advantages over hand-rolling ones own with a
- It handles `include_directories`, so one doesn't have to manually convert them to `-I...`
- It automatically sets up a depfile, making the results more reliable
- It automatically handles assertions, synchronizing Rust and C/C++ to have the same behavior
It takes the following keyword arguments
@ -81,3 +82,11 @@ r1 = rust.bindgen(
output : 'out.rs',
)
```
*Since 1.1.0* Meson will synchronize assertions for Rust and C/C++ when the
`b_ndebug` option is set (via `-DNDEBUG` for C/C++, and `-C
debug-assertions=on` for Rust), and will pass `-DNDEBUG` as an extra argument
to clang. This allows for reliable wrapping of `-DNDEBUG` controlled behavior
with `#[cfg(debug_asserions)]` and or `cfg!()`. Before 1.1.0, assertions for Rust
were never turned on by Meson.

Loading…
Cancel
Save