]> git.lizzy.rs Git - rust.git/blobdiff - library/std/src/primitive_docs.rs
Auto merge of #96820 - r-raymond:master, r=cuviper
[rust.git] / library / std / src / primitive_docs.rs
index 6fa9e795db81bbf3e12eb29c4cf289c2641b795b..00793f7f9204dafd7e85e6f350ecc9a528f48d90 100644 (file)
@@ -440,7 +440,7 @@ mod prim_char {}
 mod prim_unit {}
 
 // Required to make auto trait impls render.
-// See /src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
+// See src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
 #[doc(hidden)]
 impl () {}
 
@@ -914,13 +914,44 @@ mod prim_str {}
 ///
 /// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type).
 ///
+// Hardcoded anchor in src/librustdoc/html/format.rs
+// linked to as `#trait-implementations-1`
 /// # Trait implementations
 ///
-/// In this documentation the shorthand `(T, ...)` is used to represent all
-/// tuples up to length twelve. When that is used, any trait bounds expressed
-/// on `T` applies to each field of the tuple independently. Note that this is
-/// a convenience notation to avoid repetitive documentation, not valid
-/// Rust syntax.
+/// In this documentation the shorthand `(T₁, T₂, …, Tₙ)` is used to represent tuples of varying
+/// length. When that is used, any trait bound expressed on `T` applies to each element of the
+/// tuple independently. Note that this is a convenience notation to avoid repetitive
+/// documentation, not valid Rust syntax.
+///
+/// Due to a temporary restriction in Rust’s type system, the following traits are only
+/// implemented on tuples of arity 12 or less. In the future, this may change:
+///
+/// * [`PartialEq`]
+/// * [`Eq`]
+/// * [`PartialOrd`]
+/// * [`Ord`]
+/// * [`Debug`]
+/// * [`Default`]
+/// * [`Hash`]
+///
+/// [`Debug`]: fmt::Debug
+/// [`Hash`]: hash::Hash
+///
+/// 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
+/// missing language features.
+///
+/// * [`Clone`]
+/// * [`Copy`]
+/// * [`Send`]
+/// * [`Sync`]
+/// * [`Unpin`]
+/// * [`UnwindSafe`]
+/// * [`RefUnwindSafe`]
+///
+/// [`Unpin`]: marker::Unpin
+/// [`UnwindSafe`]: panic::UnwindSafe
+/// [`RefUnwindSafe`]: panic::RefUnwindSafe
 ///
 /// # Examples
 ///
@@ -958,14 +989,14 @@ mod prim_str {}
 mod prim_tuple {}
 
 // Required to make auto trait impls render.
-// See /src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
+// See src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
 #[doc(hidden)]
 impl<T> (T,) {}
 
 // Fake impl that's only really used for docs.
 #[cfg(doc)]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[doc(tuple_varadic)]
+#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
 /// This trait is implemented on arbitrary-length tuples.
 impl<T: Clone> Clone for (T,) {
     fn clone(&self) -> Self {
@@ -976,7 +1007,7 @@ fn clone(&self) -> Self {
 // Fake impl that's only really used for docs.
 #[cfg(doc)]
 #[stable(feature = "rust1", since = "1.0.0")]
-#[doc(tuple_varadic)]
+#[cfg_attr(not(bootstrap), doc(tuple_variadic))]
 /// This trait is implemented on arbitrary-length tuples.
 impl<T: Copy> Copy for (T,) {
     // empty