From 32114ddd7808c1763fca9ec126dba3f8a0d3c09c Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 6 Sep 2020 22:37:56 +0900 Subject: [PATCH 1/3] Use intra-doc links --- crossbeam-channel/src/channel.rs | 13 +++----- crossbeam-channel/src/err.rs | 20 ++++++------ crossbeam-channel/src/lib.rs | 18 +++-------- crossbeam-channel/src/select.rs | 32 +++++-------------- crossbeam-channel/src/select_macro.rs | 6 ++-- crossbeam-deque/src/lib.rs | 16 ++++------ crossbeam-epoch/src/atomic.rs | 40 +----------------------- crossbeam-epoch/src/guard.rs | 20 ++---------- crossbeam-epoch/src/lib.rs | 8 +---- crossbeam-queue/src/array_queue.rs | 2 +- crossbeam-queue/src/lib.rs | 3 -- crossbeam-queue/src/seg_queue.rs | 2 +- crossbeam-utils/src/lib.rs | 14 ++++----- crossbeam-utils/src/sync/mod.rs | 4 --- crossbeam-utils/src/sync/sharded_lock.rs | 4 --- src/lib.rs | 22 ++++++------- 16 files changed, 58 insertions(+), 166 deletions(-) diff --git a/crossbeam-channel/src/channel.rs b/crossbeam-channel/src/channel.rs index e1de872a8..42e3db8b9 100644 --- a/crossbeam-channel/src/channel.rs +++ b/crossbeam-channel/src/channel.rs @@ -911,8 +911,7 @@ impl Receiver { /// Each call to [`next`] blocks waiting for the next message and then returns it. However, if /// the channel becomes empty and disconnected, it returns [`None`] without blocking. /// - /// [`next`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next - /// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None + /// [`next`]: Iterator::next /// /// # Examples /// @@ -944,7 +943,7 @@ impl Receiver { /// Each call to [`next`] returns a message if there is one ready to be received. The iterator /// never blocks waiting for the next message. /// - /// [`next`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next + /// [`next`]: Iterator::next /// /// # Examples /// @@ -1062,8 +1061,7 @@ impl IntoIterator for Receiver { /// Each call to [`next`] blocks waiting for the next message and then returns it. However, if the /// channel becomes empty and disconnected, it returns [`None`] without blocking. /// -/// [`next`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next -/// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None +/// [`next`]: Iterator::next /// /// # Examples /// @@ -1111,7 +1109,7 @@ impl fmt::Debug for Iter<'_, T> { /// Each call to [`next`] returns a message if there is one ready to be received. The iterator /// never blocks waiting for the next message. /// -/// [`next`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next +/// [`next`]: Iterator::next /// /// # Examples /// @@ -1161,8 +1159,7 @@ impl fmt::Debug for TryIter<'_, T> { /// Each call to [`next`] blocks waiting for the next message and then returns it. However, if the /// channel becomes empty and disconnected, it returns [`None`] without blocking. /// -/// [`next`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#tymethod.next -/// [`None`]: https://doc.rust-lang.org/std/option/enum.Option.html#variant.None +/// [`next`]: Iterator::next /// /// # Examples /// diff --git a/crossbeam-channel/src/err.rs b/crossbeam-channel/src/err.rs index 8ae1d0533..578acc69a 100644 --- a/crossbeam-channel/src/err.rs +++ b/crossbeam-channel/src/err.rs @@ -7,7 +7,7 @@ use std::fmt; /// /// The error contains the message so it can be recovered. /// -/// [`send`]: struct.Sender.html#method.send +/// [`send`]: super::Sender::send #[derive(PartialEq, Eq, Clone, Copy)] pub struct SendError(pub T); @@ -15,7 +15,7 @@ pub struct SendError(pub T); /// /// The error contains the message being sent so it can be recovered. /// -/// [`try_send`]: struct.Sender.html#method.try_send +/// [`try_send`]: super::Sender::try_send #[derive(PartialEq, Eq, Clone, Copy)] pub enum TrySendError { /// The message could not be sent because the channel is full. @@ -32,7 +32,7 @@ pub enum TrySendError { /// /// The error contains the message being sent so it can be recovered. /// -/// [`send_timeout`]: struct.Sender.html#method.send_timeout +/// [`send_timeout`]: super::Sender::send_timeout #[derive(PartialEq, Eq, Clone, Copy)] pub enum SendTimeoutError { /// The message could not be sent because the channel is full and the operation timed out. @@ -49,13 +49,13 @@ pub enum SendTimeoutError { /// /// A message could not be received because the channel is empty and disconnected. /// -/// [`recv`]: struct.Receiver.html#method.recv +/// [`recv`]: super::Receiver::recv #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct RecvError; /// An error returned from the [`try_recv`] method. /// -/// [`try_recv`]: struct.Receiver.html#method.recv +/// [`try_recv`]: super::Receiver::try_recv #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum TryRecvError { /// A message could not be received because the channel is empty. @@ -70,7 +70,7 @@ pub enum TryRecvError { /// An error returned from the [`recv_timeout`] method. /// -/// [`recv_timeout`]: struct.Receiver.html#method.recv_timeout +/// [`recv_timeout`]: super::Receiver::recv_timeout #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum RecvTimeoutError { /// A message could not be received because the channel is empty and the operation timed out. @@ -87,7 +87,7 @@ pub enum RecvTimeoutError { /// /// Failed because none of the channel operations were ready. /// -/// [`try_select`]: struct.Select.html#method.try_select +/// [`try_select`]: super::Select::try_select #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct TrySelectError; @@ -95,7 +95,7 @@ pub struct TrySelectError; /// /// Failed because none of the channel operations became ready before the timeout. /// -/// [`select_timeout`]: struct.Select.html#method.select_timeout +/// [`select_timeout`]: super::Select::select_timeout #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct SelectTimeoutError; @@ -103,7 +103,7 @@ pub struct SelectTimeoutError; /// /// Failed because none of the channel operations were ready. /// -/// [`try_ready`]: struct.Select.html#method.try_ready +/// [`try_ready`]: super::Select::try_ready #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct TryReadyError; @@ -111,7 +111,7 @@ pub struct TryReadyError; /// /// Failed because none of the channel operations became ready before the timeout. /// -/// [`ready_timeout`]: struct.Select.html#method.ready_timeout +/// [`ready_timeout`]: super::Select::ready_timeout #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub struct ReadyTimeoutError; diff --git a/crossbeam-channel/src/lib.rs b/crossbeam-channel/src/lib.rs index adacbe210..361df3950 100644 --- a/crossbeam-channel/src/lib.rs +++ b/crossbeam-channel/src/lib.rs @@ -316,20 +316,10 @@ //! } //! ``` //! -//! [`std::sync::mpsc`]: https://doc.rust-lang.org/std/sync/mpsc/index.html -//! [`unbounded`]: fn.unbounded.html -//! [`bounded`]: fn.bounded.html -//! [`after`]: fn.after.html -//! [`tick`]: fn.tick.html -//! [`never`]: fn.never.html -//! [`send`]: struct.Sender.html#method.send -//! [`recv`]: struct.Receiver.html#method.recv -//! [`iter`]: struct.Receiver.html#method.iter -//! [`try_iter`]: struct.Receiver.html#method.try_iter -//! [`select!`]: macro.select.html -//! [`Select`]: struct.Select.html -//! [`Sender`]: struct.Sender.html -//! [`Receiver`]: struct.Receiver.html +//! [`send`]: Sender::send +//! [`recv`]: Receiver::recv +//! [`iter`]: Receiver::iter +//! [`try_iter`]: Receiver::try_iter #![doc(test( no_crate_inject, diff --git a/crossbeam-channel/src/select.rs b/crossbeam-channel/src/select.rs index 68bfe4183..51b27ac95 100644 --- a/crossbeam-channel/src/select.rs +++ b/crossbeam-channel/src/select.rs @@ -570,13 +570,12 @@ pub fn select_timeout<'a>( /// } /// ``` /// -/// [`select!`]: macro.select.html -/// [`try_select`]: struct.Select.html#method.try_select -/// [`select`]: struct.Select.html#method.select -/// [`select_timeout`]: struct.Select.html#method.select_timeout -/// [`try_ready`]: struct.Select.html#method.try_ready -/// [`ready`]: struct.Select.html#method.ready -/// [`ready_timeout`]: struct.Select.html#method.ready_timeout +/// [`try_select`]: Select::try_select +/// [`select`]: Select::select +/// [`select_timeout`]: Select::select_timeout +/// [`try_ready`]: Select::try_ready +/// [`ready`]: Select::ready +/// [`ready_timeout`]: Select::ready_timeout pub struct Select<'a> { /// A list of senders and receivers participating in selection. handles: Vec<(&'a dyn SelectHandle, usize, *const u8)>, @@ -719,9 +718,6 @@ impl<'a> Select<'a> { /// The selected operation must be completed with [`SelectedOperation::send`] /// or [`SelectedOperation::recv`]. /// - /// [`SelectedOperation::send`]: struct.SelectedOperation.html#method.send - /// [`SelectedOperation::recv`]: struct.SelectedOperation.html#method.recv - /// /// # Examples /// /// ``` @@ -763,9 +759,6 @@ impl<'a> Select<'a> { /// The selected operation must be completed with [`SelectedOperation::send`] /// or [`SelectedOperation::recv`]. /// - /// [`SelectedOperation::send`]: struct.SelectedOperation.html#method.send - /// [`SelectedOperation::recv`]: struct.SelectedOperation.html#method.recv - /// /// # Panics /// /// Panics if no operations have been added to `Select`. @@ -814,9 +807,6 @@ impl<'a> Select<'a> { /// The selected operation must be completed with [`SelectedOperation::send`] /// or [`SelectedOperation::recv`]. /// - /// [`SelectedOperation::send`]: struct.SelectedOperation.html#method.send - /// [`SelectedOperation::recv`]: struct.SelectedOperation.html#method.recv - /// /// # Examples /// /// ``` @@ -1027,8 +1017,8 @@ impl fmt::Debug for Select<'_> { /// Forgetting to complete the operation is an error and might lead to deadlocks. If a /// `SelectedOperation` is dropped without completion, a panic occurs. /// -/// [`send`]: struct.SelectedOperation.html#method.send -/// [`recv`]: struct.SelectedOperation.html#method.recv +/// [`send`]: SelectedOperation::send +/// [`recv`]: SelectedOperation::recv #[must_use] pub struct SelectedOperation<'a> { /// Token needed to complete the operation. @@ -1097,9 +1087,6 @@ impl SelectedOperation<'_> { /// assert_eq!(oper.index(), oper1); /// assert_eq!(oper.send(&s, 10), Err(SendError(10))); /// ``` - /// - /// [`Sender`]: struct.Sender.html - /// [`Select::send`]: struct.Select.html#method.send pub fn send(mut self, s: &Sender, msg: T) -> Result<(), SendError> { assert!( s as *const Sender as *const u8 == self.ptr, @@ -1134,9 +1121,6 @@ impl SelectedOperation<'_> { /// assert_eq!(oper.index(), oper1); /// assert_eq!(oper.recv(&r), Err(RecvError)); /// ``` - /// - /// [`Receiver`]: struct.Receiver.html - /// [`Select::recv`]: struct.Select.html#method.recv pub fn recv(mut self, r: &Receiver) -> Result { assert!( r as *const Receiver as *const u8 == self.ptr, diff --git a/crossbeam-channel/src/select_macro.rs b/crossbeam-channel/src/select_macro.rs index 68e493b29..f8b247ea4 100644 --- a/crossbeam-channel/src/select_macro.rs +++ b/crossbeam-channel/src/select_macro.rs @@ -1046,7 +1046,7 @@ macro_rules! crossbeam_channel_internal { /// The `select` macro is a convenience wrapper around [`Select`]. However, it cannot select over a /// dynamically created list of channel operations. /// -/// [`Select`]: struct.Select.html +/// [`Select`]: super::Select /// /// # Examples /// @@ -1154,8 +1154,8 @@ macro_rules! crossbeam_channel_internal { /// /// To optionally add a timeout to `select!`, see the [example] for [`never`]. /// -/// [`never`]: fn.never.html -/// [example]: fn.never.html#examples +/// [`never`]: super::never +/// [example]: super::never#examples #[macro_export] macro_rules! select { ($($tokens:tt)*) => { diff --git a/crossbeam-deque/src/lib.rs b/crossbeam-deque/src/lib.rs index 9ab647ab9..fcdb51997 100644 --- a/crossbeam-deque/src/lib.rs +++ b/crossbeam-deque/src/lib.rs @@ -75,16 +75,12 @@ //! } //! ``` //! -//! [`Worker`]: struct.Worker.html -//! [`Stealer`]: struct.Stealer.html -//! [`Injector`]: struct.Injector.html -//! [`Steal::Retry`]: enum.Steal.html#variant.Retry -//! [`new_fifo()`]: struct.Worker.html#method.new_fifo -//! [`new_lifo()`]: struct.Worker.html#method.new_lifo -//! [`stealer()`]: struct.Worker.html#method.stealer -//! [`steal()`]: struct.Stealer.html#method.steal -//! [`steal_batch()`]: struct.Stealer.html#method.steal_batch -//! [`steal_batch_and_pop()`]: struct.Stealer.html#method.steal_batch_and_pop +//! [`new_fifo()`]: Worker::new_fifo +//! [`new_lifo()`]: Worker::new_lifo +//! [`stealer()`]: Worker::stealer +//! [`steal()`]: Stealer::steal +//! [`steal_batch()`]: Stealer::steal_batch +//! [`steal_batch_and_pop()`]: Stealer::steal_batch_and_pop #![doc(test( no_crate_inject, diff --git a/crossbeam-epoch/src/atomic.rs b/crossbeam-epoch/src/atomic.rs index e44dd9f77..e637071ef 100644 --- a/crossbeam-epoch/src/atomic.rs +++ b/crossbeam-epoch/src/atomic.rs @@ -135,10 +135,6 @@ fn decompose_tag(data: usize) -> (usize, usize) { /// /// let o = Owned::<[MaybeUninit]>::init(10); // allocating [i32; 10] /// ``` -/// -/// [`Atomic`]: struct.Atomic.html -/// [`Owned`]: struct.Owned.html -/// [`Shared`]: struct.Shared.html pub trait Pointable { /// The alignment of pointer. const ALIGN: usize; @@ -160,10 +156,6 @@ pub trait Pointable { /// - The given `ptr` should have been initialized with [`Pointable::init`]. /// - `ptr` should not have yet been dropped by [`Pointable::drop`]. /// - `ptr` should not be mutably dereferenced by [`Pointable::deref_mut`] concurrently. - /// - /// [`Pointable::init`]: trait.Pointable.html#method.init - /// [`Pointable::drop`]: trait.Pointable.html#method.drop - /// [`Pointable::deref`]: trait.Pointable.html#method.deref unsafe fn deref<'a>(ptr: usize) -> &'a Self; /// Mutably dereferences the given pointer. @@ -174,11 +166,6 @@ pub trait Pointable { /// - `ptr` should not have yet been dropped by [`Pointable::drop`]. /// - `ptr` should not be dereferenced by [`Pointable::deref`] or [`Pointable::deref_mut`] /// concurrently. - /// - /// [`Pointable::init`]: trait.Pointable.html#method.init - /// [`Pointable::drop`]: trait.Pointable.html#method.drop - /// [`Pointable::deref`]: trait.Pointable.html#method.deref - /// [`Pointable::deref_mut`]: trait.Pointable.html#method.deref_mut unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Self; /// Drops the object pointed to by the given pointer. @@ -189,11 +176,6 @@ pub trait Pointable { /// - `ptr` should not have yet been dropped by [`Pointable::drop`]. /// - `ptr` should not be dereferenced by [`Pointable::deref`] or [`Pointable::deref_mut`] /// concurrently. - /// - /// [`Pointable::init`]: trait.Pointable.html#method.init - /// [`Pointable::drop`]: trait.Pointable.html#method.drop - /// [`Pointable::deref`]: trait.Pointable.html#method.deref - /// [`Pointable::deref_mut`]: trait.Pointable.html#method.deref_mut unsafe fn drop(ptr: usize); } @@ -290,9 +272,6 @@ impl Pointable for [MaybeUninit] { /// Any method that loads the pointer must be passed a reference to a [`Guard`]. /// /// Crossbeam supports dynamically sized types. See [`Pointable`] for details. -/// -/// [`Guard`]: struct.Guard.html -/// [`Pointable`]: trait.Pointable.html pub struct Atomic { data: AtomicUsize, _marker: PhantomData<*mut T>, @@ -361,8 +340,6 @@ impl Atomic { /// This method takes an [`Ordering`] argument which describes the memory ordering of this /// operation. /// - /// [`Ordering`]: https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html - /// /// # Examples /// /// ``` @@ -407,8 +384,6 @@ impl Atomic { /// This method takes an [`Ordering`] argument which describes the memory ordering of this /// operation. /// - /// [`Ordering`]: https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html - /// /// # Examples /// /// ``` @@ -429,8 +404,6 @@ impl Atomic { /// This method takes an [`Ordering`] argument which describes the memory ordering of this /// operation. /// - /// [`Ordering`]: https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html - /// /// # Examples /// /// ``` @@ -456,8 +429,6 @@ impl Atomic { /// This method takes a [`CompareAndSetOrdering`] argument which describes the memory /// ordering of this operation. /// - /// [`CompareAndSetOrdering`]: trait.CompareAndSetOrdering.html - /// /// # Examples /// /// ``` @@ -506,8 +477,7 @@ impl Atomic { /// This method takes a [`CompareAndSetOrdering`] argument which describes the memory /// ordering of this operation. /// - /// [`compare_and_set`]: struct.Atomic.html#method.compare_and_set - /// [`CompareAndSetOrdering`]: trait.CompareAndSetOrdering.html + /// [`compare_and_set`]: Atomic::compare_and_set /// /// # Examples /// @@ -572,8 +542,6 @@ impl Atomic { /// This method takes an [`Ordering`] argument which describes the memory ordering of this /// operation. /// - /// [`Ordering`]: https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html - /// /// # Examples /// /// ``` @@ -597,8 +565,6 @@ impl Atomic { /// This method takes an [`Ordering`] argument which describes the memory ordering of this /// operation. /// - /// [`Ordering`]: https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html - /// /// # Examples /// /// ``` @@ -622,8 +588,6 @@ impl Atomic { /// This method takes an [`Ordering`] argument which describes the memory ordering of this /// operation. /// - /// [`Ordering`]: https://doc.rust-lang.org/std/sync/atomic/enum.Ordering.html - /// /// # Examples /// /// ``` @@ -908,8 +872,6 @@ impl Owned { /// let guard = &epoch::pin(); /// let p = o.into_shared(guard); /// ``` - /// - /// [`Shared`]: struct.Shared.html #[allow(clippy::needless_lifetimes)] pub fn into_shared<'g>(self, _: &'g Guard) -> Shared<'g, T> { unsafe { Shared::from_usize(self.into_usize()) } diff --git a/crossbeam-epoch/src/guard.rs b/crossbeam-epoch/src/guard.rs index 5f072a550..c6a0ba377 100644 --- a/crossbeam-epoch/src/guard.rs +++ b/crossbeam-epoch/src/guard.rs @@ -66,7 +66,7 @@ use crate::internal::Local; /// assert!(!epoch::is_pinned()); /// ``` /// -/// [`pin`]: fn.pin.html +/// [`pin`]: super::pin pub struct Guard { pub(crate) local: *const Local, } @@ -87,8 +87,6 @@ impl Guard { /// /// If this method is called from an [`unprotected`] guard, the function will simply be /// executed immediately. - /// - /// [`unprotected`]: fn.unprotected.html pub fn defer(&self, f: F) where F: FnOnce() -> R, @@ -187,8 +185,6 @@ impl Guard { /// } /// } /// ``` - /// - /// [`unprotected`]: fn.unprotected.html pub unsafe fn defer_unchecked(&self, f: F) where F: FnOnce() -> R, @@ -268,8 +264,6 @@ impl Guard { /// } /// } /// ``` - /// - /// [`unprotected`]: fn.unprotected.html pub unsafe fn defer_destroy(&self, ptr: Shared<'_, T>) { self.defer_unchecked(move || ptr.into_owned()); } @@ -294,8 +288,6 @@ impl Guard { /// }); /// guard.flush(); /// ``` - /// - /// [`unprotected`]: fn.unprotected.html pub fn flush(&self) { if let Some(local) = unsafe { self.local.as_ref() } { local.flush(self); @@ -329,8 +321,6 @@ impl Guard { /// assert_eq!(unsafe { p.as_ref() }, Some(&777)); /// } /// ``` - /// - /// [`unprotected`]: fn.unprotected.html pub fn repin(&mut self) { if let Some(local) = unsafe { self.local.as_ref() } { local.repin(); @@ -367,8 +357,6 @@ impl Guard { /// assert_eq!(unsafe { p.as_ref() }, Some(&777)); /// } /// ``` - /// - /// [`unprotected`]: fn.unprotected.html pub fn repin_after(&mut self, f: F) -> R where F: FnOnce() -> R, @@ -407,8 +395,6 @@ impl Guard { /// let guard2 = epoch::pin(); /// assert!(guard1.collector() == guard2.collector()); /// ``` - /// - /// [`unprotected`]: fn.unprotected.html pub fn collector(&self) -> Option<&Collector> { unsafe { self.local.as_ref().map(|local| local.collector()) } } @@ -512,8 +498,8 @@ impl fmt::Debug for Guard { /// } /// ``` /// -/// [`Atomic`]: struct.Atomic.html -/// [`defer`]: struct.Guard.html#method.defer +/// [`Atomic`]: super::Atomic +/// [`defer`]: Guard::defer #[inline] pub unsafe fn unprotected() -> &'static Guard { // HACK(stjepang): An unprotected guard is just a `Guard` with its field `local` set to null. diff --git a/crossbeam-epoch/src/lib.rs b/crossbeam-epoch/src/lib.rs index 19fc2e08f..092d71c33 100644 --- a/crossbeam-epoch/src/lib.rs +++ b/crossbeam-epoch/src/lib.rs @@ -39,7 +39,7 @@ //! pinned participants get unpinned. Such objects can be stored into a thread-local or global //! storage, where they are kept until the right time for their destruction comes. //! -//! There is a global shared instance of garbage queue. You can [`defer`] the execution of an +//! There is a global shared instance of garbage queue. You can [`defer`](Guard::defer) the execution of an //! arbitrary function until the global epoch is advanced enough. Most notably, concurrent data //! structures may defer the deallocation of an object. //! @@ -47,12 +47,6 @@ //! //! For majority of use cases, just use the default garbage collector by invoking [`pin`]. If you //! want to create your own garbage collector, use the [`Collector`] API. -//! -//! [`Atomic`]: struct.Atomic.html -//! [`Collector`]: struct.Collector.html -//! [`Shared`]: struct.Shared.html -//! [`pin`]: fn.pin.html -//! [`defer`]: struct.Guard.html#method.defer #![doc(test( no_crate_inject, diff --git a/crossbeam-queue/src/array_queue.rs b/crossbeam-queue/src/array_queue.rs index c418469fc..2d675b124 100644 --- a/crossbeam-queue/src/array_queue.rs +++ b/crossbeam-queue/src/array_queue.rs @@ -36,7 +36,7 @@ struct Slot { /// element into a full queue will fail. Having a buffer allocated upfront makes this queue a bit /// faster than [`SegQueue`]. /// -/// [`SegQueue`]: struct.SegQueue.html +/// [`SegQueue`]: super::SegQueue /// /// # Examples /// diff --git a/crossbeam-queue/src/lib.rs b/crossbeam-queue/src/lib.rs index e0a73a731..29ab156fc 100644 --- a/crossbeam-queue/src/lib.rs +++ b/crossbeam-queue/src/lib.rs @@ -4,9 +4,6 @@ //! //! * [`ArrayQueue`], a bounded MPMC queue that allocates a fixed-capacity buffer on construction. //! * [`SegQueue`], an unbounded MPMC queue that allocates small buffers, segments, on demand. -//! -//! [`ArrayQueue`]: struct.ArrayQueue.html -//! [`SegQueue`]: struct.SegQueue.html #![doc(test( no_crate_inject, diff --git a/crossbeam-queue/src/seg_queue.rs b/crossbeam-queue/src/seg_queue.rs index 61ed48d0d..11c7f96cf 100644 --- a/crossbeam-queue/src/seg_queue.rs +++ b/crossbeam-queue/src/seg_queue.rs @@ -116,7 +116,7 @@ struct Position { /// at a time. However, since segments need to be dynamically allocated as elements get pushed, /// this queue is somewhat slower than [`ArrayQueue`]. /// -/// [`ArrayQueue`]: struct.ArrayQueue.html +/// [`ArrayQueue`]: super::ArrayQueue /// /// # Examples /// diff --git a/crossbeam-utils/src/lib.rs b/crossbeam-utils/src/lib.rs index 4e301000a..50babcb66 100644 --- a/crossbeam-utils/src/lib.rs +++ b/crossbeam-utils/src/lib.rs @@ -17,14 +17,12 @@ //! * [`CachePadded`], for padding and aligning a value to the length of a cache line. //! * [`scope`], for spawning threads that borrow local variables from the stack. //! -//! [`AtomicCell`]: atomic/struct.AtomicCell.html -//! [`AtomicConsume`]: atomic/trait.AtomicConsume.html -//! [`Parker`]: sync/struct.Parker.html -//! [`ShardedLock`]: sync/struct.ShardedLock.html -//! [`WaitGroup`]: sync/struct.WaitGroup.html -//! [`Backoff`]: struct.Backoff.html -//! [`CachePadded`]: struct.CachePadded.html -//! [`scope`]: thread/fn.scope.html +//! [`AtomicCell`]: atomic::AtomicCell +//! [`AtomicConsume`]: atomic::AtomicConsume +//! [`Parker`]: sync::Parker +//! [`ShardedLock`]: sync::ShardedLock +//! [`WaitGroup`]: sync::WaitGroup +//! [`scope`]: thread::scope #![doc(test( no_crate_inject, diff --git a/crossbeam-utils/src/sync/mod.rs b/crossbeam-utils/src/sync/mod.rs index 363496372..fd400d70e 100644 --- a/crossbeam-utils/src/sync/mod.rs +++ b/crossbeam-utils/src/sync/mod.rs @@ -3,10 +3,6 @@ //! * [`Parker`], a thread parking primitive. //! * [`ShardedLock`], a sharded reader-writer lock with fast concurrent reads. //! * [`WaitGroup`], for synchronizing the beginning or end of some computation. -//! -//! [`Parker`]: struct.Parker.html -//! [`ShardedLock`]: struct.ShardedLock.html -//! [`WaitGroup`]: struct.WaitGroup.html mod parker; mod sharded_lock; diff --git a/crossbeam-utils/src/sync/sharded_lock.rs b/crossbeam-utils/src/sync/sharded_lock.rs index e420a811b..8941c923d 100644 --- a/crossbeam-utils/src/sync/sharded_lock.rs +++ b/crossbeam-utils/src/sync/sharded_lock.rs @@ -481,8 +481,6 @@ impl From for ShardedLock { } /// A guard used to release the shared read access of a [`ShardedLock`] when dropped. -/// -/// [`ShardedLock`]: struct.ShardedLock.html pub struct ShardedLockReadGuard<'a, T: ?Sized> { lock: &'a ShardedLock, _guard: RwLockReadGuard<'a, ()>, @@ -514,8 +512,6 @@ impl fmt::Display for ShardedLockReadGuard<'_, T> { } /// A guard used to release the exclusive write access of a [`ShardedLock`] when dropped. -/// -/// [`ShardedLock`]: struct.ShardedLock.html pub struct ShardedLockWriteGuard<'a, T: ?Sized> { lock: &'a ShardedLock, _marker: PhantomData>, diff --git a/src/lib.rs b/src/lib.rs index fc5b35c6e..aa985698f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,19 +28,15 @@ //! * [`CachePadded`], for padding and aligning a value to the length of a cache line. //! * [`scope`], for spawning threads that borrow local variables from the stack. //! -//! [`AtomicCell`]: atomic/struct.AtomicCell.html -//! [`AtomicConsume`]: atomic/trait.AtomicConsume.html -//! [`deque`]: deque/index.html -//! [`ArrayQueue`]: queue/struct.ArrayQueue.html -//! [`SegQueue`]: queue/struct.SegQueue.html -//! [`channel`]: channel/index.html -//! [`Parker`]: sync/struct.Parker.html -//! [`ShardedLock`]: sync/struct.ShardedLock.html -//! [`WaitGroup`]: sync/struct.WaitGroup.html -//! [`epoch`]: epoch/index.html -//! [`Backoff`]: utils/struct.Backoff.html -//! [`CachePadded`]: utils/struct.CachePadded.html -//! [`scope`]: fn.scope.html +//! [`AtomicCell`]: atomic::AtomicCell +//! [`AtomicConsume`]: atomic::AtomicConsume +//! [`ArrayQueue`]: queue::ArrayQueue +//! [`SegQueue`]: queue::SegQueue +//! [`Parker`]: sync::Parker +//! [`ShardedLock`]: sync::ShardedLock +//! [`WaitGroup`]: sync::WaitGroup +//! [`Backoff`]: utils::Backoff +//! [`CachePadded`]: utils::CachePadded #![doc(test( no_crate_inject, From 8cbd936785aa91716105d563276bf9d098f19789 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 6 Sep 2020 22:38:00 +0900 Subject: [PATCH 2/3] Check if the document can be generated without warning --- ci/crossbeam-channel.sh | 2 ++ ci/crossbeam-deque.sh | 4 ++++ ci/crossbeam-epoch.sh | 2 ++ ci/crossbeam-queue.sh | 4 ++++ ci/crossbeam-skiplist.sh | 2 ++ ci/crossbeam-utils.sh | 2 ++ ci/crossbeam.sh | 2 ++ 7 files changed, 18 insertions(+) diff --git a/ci/crossbeam-channel.sh b/ci/crossbeam-channel.sh index 7820f6cde..abe70583a 100755 --- a/ci/crossbeam-channel.sh +++ b/ci/crossbeam-channel.sh @@ -11,4 +11,6 @@ cargo test -- --test-threads=1 if [[ "$RUST_VERSION" == "nightly"* ]]; then cd benchmarks cargo check --bins + + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features fi diff --git a/ci/crossbeam-deque.sh b/ci/crossbeam-deque.sh index 66c9b1f7e..fb53ab88c 100755 --- a/ci/crossbeam-deque.sh +++ b/ci/crossbeam-deque.sh @@ -7,3 +7,7 @@ export RUSTFLAGS="-D warnings" cargo check --bins --examples --tests cargo test + +if [[ "$RUST_VERSION" == "nightly"* ]]; then + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features +fi diff --git a/ci/crossbeam-epoch.sh b/ci/crossbeam-epoch.sh index 7c9fd8ec2..995f81c0d 100755 --- a/ci/crossbeam-epoch.sh +++ b/ci/crossbeam-epoch.sh @@ -11,6 +11,8 @@ cargo test if [[ "$RUST_VERSION" == "nightly"* ]]; then cargo test --features nightly + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features + if [[ "$OSTYPE" == "linux"* ]]; then ASAN_OPTIONS="detect_odr_violation=0 detect_leaks=0" \ RUSTFLAGS="-Z sanitizer=address" \ diff --git a/ci/crossbeam-queue.sh b/ci/crossbeam-queue.sh index d11faeccf..b15303b5b 100755 --- a/ci/crossbeam-queue.sh +++ b/ci/crossbeam-queue.sh @@ -7,3 +7,7 @@ export RUSTFLAGS="-D warnings" cargo check --bins --examples --tests cargo test + +if [[ "$RUST_VERSION" == "nightly"* ]]; then + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features +fi diff --git a/ci/crossbeam-skiplist.sh b/ci/crossbeam-skiplist.sh index dbbd2cede..3928d42e4 100755 --- a/ci/crossbeam-skiplist.sh +++ b/ci/crossbeam-skiplist.sh @@ -10,4 +10,6 @@ cargo test if [[ "$RUST_VERSION" == "nightly"* ]]; then cargo test --features nightly + + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features fi diff --git a/ci/crossbeam-utils.sh b/ci/crossbeam-utils.sh index 5228a59f3..4879687de 100755 --- a/ci/crossbeam-utils.sh +++ b/ci/crossbeam-utils.sh @@ -10,4 +10,6 @@ cargo test if [[ "$RUST_VERSION" == "nightly"* ]]; then cargo test --features nightly + + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features fi diff --git a/ci/crossbeam.sh b/ci/crossbeam.sh index 4eb1773d7..99d4483bd 100755 --- a/ci/crossbeam.sh +++ b/ci/crossbeam.sh @@ -10,4 +10,6 @@ cargo test if [[ "$RUST_VERSION" == "nightly"* ]]; then cargo test --features nightly + + RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features fi From 6877244b2859bdf4b687b1332bc14b0d418e8269 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sun, 6 Sep 2020 22:55:24 +0900 Subject: [PATCH 3/3] Use collect::>() directly in ShardedLock::new() --- crossbeam-utils/src/sync/sharded_lock.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crossbeam-utils/src/sync/sharded_lock.rs b/crossbeam-utils/src/sync/sharded_lock.rs index e420a811b..60793940b 100644 --- a/crossbeam-utils/src/sync/sharded_lock.rs +++ b/crossbeam-utils/src/sync/sharded_lock.rs @@ -106,8 +106,7 @@ impl ShardedLock { write_guard: UnsafeCell::new(None), }) }) - .collect::>() - .into_boxed_slice(), + .collect::>(), value: UnsafeCell::new(value), } }