Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit 6e8136b

Browse files
committed
Update guidance about use of the Result type
1 parent 74da3ea commit 6e8136b

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

docs/development/contributing.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ Additionally, please follow these guidelines:
6565
* Keep the Rust code to the leaves.
6666
* Don't hand over control between Rust and C++ more than absolutely necessary.
6767
* Have C++ call into Rust, not the other way around.
68-
* Don't use cxx to return `Result` types across the FFI. (It might throw a C++
69-
exception.)
68+
* Use of `Result` types across the FFI is permitted, because it is the only enum
69+
(variant) type Cxx supports and the only good way to indicate failures. If you
70+
do return `Result`, **you MUST wrap the C++ call site in a `try-catch`
71+
block.**
7072
* Run `cargo fix && cargo fmt` before submitting code for review. You may need to run the
7173
nightly to support all options in `rustfmt.toml`: `rustup run nightly cargo
7274
fmt`.

0 commit comments

Comments
 (0)