[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8G95KEldmnhs6iOWt4K2Qpb6_TNvLTj36k5DT1ydKnJqcmp4FY44KP6rr8aqNGZE3EirT8v2Ak14r5keNM8kf-BBC8Yobi6W2eLaiu1AFq4=@protonmail.com>
Date: Fri, 16 Jun 2023 11:14:56 +0000
From: Björn Roy Baron <bjorn3_gh@...tonmail.com>
To: Miguel Ojeda <ojeda@...nel.org>
Cc: David Gow <davidgow@...gle.com>,
Brendan Higgins <brendan.higgins@...ux.dev>,
Wedson Almeida Filho <wedsonaf@...il.com>,
Alex Gaynor <alex.gaynor@...il.com>,
Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
Benno Lossin <benno.lossin@...ton.me>,
Alice Ryhl <aliceryhl@...gle.com>,
Andreas Hindborg <nmi@...aspace.dk>,
Philip Li <philip.li@...el.com>, kunit-dev@...glegroups.com,
linux-kselftest@...r.kernel.org, rust-for-linux@...r.kernel.org,
linux-kernel@...r.kernel.org, patches@...ts.linux.dev
Subject: Re: [PATCH 4/6] rust: types: make doctests compilable/testable
------- Original Message -------
On Wednesday, June 14th, 2023 at 20:08, Miguel Ojeda <ojeda@...nel.org> 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@...nel.org>
> ---
> rust/kernel/types.rs | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
> index 1e5380b16ed5..696d6c5a3b9d 100644
> --- a/rust/kernel/types.rs
> +++ b/rust/kernel/types.rs
> @@ -109,7 +109,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {}
> /// In the example below, we have multiple exit paths and we want to log regardless of which one is
> /// taken:
> /// ```
> -/// # use kernel::ScopeGuard;
> +/// # use kernel::types::ScopeGuard;
> /// fn example1(arg: bool) {
> /// let _log = ScopeGuard::new(|| pr_info!("example1 completed\n"));
> ///
> @@ -127,7 +127,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {}
> /// In the example below, we want to log the same message on all early exits but a different one on
> /// the main exit path:
> /// ```
> -/// # use kernel::ScopeGuard;
> +/// # use kernel::types::ScopeGuard;
> /// fn example2(arg: bool) {
> /// let log = ScopeGuard::new(|| pr_info!("example2 returned early\n"));
> ///
> @@ -148,7 +148,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {}
> /// In the example below, we need a mutable object (the vector) to be accessible within the log
> /// function, so we wrap it in the [`ScopeGuard`]:
> /// ```
> -/// # use kernel::ScopeGuard;
> +/// # use kernel::types::ScopeGuard;
> /// fn example3(arg: bool) -> Result {
> /// let mut vec =
> /// ScopeGuard::new_with_data(Vec::new(), |v| pr_info!("vec had {} elements\n", v.len()));
> --
> 2.41.0
Reviewed-by: Björn Roy Baron <bjorn3_gh@...tonmail.com>
Powered by blists - more mailing lists