diff options
author | Benno Lossin <[email protected]> | 2023-08-14 08:46:55 +0000 |
---|---|---|
committer | Miguel Ojeda <[email protected]> | 2023-08-21 14:31:48 +0200 |
commit | b9b88be046a92a43d70badb340cac9ffd9695dcb (patch) | |
tree | 923a5b1f6733aa127751afb56f8e763e471b3656 /rust/kernel/task.rs | |
parent | 97de919d574e6a22f0d43a169b96274f1862e770 (diff) |
rust: init: wrap type checking struct initializers in a closure
In the implementation of the init macros there is a `if false` statement
that type checks the initializer to ensure every field is initialized.
Since the next patch has a stack variable to store the struct, the
function might allocate too much memory on debug builds. Putting the
struct into a closure that is never executed ensures that even in debug
builds no stack overflow error is caused. In release builds this was not
a problem since the code was optimized away due to the `if false`.
Reviewed-by: Martin Rodriguez Reboredo <[email protected]>
Reviewed-by: Alice Ryhl <[email protected]>
Reviewed-by: Gary Guo <[email protected]>
Signed-off-by: Benno Lossin <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/kernel/task.rs')
0 files changed, 0 insertions, 0 deletions