diff options
| author | Miguel Ojeda <[email protected]> | 2024-09-04 22:43:31 +0200 |
|---|---|---|
| committer | Miguel Ojeda <[email protected]> | 2024-10-07 10:49:15 +0200 |
| commit | 567cdff53e71de56ae67eaf4309db38778b7bcd3 (patch) | |
| tree | 8b75363fc0072c46594763929d9ab18bfd5b95c0 /rust/kernel/alloc/allocator.rs | |
| parent | a135aa3d30d28f26eb28a0ff5d48b387b0e0755f (diff) | |
rust: types: avoid repetition in `{As,From}Bytes` impls
In order to provide `// SAFETY` comments for every `unsafe impl`, we would
need to repeat them, which is not very useful and would be harder to read.
We could perhaps allow the lint (ideally within a small module), but we
can take the chance to avoid the repetition of the `impl`s themselves
too by using a small local macro, like in other places where we have
had to do this sort of thing.
Thus add the straightforward `impl_{from,as}bytes!` macros and use them
to implement `FromBytes`.
This, in turn, will allow us in the next patch to place a `// SAFETY`
comment that defers to the actual invocation of the macro.
Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Trevor Gross <[email protected]>
Tested-by: Gary Guo <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/kernel/alloc/allocator.rs')
0 files changed, 0 insertions, 0 deletions