Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Borys Tyran and committed by
Miguel Ojeda
cd1ed11a fbefae55

+11 -11
+2 -2
rust/kernel/fs/file.rs
··· 267 267 /// # Safety 268 268 /// 269 269 /// * The caller must ensure that `ptr` points at a valid file and that the file's refcount is 270 - /// positive for the duration of 'a. 270 + /// positive for the duration of `'a`. 271 271 /// * The caller must ensure that if there is an active call to `fdget_pos` that did not take 272 272 /// the `f_pos_lock` mutex, then that call is on the current thread. 273 273 #[inline] ··· 341 341 /// # Safety 342 342 /// 343 343 /// * The caller must ensure that `ptr` points at a valid file and that the file's refcount is 344 - /// positive for the duration of 'a. 344 + /// positive for the duration of `'a`. 345 345 /// * The caller must ensure that if there are active `fdget_pos` calls on this file, then they 346 346 /// took the `f_pos_lock` mutex. 347 347 #[inline]
+3 -3
rust/kernel/rbtree.rs
··· 886 886 /// # Safety 887 887 /// 888 888 /// - `node` must be a valid pointer to a node in an [`RBTree`]. 889 - /// - The caller has immutable access to `node` for the duration of 'b. 889 + /// - The caller has immutable access to `node` for the duration of `'b`. 890 890 unsafe fn to_key_value<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b V) { 891 891 // SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`. 892 892 let (k, v) = unsafe { Self::to_key_value_raw(node) }; ··· 897 897 /// # Safety 898 898 /// 899 899 /// - `node` must be a valid pointer to a node in an [`RBTree`]. 900 - /// - The caller has mutable access to `node` for the duration of 'b. 900 + /// - The caller has mutable access to `node` for the duration of `'b`. 901 901 unsafe fn to_key_value_mut<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b mut V) { 902 902 // SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`. 903 903 let (k, v) = unsafe { Self::to_key_value_raw(node) }; ··· 908 908 /// # Safety 909 909 /// 910 910 /// - `node` must be a valid pointer to a node in an [`RBTree`]. 911 - /// - The caller has immutable access to the key for the duration of 'b. 911 + /// - The caller has immutable access to the key for the duration of `'b`. 912 912 unsafe fn to_key_value_raw<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, *mut V) { 913 913 // SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self` 914 914 // point to the links field of `Node<K, V>` objects.
+1 -1
rust/kernel/seq_file.rs
··· 18 18 /// 19 19 /// # Safety 20 20 /// 21 - /// The caller must ensure that for the duration of 'a the following is satisfied: 21 + /// The caller must ensure that for the duration of `'a` the following is satisfied: 22 22 /// * The pointer points at a valid `struct seq_file`. 23 23 /// * The `struct seq_file` is not accessed from any other thread. 24 24 pub unsafe fn from_raw<'a>(ptr: *mut bindings::seq_file) -> &'a SeqFile {
+2 -2
rust/kernel/sync/poll.rs
··· 43 43 /// 44 44 /// # Safety 45 45 /// 46 - /// The caller must ensure that for the duration of 'a, the pointer will point at a valid poll 46 + /// The caller must ensure that for the duration of `'a`, the pointer will point at a valid poll 47 47 /// table (as defined in the type invariants). 48 48 /// 49 49 /// The caller must also ensure that the `poll_table` is only accessed via the returned 50 - /// reference for the duration of 'a. 50 + /// reference for the duration of `'a`. 51 51 pub unsafe fn from_ptr<'a>(ptr: *mut bindings::poll_table) -> &'a mut PollTable { 52 52 // SAFETY: The safety requirements guarantee the validity of the dereference, while the 53 53 // `PollTable` type being transparent makes the cast ok.
+3 -3
rust/kernel/types.rs
··· 77 77 /// 78 78 /// The provided pointer must have been returned by a previous call to [`into_foreign`], and if 79 79 /// the pointer is ever passed to [`from_foreign`], then that call must happen after the end of 80 - /// the lifetime 'a. 80 + /// the lifetime `'a`. 81 81 /// 82 82 /// [`into_foreign`]: Self::into_foreign 83 83 /// [`from_foreign`]: Self::from_foreign ··· 100 100 /// 101 101 /// The provided pointer must have been returned by a previous call to [`into_foreign`], and if 102 102 /// the pointer is ever passed to [`from_foreign`], then that call must happen after the end of 103 - /// the lifetime 'a. 103 + /// the lifetime `'a`. 104 104 /// 105 - /// The lifetime 'a must not overlap with the lifetime of any other call to [`borrow`] or 105 + /// The lifetime `'a` must not overlap with the lifetime of any other call to [`borrow`] or 106 106 /// `borrow_mut` on the same object. 107 107 /// 108 108 /// [`into_foreign`]: Self::into_foreign