aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2023-02-27 13:45:55 -0800
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2023-04-21 15:18:56 +0530
commit474e3ea8afd170ae86cc5c3a547caee65f97ecb8 (patch)
tree6b7e3e86fb79d87d9a0016aee585f98f3866510c
parent73981b2c3423a5968cf1704a9d0311ce9175f25c (diff)
downloadmeson-474e3ea8afd170ae86cc5c3a547caee65f97ecb8.zip
meson-474e3ea8afd170ae86cc5c3a547caee65f97ecb8.tar.gz
meson-474e3ea8afd170ae86cc5c3a547caee65f97ecb8.tar.bz2
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`.
-rw-r--r--docs/markdown/Rust-module.md9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/markdown/Rust-module.md b/docs/markdown/Rust-module.md
index 43dbb07..7617dbb 100644
--- a/docs/markdown/Rust-module.md
+++ b/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.