Skip to content

Commit 0d7d1fa

Browse files
committed
std: update broken links in thread module
1 parent fc5bd4e commit 0d7d1fa

File tree

6 files changed

+34
-17
lines changed

6 files changed

+34
-17
lines changed

library/std/src/thread/builder.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::io;
3939
/// [`stack_size`]: Builder::stack_size
4040
/// [`name`]: Builder::name
4141
/// [`spawn`]: Builder::spawn
42-
/// [`thread::spawn`]: spawn
42+
/// [`thread::spawn`]: super::spawn
4343
/// [`io::Result`]: crate::io::Result
4444
/// [`unwrap`]: crate::result::Result::unwrap
4545
/// [naming-threads]: ./index.html#naming-threads
@@ -133,10 +133,12 @@ impl Builder {
133133
self
134134
}
135135

136-
/// Disables running and inheriting [spawn hooks](add_spawn_hook).
136+
/// Disables running and inheriting [spawn hooks].
137137
///
138138
/// Use this if the parent thread is in no way relevant for the child thread.
139139
/// For example, when lazily spawning threads for a thread pool.
140+
///
141+
/// [spawn hooks]: super::add_spawn_hook
140142
#[unstable(feature = "thread_spawn_hook", issue = "132951")]
141143
pub fn no_hooks(mut self) -> Builder {
142144
self.no_hooks = true;
@@ -151,7 +153,7 @@ impl Builder {
151153
/// thread finishes). The join handle can be used to block on
152154
/// termination of the spawned thread, including recovering its panics.
153155
///
154-
/// For a more complete documentation see [`thread::spawn`][`spawn`].
156+
/// For a more complete documentation see [`thread::spawn`].
155157
///
156158
/// # Errors
157159
///
@@ -178,6 +180,9 @@ impl Builder {
178180
///
179181
/// handler.join().unwrap();
180182
/// ```
183+
///
184+
/// [`thread::spawn`]: super::spawn
185+
/// [`spawn`]: super::spawn
181186
#[stable(feature = "rust1", since = "1.0.0")]
182187
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
183188
pub fn spawn<F, T>(self, f: F) -> io::Result<JoinHandle<T>>
@@ -199,7 +204,7 @@ impl Builder {
199204
///
200205
/// This method is identical to [`thread::Builder::spawn`][`Builder::spawn`],
201206
/// except for the relaxed lifetime bounds, which render it unsafe.
202-
/// For a more complete documentation see [`thread::spawn`][`spawn`].
207+
/// For a more complete documentation see [`thread::spawn`].
203208
///
204209
/// # Errors
205210
///
@@ -221,7 +226,7 @@ impl Builder {
221226
/// data is dropped
222227
/// - use only types with `'static` lifetime bounds, i.e., those with no or only
223228
/// `'static` references (both [`thread::Builder::spawn`][`Builder::spawn`]
224-
/// and [`thread::spawn`][`spawn`] enforce this property statically)
229+
/// and [`thread::spawn`] enforce this property statically)
225230
///
226231
/// # Examples
227232
///
@@ -246,6 +251,8 @@ impl Builder {
246251
/// ```
247252
///
248253
/// [`io::Result`]: crate::io::Result
254+
/// [`thread::spawn`]: super::spawn
255+
/// [`spawn`]: super::spawn
249256
#[stable(feature = "thread_spawn_unchecked", since = "1.82.0")]
250257
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
251258
pub unsafe fn spawn_unchecked<F, T>(self, f: F) -> io::Result<JoinHandle<T>>

library/std/src/thread/functions.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,8 @@ impl Drop for PanicGuard {
517517
/// parked_thread.join().unwrap();
518518
/// ```
519519
///
520-
/// [`unpark`]: Thread::unpark
520+
/// [`Thread`]: super::Thread
521+
/// [`unpark`]: super::Thread::unpark
521522
/// [`thread::park_timeout`]: park_timeout
522523
/// [release sequence]: https://en.cppreference.com/w/cpp/atomic/memory_order#Release_sequence
523524
#[stable(feature = "rust1", since = "1.0.0")]

library/std/src/thread/id.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ use crate::num::NonZero;
2323
/// assert!(thread::current().id() != other_thread_id);
2424
/// ```
2525
///
26-
/// [`id`]: Thread::id
26+
/// [`Thread`]: super::Thread
27+
/// [`id`]: super::Thread::id
2728
#[stable(feature = "thread_id", since = "1.19.0")]
2829
#[derive(Eq, PartialEq, Clone, Copy, Hash, Debug)]
2930
pub struct ThreadId(NonZero<u64>);

library/std/src/thread/join_handle.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ use crate::sys_common::{AsInner, IntoInner};
6565
/// thread::sleep(Duration::from_millis(1000));
6666
/// ```
6767
///
68-
/// [`thread::Builder::spawn`]: Builder::spawn
69-
/// [`thread::spawn`]: spawn
68+
/// [`thread::Builder::spawn`]: super::Builder::spawn
69+
/// [`thread::spawn`]: super::spawn
7070
#[stable(feature = "rust1", since = "1.0.0")]
7171
#[cfg_attr(target_os = "teeos", must_use)]
7272
pub struct JoinHandle<T>(pub(super) JoinInner<'static, T>);
@@ -143,7 +143,7 @@ impl<T> JoinHandle<T> {
143143
/// type.
144144
///
145145
/// [`catch_unwind`]: ../../std/panic/fn.catch_unwind.html
146-
/// [`thread::spawn`]: spawn
146+
/// [`thread::spawn`]: super::spawn
147147
#[stable(feature = "rust1", since = "1.0.0")]
148148
pub fn join(self) -> Result<T> {
149149
self.0.join()

library/std/src/thread/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@
137137
//! Note that the stack size of the main thread is *not* determined by Rust.
138138
//!
139139
//! [channels]: crate::sync::mpsc
140+
//! [`Arc`]: crate::sync::Arc
140141
//! [`join`]: JoinHandle::join
141142
//! [`Result`]: crate::result::Result
142143
//! [`Ok`]: crate::result::Result::Ok

library/std/src/thread/thread.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,8 @@ impl Inner {
6464
/// Threads are represented via the `Thread` type, which you can get in one of
6565
/// two ways:
6666
///
67-
/// * By spawning a new thread, e.g., using the [`thread::spawn`][`spawn`]
68-
/// function, and calling [`thread`][`JoinHandle::thread`] on the
69-
/// [`JoinHandle`].
67+
/// * By spawning a new thread, e.g., using the [`thread::spawn`]
68+
/// function, and calling [`thread`] on the [`JoinHandle`].
7069
/// * By requesting the current thread, using the [`thread::current`] function.
7170
///
7271
/// The [`thread::current`] function is available even for threads not spawned
@@ -76,7 +75,12 @@ impl Inner {
7675
/// should instead use a function like `spawn` to create new threads, see the
7776
/// docs of [`Builder`] and [`spawn`] for more details.
7877
///
79-
/// [`thread::current`]: current::current
78+
/// [`thread::spawn`]: super::spawn
79+
/// [`thread`]: super::JoinHandle::thread
80+
/// [`JoinHandle`]: super::JoinHandle
81+
/// [`thread::current`]: super::current::current
82+
/// [`Builder`]: super::Builder
83+
/// [`spawn`]: super::spawn
8084
pub struct Thread {
8185
inner: Pin<Arc<Inner>>,
8286
}
@@ -123,10 +127,10 @@ impl Thread {
123127
/// Atomically makes the handle's token available if it is not already.
124128
///
125129
/// Every thread is equipped with some basic low-level blocking support, via
126-
/// the [`park`][park] function and the `unpark()` method. These can be
127-
/// used as a more CPU-efficient implementation of a spinlock.
130+
/// the [`park`] function and the `unpark()` method. These can be used as a
131+
/// more CPU-efficient implementation of a spinlock.
128132
///
129-
/// See the [park documentation][park] for more details.
133+
/// See the [park documentation] for more details.
130134
///
131135
/// # Examples
132136
///
@@ -163,6 +167,9 @@ impl Thread {
163167
///
164168
/// parked_thread.join().unwrap();
165169
/// ```
170+
///
171+
/// [`park`]: super::park
172+
/// [park documentation]: super::park
166173
#[stable(feature = "rust1", since = "1.0.0")]
167174
#[inline]
168175
pub fn unpark(&self) {

0 commit comments

Comments
 (0)