summaryrefslogtreecommitdiff
path: root/rust/kernel/sync/lock
diff options
context:
space:
mode:
authorMiguel Ojeda <ojeda@kernel.org>2023-07-18 08:27:49 +0300
committerShuah Khan <skhan@linuxfoundation.org>2023-07-19 18:32:41 +0300
commitbfa7dff036f0cbb2ccb0385c8b666204d6b8eb3a (patch)
treeb620935c27815fe54deecfb9a705af5cc1140eac /rust/kernel/sync/lock
parentcf36a495f07059d23d62640a3f7b6b157da1bfa0 (diff)
downloadlinux-bfa7dff036f0cbb2ccb0385c8b666204d6b8eb3a.tar.xz
rust: sync: make doctests compilable/testable
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. Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com> Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com> Reviewed-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'rust/kernel/sync/lock')
-rw-r--r--rust/kernel/sync/lock/mutex.rs1
-rw-r--r--rust/kernel/sync/lock/spinlock.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/rust/kernel/sync/lock/mutex.rs b/rust/kernel/sync/lock/mutex.rs
index 923472f04af4..09276fedc091 100644
--- a/rust/kernel/sync/lock/mutex.rs
+++ b/rust/kernel/sync/lock/mutex.rs
@@ -63,6 +63,7 @@ macro_rules! new_mutex {
/// assert_eq!(e.c, 10);
/// assert_eq!(e.d.lock().a, 20);
/// assert_eq!(e.d.lock().b, 30);
+/// # Ok::<(), Error>(())
/// ```
///
/// The following example shows how to use interior mutability to modify the contents of a struct
diff --git a/rust/kernel/sync/lock/spinlock.rs b/rust/kernel/sync/lock/spinlock.rs
index 979b56464a4e..91eb2c9e9123 100644
--- a/rust/kernel/sync/lock/spinlock.rs
+++ b/rust/kernel/sync/lock/spinlock.rs
@@ -61,6 +61,7 @@ macro_rules! new_spinlock {
/// assert_eq!(e.c, 10);
/// assert_eq!(e.d.lock().a, 20);
/// assert_eq!(e.d.lock().b, 30);
+/// # Ok::<(), Error>(())
/// ```
///
/// The following example shows how to use interior mutability to modify the contents of a struct