summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poveda <christian.poveda@ferrous-systems.com>2022-09-06 16:34:58 -0500
committerDarren Kulp <darren@kulp.ch>2022-09-09 21:16:42 -0400
commit8b29355ca0ce54e941d398ef9a605e9b5c0f20ae (patch)
treeb599f5891bc5d159ca64c426a2b1528415585d1f
parent7464da38458d806aedc46cb8310e3855ab0fdf79 (diff)
document usage of `syn` in `CONTRIBUTING.md`
-rw-r--r--CONTRIBUTING.md14
1 files changed, 13 insertions, 1 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 3fe7539f..2974ba42 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -318,7 +318,19 @@ parameters a given type uses. The analyses are defined in
The final phase is generating Rust source text from the analyzed IR, and it is
defined in `src/codegen/*`. We use the `quote` crate, which provides the `quote!
-{ ... }` macro for quasi-quoting Rust forms.
+{ ... }` macro for quasi-quoting Rust forms. Some options that affect the
+generated Rust code are implemented using the [`syn`](https://docs.rs/syn) crate.
+
+### Implementing new options using `syn`
+
+Here is a list of recommendations to be followed if a new option can be
+implemented using the `syn` crate:
+
+- The `BindgenOptions::require_syn` method must be updated to reflect that this
+ new option requires parsing the generated Rust code with `syn`.
+
+- The implementation of the new option should be added at the end of
+ `Bindings::generate`, inside the `if options.require_syn() { ... }` block.
## Pull Requests and Code Reviews