Skip to content

Commit 129e97b

Browse files
y86-devojeda
authored andcommitted
rust: pin-init: fix documentation links
Before switching to compile the `pin-init` crate directly, change any links that would be invalid to links that are valid both before and after the switch. Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Fiona Behrens <[email protected]> Tested-by: Andreas Hindborg <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 5657c3a commit 129e97b

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

rust/kernel/sync/condvar.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub use new_condvar;
3737
/// spuriously.
3838
///
3939
/// Instances of [`CondVar`] need a lock class and to be pinned. The recommended way to create such
40-
/// instances is with the [`pin_init`](crate::pin_init) and [`new_condvar`] macros.
40+
/// instances is with the [`pin_init`](crate::pin_init!) and [`new_condvar`] macros.
4141
///
4242
/// # Examples
4343
///

rust/pin-init/src/__internal.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ unsafe impl<T: ?Sized> HasInitData for T {
135135
///
136136
/// If `self.is_init` is true, then `self.value` is initialized.
137137
///
138-
/// [`stack_pin_init`]: kernel::stack_pin_init
138+
/// [`stack_pin_init`]: crate::stack_pin_init
139139
pub struct StackInit<T> {
140140
value: MaybeUninit<T>,
141141
is_init: bool,
@@ -156,7 +156,7 @@ impl<T> StackInit<T> {
156156
/// Creates a new [`StackInit<T>`] that is uninitialized. Use [`stack_pin_init`] instead of this
157157
/// primitive.
158158
///
159-
/// [`stack_pin_init`]: kernel::stack_pin_init
159+
/// [`stack_pin_init`]: crate::stack_pin_init
160160
#[inline]
161161
pub fn uninit() -> Self {
162162
Self {

rust/pin-init/src/lib.rs

+11-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! To initialize a `struct` with an in-place constructor you will need two things:
1111
//! - an in-place constructor,
1212
//! - a memory location that can hold your `struct` (this can be the [stack], an [`Arc<T>`],
13-
//! [`KBox<T>`] or any other smart pointer that supports this library).
13+
//! [`Box<T>`] or any other smart pointer that supports this library).
1414
//!
1515
//! To get an in-place constructor there are generally three options:
1616
//! - directly creating an in-place constructor using the [`pin_init!`] macro,
@@ -204,7 +204,8 @@
204204
//! [structurally pinned fields]:
205205
//! https://doc.rust-lang.org/std/pin/index.html#pinning-is-structural-for-field
206206
//! [stack]: crate::stack_pin_init
207-
//! [`Arc<T>`]: crate::sync::Arc
207+
//! [`Arc<T>`]: https://rust.docs.kernel.org/kernel/sync/struct.Arc.html
208+
//! [`Box<T>`]: https://rust.docs.kernel.org/kernel/alloc/kbox/struct.Box.html
208209
//! [`impl PinInit<Foo>`]: PinInit
209210
//! [`impl PinInit<T, E>`]: PinInit
210211
//! [`impl Init<T, E>`]: Init
@@ -661,7 +662,7 @@ macro_rules! stack_try_pin_init {
661662
/// });
662663
/// ```
663664
///
664-
/// [`try_pin_init!`]: kernel::try_pin_init
665+
/// [`try_pin_init!`]: crate::try_pin_init
665666
/// [`NonNull<Self>`]: core::ptr::NonNull
666667
// For a detailed example of how this macro works, see the module documentation of the hidden
667668
// module `__internal` inside of `init/__internal.rs`.
@@ -885,7 +886,7 @@ macro_rules! assert_pinned {
885886
/// A pin-initializer for the type `T`.
886887
///
887888
/// To use this initializer, you will need a suitable memory location that can hold a `T`. This can
888-
/// be [`KBox<T>`], [`Arc<T>`] or even the stack (see [`stack_pin_init!`]).
889+
/// be [`Box<T>`], [`Arc<T>`] or even the stack (see [`stack_pin_init!`]).
889890
///
890891
/// Also see the [module description](self).
891892
///
@@ -902,7 +903,8 @@ macro_rules! assert_pinned {
902903
/// - `slot` is not partially initialized.
903904
/// - while constructing the `T` at `slot` it upholds the pinning invariants of `T`.
904905
///
905-
/// [`Arc<T>`]: crate::sync::Arc
906+
/// [`Arc<T>`]: https://rust.docs.kernel.org/kernel/sync/struct.Arc.html
907+
/// [`Box<T>`]: https://rust.docs.kernel.org/kernel/alloc/kbox/struct.Box.html
906908
#[must_use = "An initializer must be used in order to create its value."]
907909
pub unsafe trait PinInit<T: ?Sized, E = Infallible>: Sized {
908910
/// Initializes `slot`.
@@ -968,7 +970,7 @@ where
968970
/// An initializer for `T`.
969971
///
970972
/// To use this initializer, you will need a suitable memory location that can hold a `T`. This can
971-
/// be [`KBox<T>`], [`Arc<T>`] or even the stack (see [`stack_pin_init!`]). Because
973+
/// be [`Box<T>`], [`Arc<T>`] or even the stack (see [`stack_pin_init!`]). Because
972974
/// [`PinInit<T, E>`] is a super trait, you can use every function that takes it as well.
973975
///
974976
/// Also see the [module description](self).
@@ -992,7 +994,8 @@ where
992994
/// Contrary to its supertype [`PinInit<T, E>`] the caller is allowed to
993995
/// move the pointee after initialization.
994996
///
995-
/// [`Arc<T>`]: crate::sync::Arc
997+
/// [`Arc<T>`]: https://rust.docs.kernel.org/kernel/sync/struct.Arc.html
998+
/// [`Box<T>`]: https://rust.docs.kernel.org/kernel/alloc/kbox/struct.Box.html
996999
#[must_use = "An initializer must be used in order to create its value."]
9971000
pub unsafe trait Init<T: ?Sized, E = Infallible>: PinInit<T, E> {
9981001
/// Initializes `slot`.
@@ -1272,7 +1275,7 @@ pub trait InPlaceWrite<T> {
12721275
///
12731276
/// This trait must be implemented via the [`pinned_drop`] proc-macro attribute on the impl.
12741277
///
1275-
/// [`pinned_drop`]: kernel::macros::pinned_drop
1278+
/// [`pinned_drop`]: crate::macros::pinned_drop
12761279
pub unsafe trait PinnedDrop: __internal::HasPinData {
12771280
/// Executes the pinned destructor of this type.
12781281
///

0 commit comments

Comments
 (0)