Re: [PATCH 1/6] rust: init: make doctests compilable/testable

From: Martin Rodriguez Reboredo
Date: Wed Jun 14 2023 - 23:52:24 EST


On 6/14/23 15:08, Miguel Ojeda wrote:
Rust documentation tests are going to be build/run-tested
with the KUnit integration added in a future patch, thus
update them to make them compilable/testable so that we
may start enforcing it.

Signed-off-by: Miguel Ojeda <ojeda@xxxxxxxxxx>
---
[...]
//! # pub unsafe fn destroy_foo(_ptr: *mut foo) {}
//! # pub unsafe fn enable_foo(_ptr: *mut foo, _flags: u32) -> i32 { 0 }
//! # }
+//! # trait FromErrno {
+//! # fn from_errno(errno: core::ffi::c_int) -> Error {
+//! # // Dummy error that can be constructed outside the `kernel` crate.
+//! # Error::from(core::fmt::Error)
+//! # }
+//! # }
+//! # impl FromErrno for Error {}
//! /// # Invariants
//! ///
//! /// `foo` is always initialized
[...]

Little question, what's the purpose of `FromErrno` here?