rust: docs: clean lifetimes markup
PATCH 1/1 rust: docs: clean lifetimes markup
Clean lifetimes markup e.g:
- /// ... 'a ... -> /// ... 'a ...
This will make lifetimes display as code span with Markdown and make it more consistent with rest of the docs.
Signed-off-by Borys Tyran <[email protected]>
--- rust/kernel/fs/file.rs | 4 ++-- rust/kernel/rbtree.rs | 6 +++--- rust/kernel/seq_file.rs | 2 +- rust/kernel/sync/poll.rs | 4 ++-- rust/kernel/types.rs | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-)
rust/kernel/fs/file.rs +2 -2
@@ -267,7 +267,7 @@ pub fn fget(fd: u32) -> Result<ARef<LocalFile>, BadFdError> {/// # 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]
rust/kernel/rbtree.rs +3 -3
@@ -886,7 +886,7 @@ fn get_neighbor_raw(&self, direction: Direction) -> Option<NonNull<bindings::rb_/// # 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 >) -> (&'bK , &'bV ) {// 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 @@ unsafe fn to_key_value<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b 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 >) -> (&'bK , &'bmut 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 @@ unsafe fn to_key_value_mut<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b/// # 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 >) -> (&'bK , *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.
rust/kernel/seq_file.rs +1 -1
@@ -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 ) -> &'aSeqFile {
rust/kernel/sync/poll.rs +2 -2
@@ -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 ) -> &'amut PollTable {// SAFETY: The safety requirements guarantee the validity of the dereference, while the // `PollTable` type being transparent makes the cast ok.
rust/kernel/types.rs +3 -3
@@ -77,7 +77,7 @@ unsafe fn try_from_foreign(ptr: *mut crate::ffi::c_void) -> Option<Self> {/// /// 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 @@ unsafe fn try_from_foreign(ptr: *mut crate::ffi::c_void) -> Option<Self> {/// /// 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
base-commit: beeb78d46249cab8b2b8359a2ce8fa5376b5ad2d
Signature · 1 line
2.48.1
Miguel Ojeda
AppliedQuoted 10 lines · Borys Tyran
Clean lifetimes markup e.g:
- /// ... 'a ... -> /// ...
'a...This will make lifetimes display as code span with Markdown and make it more consistent with rest of the docs.
Signed-off-by Borys Tyran <[email protected]>
Applied to rust-next -- thanks!
[ Reworded and changed Closes tag to Link. - Miguel ]
Cheers,
Miguel