Skip to content

Commit cd1ed11

Browse files
bortyrojeda
authored andcommitted
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: #1138 Signed-off-by: Borys Tyran <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Reworded and changed Closes tag to Link. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent fbefae5 commit cd1ed11

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

rust/kernel/fs/file.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ impl LocalFile {
267267
/// # Safety
268268
///
269269
/// * 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`.
271271
/// * The caller must ensure that if there is an active call to `fdget_pos` that did not take
272272
/// the `f_pos_lock` mutex, then that call is on the current thread.
273273
#[inline]
@@ -341,7 +341,7 @@ impl File {
341341
/// # Safety
342342
///
343343
/// * 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`.
345345
/// * The caller must ensure that if there are active `fdget_pos` calls on this file, then they
346346
/// took the `f_pos_lock` mutex.
347347
#[inline]

rust/kernel/rbtree.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ impl<'a, K, V> Cursor<'a, K, V> {
886886
/// # Safety
887887
///
888888
/// - `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`.
890890
unsafe fn to_key_value<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b V) {
891891
// SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`.
892892
let (k, v) = unsafe { Self::to_key_value_raw(node) };
@@ -897,7 +897,7 @@ impl<'a, K, V> Cursor<'a, K, V> {
897897
/// # Safety
898898
///
899899
/// - `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`.
901901
unsafe fn to_key_value_mut<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, &'b mut V) {
902902
// SAFETY: the caller guarantees that `node` is a valid pointer in an `RBTree`.
903903
let (k, v) = unsafe { Self::to_key_value_raw(node) };
@@ -908,7 +908,7 @@ impl<'a, K, V> Cursor<'a, K, V> {
908908
/// # Safety
909909
///
910910
/// - `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`.
912912
unsafe fn to_key_value_raw<'b>(node: NonNull<bindings::rb_node>) -> (&'b K, *mut V) {
913913
// SAFETY: By the type invariant of `Self`, all non-null `rb_node` pointers stored in `self`
914914
// point to the links field of `Node<K, V>` objects.

rust/kernel/seq_file.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl SeqFile {
1818
///
1919
/// # Safety
2020
///
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:
2222
/// * The pointer points at a valid `struct seq_file`.
2323
/// * The `struct seq_file` is not accessed from any other thread.
2424
pub unsafe fn from_raw<'a>(ptr: *mut bindings::seq_file) -> &'a SeqFile {

rust/kernel/sync/poll.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ impl PollTable {
4343
///
4444
/// # Safety
4545
///
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
4747
/// table (as defined in the type invariants).
4848
///
4949
/// 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`.
5151
pub unsafe fn from_ptr<'a>(ptr: *mut bindings::poll_table) -> &'a mut PollTable {
5252
// SAFETY: The safety requirements guarantee the validity of the dereference, while the
5353
// `PollTable` type being transparent makes the cast ok.

rust/kernel/types.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub trait ForeignOwnable: Sized {
7777
///
7878
/// The provided pointer must have been returned by a previous call to [`into_foreign`], and if
7979
/// 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`.
8181
///
8282
/// [`into_foreign`]: Self::into_foreign
8383
/// [`from_foreign`]: Self::from_foreign
@@ -100,9 +100,9 @@ pub trait ForeignOwnable: Sized {
100100
///
101101
/// The provided pointer must have been returned by a previous call to [`into_foreign`], and if
102102
/// 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`.
104104
///
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
106106
/// `borrow_mut` on the same object.
107107
///
108108
/// [`into_foreign`]: Self::into_foreign

0 commit comments

Comments
 (0)