neon-bindings / neon

Rust bindings for writing safe and fast native Node.js modules.
https://www.neon-bindings.com/
Apache License 2.0
8k stars 283 forks source link

fix(neon): Close scopes in release builds #952

Closed kjvalencik closed 1 year ago

kjvalencik commented 1 year ago

There's a pretty big footgun in debug_assert_eq!. When compiled out, in addition to the assertion being removed, the included expressions do not evaluate at all.

This fix moves the necessary scope closes outside of the assertion macro.

This bug was introduced in https://github.com/neon-bindings/neon/commit/e1743934a2cf1ece9b3730ddc50c9931b8360eaf and currently only exists in the 1.0 pre-release.