summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorys Tyran <borys.tyran@protonmail.com>2025-02-07 14:25:07 +0000
committerMiguel Ojeda <ojeda@kernel.org>2025-03-08 23:04:38 +0100
commitcd1ed11a6704638e94ccafe0ba1c3b4a11aab8f3 (patch)
treeb61d8b92d90f4d071268e4dd198a800193d4ca84
parentfbefae55991f688f5f1615af30fe64823076b072 (diff)
downloadlinux-cd1ed11a6704638e94ccafe0ba1c3b4a11aab8f3.tar.gz
linux-cd1ed11a6704638e94ccafe0ba1c3b4a11aab8f3.tar.bz2
linux-cd1ed11a6704638e94ccafe0ba1c3b4a11aab8f3.zip
rust: improve lifetimes markup
Improve lifetimes markup; e.g. from: /// ... 'a ... to: /// ... `'a` ... This will make lifetimes display as code span with Markdown and make it more consistent with rest of the docs. Link: https://github.com/Rust-for-Linux/linux/issues/1138 Signed-off-by: Borys Tyran <borys.tyran@protonmail.com> Link: https://lore.kernel.org/r/20250207142437.112435-1-borys.tyran@protonmail.com [ Reworded and changed Closes tag to Link. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
-rw-r--r--rust/kernel/fs/file.rs4
-rw-r--r--rust/kernel/rbtree.rs6
-rw-r--r--rust/kernel/seq_file.rs2
-rw-r--r--rust/kernel/sync/poll.rs4
-rw-r--r--rust/kernel/types.rs6
5 files changed, 11 insertions, 11 deletions
diff --git a/rust/kernel/fs/file.rs b/rust/kernel/fs/file.rs
index e03dbe14d62a..ed57e0137cdb 100644
--- a/rust/kernel/fs/file.rs
+++ b/rust/kernel/fs/file.rs
@@ -267,7 +267,7 @@ impl LocalFile {
/// # Safety
///
/// * The caller must ensure that `ptr` points at a valid file and that the file's refcount is
- /// positive for the duration of 'a.
+ /// positive for the duration of `'a`.
/// * The caller must ensure that if there is an active call to `fdget_pos` that did not take
/// the `f_pos_lock` mutex, then that call is on the current thread.
#[inline]
@@ -341,7 +341,7 @@ impl File {
/// # Safety
///
/// * The caller must ensure that `ptr` points at a valid file and that the file's refcount is
- /// positive for the duration of 'a.
+ /// positive for the duration of `'a`.
/// * The caller must ensure that if there are active `fdget_pos` calls on this file, then they
/// took the `f_pos_lock` mutex.
#[inline]
diff --git a/rust/kernel/rbtree.rs b/rust/kernel/rbtree.rs
index 0d1e75810664..1ea25c7092fb 100644
--- a/rust/kernel/rbtree.rs
+++ b/rust/kernel/rbtree.rs
@@ -886,7 +886,7 @@ impl<'a, K, V> Cursor<'a, K, V> {
/// # Safety
///
/// - `node` must be a valid pointer to a node in an [`RBTree`].
- /// - The caller has immutable access to `node` for the duration of 'b.
+ /// - The caller has immutable access to `node` for the duration of `'b`.
unsafe fn to_key_value<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b V) {
// SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`.
let (k, v) = unsafe { Self::to_key_value_raw(node) };
@@ -897,7 +897,7 @@ impl<'a, K, V> Cursor<'a, K, V> {
/// # Safety
///
/// - `node` must be a valid pointer to a node in an [`RBTree`].
- /// - The caller has mutable access to `node` for the duration of 'b.
+ /// - The caller has mutable access to `node` for the duration of `'b`.
unsafe fn to_key_value_mut<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b mut V) {
// SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`.
let (k, v) = unsafe { Self::to_key_value_raw(node) };
@@ -908,7 +908,7 @@ impl<'a, K, V> Cursor<'a, K, V> {
/// # Safety
///
/// - `node` must be a valid pointer to a node in an [`RBTree`].
- /// - The caller has immutable access to the key for the duration of 'b.
+ /// - The caller has immutable access to the key for the duration of `'b`.
unsafe fn to_key_value_raw<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, *mut V) {
// SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self`
// point to the links field of `Node<K, V>` objects.
diff --git a/rust/kernel/seq_file.rs b/rust/kernel/seq_file.rs
index 04947c672979..4c03881a9eba 100644
--- a/rust/kernel/seq_file.rs
+++ b/rust/kernel/seq_file.rs
@@ -18,7 +18,7 @@ impl SeqFile {
///
/// # Safety
///
- /// The caller must ensure that for the duration of 'a the following is satisfied:
+ /// The caller must ensure that for the duration of `'a` the following is satisfied:
/// * The pointer points at a valid `struct seq_file`.
/// * The `struct seq_file` is not accessed from any other thread.
pub unsafe fn from_raw<'a>(ptr: *mut bindings::seq_file) -> &'a SeqFile {
diff --git a/rust/kernel/sync/poll.rs b/rust/kernel/sync/poll.rs
index d5f17153b424..e105477a3cb1 100644
--- a/rust/kernel/sync/poll.rs
+++ b/rust/kernel/sync/poll.rs
@@ -43,11 +43,11 @@ impl PollTable {
///
/// # Safety
///
- /// The caller must ensure that for the duration of 'a, the pointer will point at a valid poll
+ /// The caller must ensure that for the duration of `'a`, the pointer will point at a valid poll
/// table (as defined in the type invariants).
///
/// The caller must also ensure that the `poll_table` is only accessed via the returned
- /// reference for the duration of 'a.
+ /// reference for the duration of `'a`.
pub unsafe fn from_ptr<'a>(ptr: *mut bindings::poll_table) -> &'a mut PollTable {
// SAFETY: The safety requirements guarantee the validity of the dereference, while the
// `PollTable` type being transparent makes the cast ok.
diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs
index 2bbaab83b9d6..9cb573d39c34 100644
--- a/rust/kernel/types.rs
+++ b/rust/kernel/types.rs
@@ -77,7 +77,7 @@ pub trait ForeignOwnable: Sized {
///
/// The provided pointer must have been returned by a previous call to [`into_foreign`], and if
/// the pointer is ever passed to [`from_foreign`], then that call must happen after the end of
- /// the lifetime 'a.
+ /// the lifetime `'a`.
///
/// [`into_foreign`]: Self::into_foreign
/// [`from_foreign`]: Self::from_foreign
@@ -100,9 +100,9 @@ pub trait ForeignOwnable: Sized {
///
/// The provided pointer must have been returned by a previous call to [`into_foreign`], and if
/// the pointer is ever passed to [`from_foreign`], then that call must happen after the end of
- /// the lifetime 'a.
+ /// the lifetime `'a`.
///
- /// The lifetime 'a must not overlap with the lifetime of any other call to [`borrow`] or
+ /// The lifetime `'a` must not overlap with the lifetime of any other call to [`borrow`] or
/// `borrow_mut` on the same object.
///
/// [`into_foreign`]: Self::into_foreign