diff options
author | Benno Lossin <[email protected]> | 2024-08-14 08:05:20 +0000 |
---|---|---|
committer | Miguel Ojeda <[email protected]> | 2024-08-23 06:25:59 +0200 |
commit | 0528ca0a4f858da3369d405af8c76b8248dfeb7b (patch) | |
tree | f399d58d2330aa573b2aec87aee8879e0229a6bc /rust/kernel/static_assert.rs | |
parent | c6945acad7a14b6afb390a4afc1d354ef5413ea6 (diff) |
rust: init: add `assert_pinned` macro
Add a macro to statically check if a field of a struct is marked with
`#[pin]` ie that it is structurally pinned. This can be used when
`unsafe` code needs to rely on fields being structurally pinned.
The macro has a special "inline" mode for the case where the type
depends on generic parameters from the surrounding scope.
Signed-off-by: Benno Lossin <[email protected]>
Co-developed-by: Alice Ryhl <[email protected]>
Signed-off-by: Alice Ryhl <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[ Replaced `compile_fail` with `ignore` and a TODO note. Removed
`pub` from example to clean `unreachable_pub` lint. - Miguel ]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/kernel/static_assert.rs')
0 files changed, 0 insertions, 0 deletions