Skip to content

Commit 078ca6a

Browse files
authored
Merge pull request tock#4814 from jrvanwhy/proc-macro-deps
ExternalDependencies: allow procedural macro ecosystem crates in tock-registers.
2 parents b35fad8 + c68ca96 commit 078ca6a

1 file changed

Lines changed: 28 additions & 5 deletions

File tree

doc/ExternalDependencies.md

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ Such functionality includes:
115115
correct and resistant to attacks is challenging. Leveraging validated,
116116
high-quality cryptographic libraries instead of Tock-specific cryptographic
117117
code increases the security of the Tock kernel.
118+
* Procedural macro support. The `syn`, `quote`, and `proc-macro2` crates are
119+
effectively a core part of the Rust language, despite being distributed
120+
separately from the Rust toolchain. They enable tock-registers to expose
121+
sound, highly-testable interfaces to hardware peripherals. Unit- and
122+
integration-testing code increases the reliability and security of the Tock
123+
kernel.
118124

119125
#### Project Understandability
120126

@@ -196,7 +202,7 @@ development in a standalone repository is necessary for the continued
196202
development, improvement, and impact of the crate.
197203

198204
All crates permitted by this exception MUST NOT have any external dependencies
199-
themselves.
205+
themselves unless explicitly permitted by this document.
200206

201207
Any crates included in this exception list, with their associated justification,
202208
do not imply any predisposition to allowing an exception for any future
@@ -205,14 +211,13 @@ crates. All exceptions will be considered independently.
205211
#### Approved Exceptions for Core Kernel External Dependencies
206212

207213
##### **tock-registers**
208-
This crate provides an interface for using MMIO registers which are extensively
209-
used in `chips/` crates.
214+
The `tock-registers` crates provide an interface for using MMIO registers which
215+
is extensively used in `chips/` crates.
210216

211217
- **Repository:** https://github.com/tock/tock-registers
212-
- **Justification:** This crate has moved to an external dependency to
218+
- **Justification:** This project has moved to an external dependency to
213219
encourage its development and use in projects beyond Tock. Specifically, the
214220
benefits of development in a separate repository include:
215-
216221
1. Encouraging more rigorous backwards compatibility considerations for
217222
external users. The close interplay of Tock and tock-registers means
218223
breaking changes for external users can be hidden in Tock-specific pull
@@ -229,6 +234,24 @@ used in `chips/` crates.
229234
repository makes it clear it is a standalone project and can be developed
230235
independently of Tock. This should help contributions that benefit
231236
tock-registers but not necessarily Tock as well.
237+
- **Dependencies:** `tock-registers` crates may have dev-dependencies on
238+
external crates to support unit testing, as those dev-dependencies are not
239+
included in a Tock kernel build. Additionally, `tock-registers` crates may
240+
depend on the `syn`, `quote`, and `proc-macro2` crates for the following
241+
reasons:
242+
1. **Important functionality:** Procedural macros need to parse nontrivial
243+
Rust code and generate nontrivial Rust code, and `syn` and `quote` provide
244+
that functionality. It would require considerable effort for us to
245+
implement and maintain that ourselves. `quote` has a hard dependency on
246+
`proc-macro2`, which is also useful to support the procedural macros' unit
247+
tests, so that is included as well.
248+
2. **Project maturity:** These crates are core Rust ecosystem mechanisms, and
249+
have been stable for years. All three crates are in the top 10
250+
all-time-most-downloaded crates on crates.io.
251+
3. **Limited sub-dependencies:** The only additional dependency these crates
252+
bring in is `unicode-ident`, which has no dependencies. `unicode-ident` is
253+
relatively small and simple, and is a top 30 all-time-most-downloaded crate
254+
on crates.io.
232255

233256
##### **flux-rs**
234257
This crate provides support for formal verification of Rust code via

0 commit comments

Comments
 (0)