diff options
author | 2024-10-05 19:51:23 +0000 | |
---|---|---|
committer | 2024-10-10 00:33:42 +0200 | |
commit | e9759c5b9ea555d09f426c70c880e9522e9b0576 (patch) | |
tree | 417bd77d83af734fcddb34db723495699da5f84b /scripts/generate_rust_analyzer.py | |
parent | rust: lock: add trylock method support for lock backend (diff) | |
download | wireguard-linux-e9759c5b9ea555d09f426c70c880e9522e9b0576.tar.xz wireguard-linux-e9759c5b9ea555d09f426c70c880e9522e9b0576.zip |
rust: error: optimize error type to use nonzero
Optimize `Result<(), Error>` size by changing `Error` type to
`NonZero*` for niche optimization.
This reduces the space used by the `Result` type, as the `NonZero*`
type enables the compiler to apply more efficient memory layout.
For example, the `Result<(), Error>` changes size from 8 to 4 bytes.
Link: https://github.com/Rust-for-Linux/linux/issues/1120
Signed-off-by: Filipe Xavier <felipe_life@live.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Link: https://lore.kernel.org/r/BL0PR02MB4914B9B088865CF237731207E9732@BL0PR02MB4914.namprd02.prod.outlook.com
[ Removed unneeded block around `match`, added backticks in panic
message and added intra-doc link. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions