From f85d231301b506b512bb36d80c840d8478329b25 Mon Sep 17 00:00:00 2001 From: Eric Seppanen Date: Sat, 8 Aug 2020 22:50:56 -0700 Subject: [PATCH 1/7] clarify documentation of remove_dir errors remove_dir will error if the path doesn't exist or isn't a directory. It's useful to clarify that this is "remove dir or fail" not "remove dir if it exists". I don't think this belongs in the title. "Removes an existing, empty directory" is strangely worded-- there's no such thing as a non-existing directory. Better to just say explicitly it will return an error. --- library/std/src/fs.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 047478fcc855a..ea4e096b05e9f 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1991,7 +1991,7 @@ pub fn create_dir_all>(path: P) -> io::Result<()> { DirBuilder::new().recursive(true).create(path.as_ref()) } -/// Removes an existing, empty directory. +/// Removes an empty directory. /// /// # Platform-specific behavior /// @@ -2006,6 +2006,8 @@ pub fn create_dir_all>(path: P) -> io::Result<()> { /// This function will return an error in the following situations, but is not /// limited to just these cases: /// +/// * `path` doesn't exist. +/// * `path` isn't a directory. /// * The user lacks permissions to remove the directory at the provided `path`. /// * The directory isn't empty. /// From fa8d396d58366f62049c0df622dd09897966ed13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sat, 15 Aug 2020 00:00:00 +0000 Subject: [PATCH 2/7] Fix RFC-1014 test Use two printlns when testing that writing to a closed stdout does not panic. Otherwise the test is ineffective, since the current implementation silently ignores the error during first println regardless. --- src/test/ui/rfcs/rfc-1014-2.rs | 3 ++- src/test/ui/rfcs/rfc-1014.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/test/ui/rfcs/rfc-1014-2.rs b/src/test/ui/rfcs/rfc-1014-2.rs index 5be092204d7c0..7dd65701f125c 100644 --- a/src/test/ui/rfcs/rfc-1014-2.rs +++ b/src/test/ui/rfcs/rfc-1014-2.rs @@ -23,7 +23,8 @@ fn close_stdout() { #[cfg(windows)] fn main() { close_stdout(); - println!("hello world"); + println!("hello"); + println!("world"); } #[cfg(not(windows))] diff --git a/src/test/ui/rfcs/rfc-1014.rs b/src/test/ui/rfcs/rfc-1014.rs index 41a036958bfea..53b8fddcf31e0 100644 --- a/src/test/ui/rfcs/rfc-1014.rs +++ b/src/test/ui/rfcs/rfc-1014.rs @@ -30,5 +30,6 @@ fn close_stdout() { fn main() { close_stdout(); - println!("hello world"); + println!("hello"); + println!("world"); } From c27fed5f07e604e812013322d3513f3e908c3af6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Tue, 18 Aug 2020 13:11:49 +0200 Subject: [PATCH 3/7] Update mailmap for mati865 --- .mailmap | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index 15ca403456a4e..cc7b2a677baf6 100644 --- a/.mailmap +++ b/.mailmap @@ -176,8 +176,8 @@ Mark Sinclair =Mark Sinclair <=125axel125@gmail.com> Markus Westerlind Markus Martin Hafskjold Thoresen Matej Lach Matej Ľach -Mateusz Mikuła -Mateusz Mikuła +Mateusz Mikuła +Mateusz Mikuła Matt Brubeck Matthew Auld Matthew Kraai From e0430a8aa20b7ea3743e9c6fa5cf1afa3ddee6f7 Mon Sep 17 00:00:00 2001 From: Camelid Date: Wed, 19 Aug 2020 14:00:53 -0700 Subject: [PATCH 4/7] Switch to intra-doc links in `core::result` --- library/core/src/result.rs | 83 +++++++------------------------------- 1 file changed, 15 insertions(+), 68 deletions(-) diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 5eddcb2172abe..95da7ff1df9a8 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -216,17 +216,14 @@ //! [`?`] can only be used in functions that return [`Result`] because of the //! early return of [`Err`] that it provides. //! -//! [`expect`]: enum.Result.html#method.expect +//! [`expect`]: Result::expect //! [`Write`]: ../../std/io/trait.Write.html //! [`write_all`]: ../../std/io/trait.Write.html#method.write_all //! [`io::Result`]: ../../std/io/type.Result.html //! [`?`]: ../../std/macro.try.html -//! [`Result`]: enum.Result.html -//! [`Ok(T)`]: enum.Result.html#variant.Ok -//! [`Err(E)`]: enum.Result.html#variant.Err +//! [`Ok(T)`]: Ok +//! [`Err(E)`]: Err //! [`io::Error`]: ../../std/io/struct.Error.html -//! [`Ok`]: enum.Result.html#variant.Ok -//! [`Err`]: enum.Result.html#variant.Err #![stable(feature = "rust1", since = "1.0.0")] @@ -237,9 +234,6 @@ use crate::{convert, fmt}; /// `Result` is a type that represents either success ([`Ok`]) or failure ([`Err`]). /// /// See the [`std::result`](index.html) module documentation for details. -/// -/// [`Ok`]: enum.Result.html#variant.Ok -/// [`Err`]: enum.Result.html#variant.Err #[derive(Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)] #[must_use = "this `Result` may be an `Err` variant, which should be handled"] #[rustc_diagnostic_item = "result_type"] @@ -267,8 +261,6 @@ impl Result { /// Returns `true` if the result is [`Ok`]. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// /// # Examples /// /// Basic usage: @@ -290,8 +282,6 @@ impl Result { /// Returns `true` if the result is [`Err`]. /// - /// [`Err`]: enum.Result.html#variant.Err - /// /// # Examples /// /// Basic usage: @@ -378,7 +368,7 @@ impl Result { /// Converts `self` into an [`Option`], consuming `self`, /// and discarding the error, if any. /// - /// [`Option`]: ../../std/option/enum.Option.html + /// [`Option`]: Option /// /// # Examples /// @@ -405,7 +395,7 @@ impl Result { /// Converts `self` into an [`Option`], consuming `self`, /// and discarding the success value, if any. /// - /// [`Option`]: ../../std/option/enum.Option.html + /// [`Option`]: Option /// /// # Examples /// @@ -497,9 +487,6 @@ impl Result { /// /// This function can be used to compose the results of two functions. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err - /// /// # Examples /// /// Print the numbers on each line of a string multiplied by two. @@ -530,9 +517,7 @@ impl Result { /// the result of a function call, it is recommended to use [`map_or_else`], /// which is lazily evaluated. /// - /// [`map_or_else`]: #method.map_or_else - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err + /// [`map_or_else`]: Result::map_or_else /// /// # Examples /// @@ -559,8 +544,6 @@ impl Result { /// This function can be used to unpack a successful result /// while handling an error. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -590,8 +573,6 @@ impl Result { /// This function can be used to pass through a successful result while handling /// an error. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -671,8 +652,6 @@ impl Result { /// Returns `res` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -706,8 +685,6 @@ impl Result { /// Calls `op` if the result is [`Ok`], otherwise returns the [`Err`] value of `self`. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// This function can be used for control flow based on `Result` values. /// @@ -739,9 +716,7 @@ impl Result { /// result of a function call, it is recommended to use [`or_else`], which is /// lazily evaluated. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err - /// [`or_else`]: #method.or_else + /// [`or_else`]: Result::or_else /// /// # Examples /// @@ -777,8 +752,6 @@ impl Result { /// /// This function can be used for control flow based on result values. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -808,9 +781,7 @@ impl Result { /// the result of a function call, it is recommended to use [`unwrap_or_else`], /// which is lazily evaluated. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err - /// [`unwrap_or_else`]: #method.unwrap_or_else + /// [`unwrap_or_else`]: Result::unwrap_or_else /// /// # Examples /// @@ -835,7 +806,6 @@ impl Result { /// Returns the contained [`Ok`] value or computes it from a closure. /// - /// [`Ok`]: enum.Result.html#variant.Ok /// /// # Examples /// @@ -945,8 +915,6 @@ impl Result { /// Panics if the value is an [`Err`], with a panic message including the /// passed message, and the content of the [`Err`]. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -973,17 +941,15 @@ impl Result { /// case explicitly, or call [`unwrap_or`], [`unwrap_or_else`], or /// [`unwrap_or_default`]. /// - /// [`unwrap_or`]: #method.unwrap_or - /// [`unwrap_or_else`]: #method.unwrap_or_else - /// [`unwrap_or_default`]: #method.unwrap_or_default + /// [`unwrap_or`]: Result::unwrap_or + /// [`unwrap_or_else`]: Result::unwrap_or_else + /// [`unwrap_or_default`]: Result::unwrap_or_default /// /// # Panics /// /// Panics if the value is an [`Err`], with a panic message provided by the /// [`Err`]'s value. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -1017,8 +983,6 @@ impl Result { /// Panics if the value is an [`Ok`], with a panic message including the /// passed message, and the content of the [`Ok`]. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// # Examples /// @@ -1045,8 +1009,6 @@ impl Result { /// Panics if the value is an [`Ok`], with a custom panic message provided /// by the [`Ok`]'s value. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err /// /// /// # Examples @@ -1095,10 +1057,8 @@ impl Result { /// assert_eq!(0, bad_year); /// ``` /// - /// [`parse`]: ../../std/primitive.str.html#method.parse - /// [`FromStr`]: ../../std/str/trait.FromStr.html - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err + /// [`parse`]: str::parse + /// [`FromStr`]: FromStr #[inline] #[stable(feature = "result_unwrap_or_default", since = "1.16.0")] pub fn unwrap_or_default(self) -> T { @@ -1119,9 +1079,7 @@ impl> Result { /// to compile if the error type of the `Result` is later changed /// to an error that can actually occur. /// - /// [`Ok`]: enum.Result.html#variant.Ok - /// [`Err`]: enum.Result.html#variant.Err - /// [`unwrap`]: enum.Result.html#method.unwrap + /// [`unwrap`]: Result::unwrap /// /// # Examples /// @@ -1343,10 +1301,6 @@ impl<'a, T, E> IntoIterator for &'a mut Result { /// The iterator yields one value if the result is [`Ok`], otherwise none. /// /// Created by [`Result::iter`]. -/// -/// [`Ok`]: enum.Result.html#variant.Ok -/// [`Result`]: enum.Result.html -/// [`Result::iter`]: enum.Result.html#method.iter #[derive(Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct Iter<'a, T: 'a> { @@ -1396,10 +1350,6 @@ impl Clone for Iter<'_, T> { /// An iterator over a mutable reference to the [`Ok`] variant of a [`Result`]. /// /// Created by [`Result::iter_mut`]. -/// -/// [`Ok`]: enum.Result.html#variant.Ok -/// [`Result`]: enum.Result.html -/// [`Result::iter_mut`]: enum.Result.html#method.iter_mut #[derive(Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct IterMut<'a, T: 'a> { @@ -1445,10 +1395,7 @@ unsafe impl TrustedLen for IterMut<'_, A> {} /// This struct is created by the [`into_iter`] method on /// [`Result`] (provided by the [`IntoIterator`] trait). /// -/// [`Ok`]: enum.Result.html#variant.Ok -/// [`Result`]: enum.Result.html -/// [`into_iter`]: ../iter/trait.IntoIterator.html#tymethod.into_iter -/// [`IntoIterator`]: ../iter/trait.IntoIterator.html +/// [`into_iter`]: IntoIterator::into_iter #[derive(Clone, Debug)] #[stable(feature = "rust1", since = "1.0.0")] pub struct IntoIter { From 22c02bfdb1f5c0bd6c6500295767c0a156596465 Mon Sep 17 00:00:00 2001 From: Camelid <37223377+camelid@users.noreply.github.com> Date: Wed, 19 Aug 2020 18:17:55 -0700 Subject: [PATCH 5/7] Revert to old link since intra-doc link is broken Can't link from `core` to `std` yet. --- library/core/src/result.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 95da7ff1df9a8..07d3604a05be8 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -1058,7 +1058,7 @@ impl Result { /// ``` /// /// [`parse`]: str::parse - /// [`FromStr`]: FromStr + /// [`FromStr`]: ../../std/str/trait.FromStr.html #[inline] #[stable(feature = "result_unwrap_or_default", since = "1.16.0")] pub fn unwrap_or_default(self) -> T { From 5a307cf4bbf3cb6065b43472ab99c1dd4fdc72e5 Mon Sep 17 00:00:00 2001 From: Camelid <37223377+camelid@users.noreply.github.com> Date: Thu, 20 Aug 2020 12:39:12 -0700 Subject: [PATCH 6/7] Fix intra-doc links One of the original links was linking to the wrong thing as well. Co-authored-by: Joshua Nelson --- library/core/src/result.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/result.rs b/library/core/src/result.rs index 07d3604a05be8..ade5472717dde 100644 --- a/library/core/src/result.rs +++ b/library/core/src/result.rs @@ -220,7 +220,7 @@ //! [`Write`]: ../../std/io/trait.Write.html //! [`write_all`]: ../../std/io/trait.Write.html#method.write_all //! [`io::Result`]: ../../std/io/type.Result.html -//! [`?`]: ../../std/macro.try.html +//! [`?`]: crate::ops::Try //! [`Ok(T)`]: Ok //! [`Err(E)`]: Err //! [`io::Error`]: ../../std/io/struct.Error.html @@ -1058,7 +1058,7 @@ impl Result { /// ``` /// /// [`parse`]: str::parse - /// [`FromStr`]: ../../std/str/trait.FromStr.html + /// [`FromStr`]: crate::str::FromStr #[inline] #[stable(feature = "result_unwrap_or_default", since = "1.16.0")] pub fn unwrap_or_default(self) -> T { From fb3f9271311cedcc75ec45c385305e3e66f8959e Mon Sep 17 00:00:00 2001 From: Alexis Bourget Date: Thu, 20 Aug 2020 22:03:00 +0200 Subject: [PATCH 7/7] Move to intra doc links for std::thread documentation --- library/std/src/thread/local.rs | 8 +-- library/std/src/thread/mod.rs | 119 ++++++++++---------------------- 2 files changed, 40 insertions(+), 87 deletions(-) diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs index 66508f06b2884..a4562967f0bcb 100644 --- a/library/std/src/thread/local.rs +++ b/library/std/src/thread/local.rs @@ -71,9 +71,7 @@ use crate::fmt; /// not guard typically have a synthetic limit after which point no more /// destructors are run. /// -/// [`with`]: ../../std/thread/struct.LocalKey.html#method.with -/// [`thread_local!`]: ../../std/macro.thread_local.html -/// [`Drop`]: ../../std/ops/trait.Drop.html +/// [`with`]: LocalKey::with #[stable(feature = "rust1", since = "1.0.0")] pub struct LocalKey { // This outer `LocalKey` type is what's going to be stored in statics, @@ -118,10 +116,10 @@ impl fmt::Debug for LocalKey { /// # fn main() {} /// ``` /// -/// See [LocalKey documentation][`std::thread::LocalKey`] for more +/// See [`LocalKey` documentation][`std::thread::LocalKey`] for more /// information. /// -/// [`std::thread::LocalKey`]: ../std/thread/struct.LocalKey.html +/// [`std::thread::LocalKey`]: crate::thread::LocalKey #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[allow_internal_unstable(thread_local_internals)] diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 202867258f1e4..0b9849517c252 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -129,30 +129,19 @@ //! //! Note that the stack size of the main thread is *not* determined by Rust. //! -//! [channels]: ../../std/sync/mpsc/index.html -//! [`Arc`]: ../../std/sync/struct.Arc.html -//! [`spawn`]: ../../std/thread/fn.spawn.html -//! [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html -//! [`JoinHandle::thread`]: ../../std/thread/struct.JoinHandle.html#method.thread -//! [`join`]: ../../std/thread/struct.JoinHandle.html#method.join -//! [`Result`]: ../../std/result/enum.Result.html -//! [`Ok`]: ../../std/result/enum.Result.html#variant.Ok -//! [`Err`]: ../../std/result/enum.Result.html#variant.Err -//! [`panic!`]: ../../std/macro.panic.html -//! [`Builder`]: ../../std/thread/struct.Builder.html -//! [`Builder::stack_size`]: ../../std/thread/struct.Builder.html#method.stack_size -//! [`Builder::name`]: ../../std/thread/struct.Builder.html#method.name -//! [`thread::current`]: ../../std/thread/fn.current.html -//! [`thread::Result`]: ../../std/thread/type.Result.html -//! [`Thread`]: ../../std/thread/struct.Thread.html -//! [`park`]: ../../std/thread/fn.park.html -//! [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark -//! [`Thread::name`]: ../../std/thread/struct.Thread.html#method.name -//! [`thread::park_timeout`]: ../../std/thread/fn.park_timeout.html -//! [`Cell`]: ../cell/struct.Cell.html -//! [`RefCell`]: ../cell/struct.RefCell.html -//! [`thread_local!`]: ../macro.thread_local.html -//! [`with`]: struct.LocalKey.html#method.with +//! [channels]: crate::sync::mpsc +//! [`join`]: JoinHandle::join +//! [`Result`]: crate::result::Result +//! [`Ok`]: crate::result::Result::Ok +//! [`Err`]: crate::result::Result::Err +//! [`thread::current`]: current +//! [`thread::Result`]: Result +//! [`unpark`]: Thread::unpark +//! [`Thread::name`]: Thread::name +//! [`thread::park_timeout`]: park_timeout +//! [`Cell`]: crate::cell::Cell +//! [`RefCell`]: crate::cell::RefCell +//! [`with`]: LocalKey::with #![stable(feature = "rust1", since = "1.0.0")] @@ -245,12 +234,12 @@ pub use self::local::statik::Key as __StaticLocalKeyInner; /// handler.join().unwrap(); /// ``` /// -/// [`thread::spawn`]: ../../std/thread/fn.spawn.html -/// [`stack_size`]: ../../std/thread/struct.Builder.html#method.stack_size -/// [`name`]: ../../std/thread/struct.Builder.html#method.name -/// [`spawn`]: ../../std/thread/struct.Builder.html#method.spawn -/// [`io::Result`]: ../../std/io/type.Result.html -/// [`unwrap`]: ../../std/result/enum.Result.html#method.unwrap +/// [`stack_size`]: Builder::stack_size +/// [`name`]: Builder::name +/// [`spawn`]: Builder::spawn +/// [`thread::spawn`]: spawn +/// [`io::Result`]: crate::io::Result +/// [`unwrap`]: crate::result::Result::unwrap /// [naming-threads]: ./index.html#naming-threads /// [stack-size]: ./index.html#stack-size #[stable(feature = "rust1", since = "1.0.0")] @@ -355,9 +344,7 @@ impl Builder { /// [`io::Result`] to capture any failure to create the thread at /// the OS level. /// - /// [`spawn`]: ../../std/thread/fn.spawn.html - /// [`io::Result`]: ../../std/io/type.Result.html - /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html + /// [`io::Result`]: crate::io::Result /// /// # Panics /// @@ -443,11 +430,7 @@ impl Builder { /// handler.join().unwrap(); /// ``` /// - /// [`spawn`]: ../../std/thread/fn.spawn.html - /// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn - /// [`io::Result`]: ../../std/io/type.Result.html - /// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html - /// [`JoinHandle::join`]: ../../std/thread/struct.JoinHandle.html#method.join + /// [`io::Result`]: crate::io::Result #[unstable(feature = "thread_spawn_unchecked", issue = "55132")] pub unsafe fn spawn_unchecked<'a, F, T>(self, f: F) -> io::Result> where @@ -513,7 +496,7 @@ impl Builder { /// the main thread finishes). Additionally, the join handle provides a [`join`] /// method that can be used to join the child thread. If the child thread /// panics, [`join`] will return an [`Err`] containing the argument given to -/// [`panic`]. +/// [`panic!`]. /// /// This will create a thread using default parameters of [`Builder`], if you /// want to specify the stack size or the name of the thread, use this API @@ -600,15 +583,9 @@ impl Builder { /// println!("{}", result); /// ``` /// -/// [`channels`]: ../../std/sync/mpsc/index.html -/// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html -/// [`join`]: ../../std/thread/struct.JoinHandle.html#method.join -/// [`Err`]: ../../std/result/enum.Result.html#variant.Err -/// [`panic`]: ../../std/macro.panic.html -/// [`Builder::spawn`]: ../../std/thread/struct.Builder.html#method.spawn -/// [`Builder`]: ../../std/thread/struct.Builder.html -/// [`Send`]: ../../std/marker/trait.Send.html -/// [`Sync`]: ../../std/marker/trait.Sync.html +/// [`channels`]: crate::sync::mpsc +/// [`join`]: JoinHandle::join +/// [`Err`]: crate::result::Result::Err #[stable(feature = "rust1", since = "1.0.0")] pub fn spawn(f: F) -> JoinHandle where @@ -673,11 +650,8 @@ pub fn current() -> Thread { /// thread::yield_now(); /// ``` /// -/// [`channel`]: ../../std/sync/mpsc/index.html -/// [`spawn`]: ../../std/thread/fn.spawn.html -/// [`join`]: ../../std/thread/struct.JoinHandle.html#method.join -/// [`Mutex`]: ../../std/sync/struct.Mutex.html -/// [`Condvar`]: ../../std/sync/struct.Condvar.html +/// [`channel`]: crate::sync::mpsc +/// [`join`]: JoinHandle::join #[stable(feature = "rust1", since = "1.0.0")] pub fn yield_now() { imp::Thread::yield_now() @@ -723,8 +697,6 @@ pub fn yield_now() { /// panic!() /// } /// ``` -/// -/// [Mutex]: ../../std/sync/struct.Mutex.html #[inline] #[stable(feature = "rust1", since = "1.0.0")] pub fn panicking() -> bool { @@ -881,10 +853,8 @@ const NOTIFIED: usize = 2; /// parked_thread.join().unwrap(); /// ``` /// -/// [`Thread`]: ../../std/thread/struct.Thread.html -/// [`park`]: ../../std/thread/fn.park.html -/// [`unpark`]: ../../std/thread/struct.Thread.html#method.unpark -/// [`thread::park_timeout`]: ../../std/thread/fn.park_timeout.html +/// [`unpark`]: Thread::unpark +/// [`thread::park_timeout`]: park_timeout // // The implementation currently uses the trivial strategy of a Mutex+Condvar // with wakeup flag, which does not actually allow spurious wakeups. In the @@ -939,9 +909,6 @@ pub fn park() { /// amount of time waited to be precisely `ms` long. /// /// See the [park documentation][`park`] for more detail. -/// -/// [`park_timeout`]: fn.park_timeout.html -/// [`park`]: ../../std/thread/fn.park.html #[stable(feature = "rust1", since = "1.0.0")] #[rustc_deprecated(since = "1.6.0", reason = "replaced by `std::thread::park_timeout`")] pub fn park_timeout_ms(ms: u32) { @@ -986,8 +953,6 @@ pub fn park_timeout_ms(ms: u32) { /// timeout_remaining = timeout - elapsed; /// } /// ``` -/// -/// [park]: fn.park.html #[stable(feature = "park_timeout", since = "1.4.0")] pub fn park_timeout(dur: Duration) { let thread = current(); @@ -1046,8 +1011,7 @@ pub fn park_timeout(dur: Duration) { /// assert!(thread::current().id() != other_thread_id); /// ``` /// -/// [`id`]: ../../std/thread/struct.Thread.html#method.id -/// [`Thread`]: ../../std/thread/struct.Thread.html +/// [`id`]: Thread::id #[stable(feature = "thread_id", since = "1.19.0")] #[derive(Eq, PartialEq, Clone, Copy, Hash, Debug)] pub struct ThreadId(NonZeroU64); @@ -1124,12 +1088,7 @@ struct Inner { /// should instead use a function like `spawn` to create new threads, see the /// docs of [`Builder`] and [`spawn`] for more details. /// -/// [`Builder`]: ../../std/thread/struct.Builder.html -/// [`JoinHandle::thread`]: ../../std/thread/struct.JoinHandle.html#method.thread -/// [`JoinHandle`]: ../../std/thread/struct.JoinHandle.html -/// [`thread::current`]: ../../std/thread/fn.current.html -/// [`spawn`]: ../../std/thread/fn.spawn.html - +/// [`thread::current`]: current pub struct Thread { inner: Arc, } @@ -1181,8 +1140,6 @@ impl Thread { /// /// parked_thread.join().unwrap(); /// ``` - /// - /// [park]: fn.park.html #[stable(feature = "rust1", since = "1.0.0")] pub fn unpark(&self) { // To ensure the unparked thread will observe any writes we made @@ -1326,7 +1283,7 @@ impl fmt::Debug for Thread { /// } /// ``` /// -/// [`Result`]: ../../std/result/enum.Result.html +/// [`Result`]: crate::result::Result #[stable(feature = "rust1", since = "1.0.0")] pub type Result = crate::result::Result>; @@ -1421,9 +1378,8 @@ impl JoinInner { /// thread::sleep(Duration::from_millis(1000)); /// ``` /// -/// [`Clone`]: ../../std/clone/trait.Clone.html -/// [`thread::spawn`]: fn.spawn.html -/// [`thread::Builder::spawn`]: struct.Builder.html#method.spawn +/// [`thread::Builder::spawn`]: Builder::spawn +/// [`thread::spawn`]: spawn #[stable(feature = "rust1", since = "1.0.0")] pub struct JoinHandle(JoinInner); @@ -1462,11 +1418,10 @@ impl JoinHandle { /// operations that happen after `join` returns. /// /// If the child thread panics, [`Err`] is returned with the parameter given - /// to [`panic`]. + /// to [`panic!`]. /// - /// [`Err`]: ../../std/result/enum.Result.html#variant.Err - /// [`panic`]: ../../std/macro.panic.html - /// [atomic memory orderings]: ../../std/sync/atomic/index.html + /// [`Err`]: crate::result::Result::Err + /// [atomic memory orderings]: crate::sync::atomic /// /// # Panics ///