Skip to content

Commit

Permalink
Merge #559 #560
Browse files Browse the repository at this point in the history
559: Use intra-doc links r=stjepang a=taiki-e

Switch to use [intra-doc links](rust-lang/rfcs#1946) in all crates. Previously there was a big bug on cross crate re-exports (rust-lang/rust#65983), but it has been fixed, so we can use this in crossbeam.

This also adds checks of the docs to CI.

560: Use collect::<Box<[_]>>() directly in ShardedLock::new() r=stjepang a=taiki-e



Co-authored-by: Taiki Endo <te316e89@gmail.com>
  • Loading branch information
bors[bot] and taiki-e committed Sep 6, 2020
3 parents a1b9bf3 + 8cbd936 + 6877244 commit e068f45
Show file tree
Hide file tree
Showing 23 changed files with 77 additions and 168 deletions.
2 changes: 2 additions & 0 deletions ci/crossbeam-channel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 4 additions & 0 deletions ci/crossbeam-deque.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions ci/crossbeam-epoch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" \
Expand Down
4 changes: 4 additions & 0 deletions ci/crossbeam-queue.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions ci/crossbeam-skiplist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ cargo test

if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features
fi
2 changes: 2 additions & 0 deletions ci/crossbeam-utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ cargo test

if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features
fi
2 changes: 2 additions & 0 deletions ci/crossbeam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,6 @@ cargo test

if [[ "$RUST_VERSION" == "nightly"* ]]; then
cargo test --features nightly

RUSTDOCFLAGS=-Dwarnings cargo doc --no-deps --all-features
fi
13 changes: 5 additions & 8 deletions crossbeam-channel/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -911,8 +911,7 @@ impl<T> Receiver<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
///
Expand Down Expand Up @@ -944,7 +943,7 @@ impl<T> Receiver<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
///
Expand Down Expand Up @@ -1062,8 +1061,7 @@ impl<T> IntoIterator for Receiver<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
///
Expand Down Expand Up @@ -1111,7 +1109,7 @@ impl<T> 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
///
Expand Down Expand Up @@ -1161,8 +1159,7 @@ impl<T> 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
///
Expand Down
20 changes: 10 additions & 10 deletions crossbeam-channel/src/err.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ 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<T>(pub T);

/// An error returned from the [`try_send`] method.
///
/// 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<T> {
/// The message could not be sent because the channel is full.
Expand All @@ -32,7 +32,7 @@ pub enum TrySendError<T> {
///
/// 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<T> {
/// The message could not be sent because the channel is full and the operation timed out.
Expand All @@ -49,13 +49,13 @@ pub enum SendTimeoutError<T> {
///
/// 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.
Expand All @@ -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.
Expand All @@ -87,31 +87,31 @@ 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;

/// An error returned from the [`select_timeout`] method.
///
/// 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;

/// An error returned from the [`try_ready`] method.
///
/// 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;

/// An error returned from the [`ready_timeout`] method.
///
/// 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;

Expand Down
18 changes: 4 additions & 14 deletions crossbeam-channel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 8 additions & 24 deletions crossbeam-channel/src/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)>,
Expand Down Expand Up @@ -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
///
/// ```
Expand Down Expand Up @@ -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`.
Expand Down Expand Up @@ -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
///
/// ```
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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<T>(mut self, s: &Sender<T>, msg: T) -> Result<(), SendError<T>> {
assert!(
s as *const Sender<T> as *const u8 == self.ptr,
Expand Down Expand Up @@ -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<T>(mut self, r: &Receiver<T>) -> Result<T, RecvError> {
assert!(
r as *const Receiver<T> as *const u8 == self.ptr,
Expand Down
6 changes: 3 additions & 3 deletions crossbeam-channel/src/select_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down Expand Up @@ -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)*) => {
Expand Down
16 changes: 6 additions & 10 deletions crossbeam-deque/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit e068f45

Please sign in to comment.