Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions library/core/src/primitive_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1078,11 +1078,13 @@ mod prim_str {}
/// * [`Debug`]
/// * [`Default`]
/// * [`Hash`]
/// * [`Random`]
/// * [`From<[T; N]>`][from]
///
/// [from]: convert::From
/// [`Debug`]: fmt::Debug
/// [`Hash`]: hash::Hash
/// [`Random`]: random::Random
///
/// The following traits are implemented for tuples of any length. These traits have
/// implementations that are automatically generated by the compiler, so are not limited by
Expand Down
11 changes: 11 additions & 0 deletions library/core/src/tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use crate::cmp::Ordering::{self, *};
use crate::marker::{ConstParamTy_, StructuralPartialEq, UnsizedConstParamTy};
use crate::ops::ControlFlow::{self, Break, Continue};
use crate::random::{Random, RandomSource};

// Recursive macro for implementing n-ary tuple functions and operations
//
Expand Down Expand Up @@ -139,6 +140,16 @@ macro_rules! tuple_impls {
}
}

maybe_tuple_doc! {
$($T)+ @
#[unstable(feature = "random", issue = "130703")]
impl<$($T: Random),+> Random for ($($T,)+) {
fn random(source: &mut (impl RandomSource + ?Sized)) -> Self {
($({ let x: $T = Random::random(source); x},)+)
}
}
}

maybe_tuple_doc! {
$($T)+ @
#[stable(feature = "array_tuple_conv", since = "1.71.0")]
Expand Down
Loading