Commit 5e2edfbc authored by Benno Lossin's avatar Benno Lossin Committed by Treehugger Robot
Browse files

UPSTREAM: rust: macros: improve `#[vtable]` documentation



Traits marked with `#[vtable]` need to provide default implementations
for optional functions. The C side represents these with `NULL` in the
vtable, so the default functions are never actually called. We do not
want to replicate the default behavior from C in Rust, because that is
not maintainable. Therefore we should use `build_error` in those default
implementations. The error message for that is provided at
`kernel::error::VTABLE_DEFAULT_ERROR`.

Signed-off-by: default avatarBenno Lossin <benno.lossin@proton.me>
Reviewed-by: default avatarMartin Rodriguez Reboredo <yakoyoku@gmail.com>
Reviewed-by: default avatarAndreas Hindborg <a.hindborg@samsung.com>
Reviewed-by: default avatarAlice Ryhl <aliceryhl@google.com>
Reviewed-by: default avatarFinn Behrens <me@kloenk.dev>
Link: https://lore.kernel.org/r/20231026201855.1497680-1-benno.lossin@proton.me


[ Wrapped paragraph to 80 as requested and capitalized sentence. ]
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
[ Upstream commit 88c2e116 ]
Change-Id: I1f4a053e81cdd3b0c2354e6b219ccbec20265ac8
Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
parent 8bd5093c
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment