@@ -439,6 +439,27 @@ mod prim_char {}
439
439
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
440
440
mod prim_unit { }
441
441
442
+ // Required to make auto trait impls render.
443
+ // See src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
444
+ #[ doc( hidden) ]
445
+ impl ( ) { }
446
+
447
+ // Fake impl that's only really used for docs.
448
+ #[ cfg( doc) ]
449
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
450
+ impl Clone for ( ) {
451
+ fn clone ( & self ) -> Self {
452
+ loop { }
453
+ }
454
+ }
455
+
456
+ // Fake impl that's only really used for docs.
457
+ #[ cfg( doc) ]
458
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
459
+ impl Copy for ( ) {
460
+ // empty
461
+ }
462
+
442
463
#[ doc( primitive = "pointer" ) ]
443
464
#[ doc( alias = "ptr" ) ]
444
465
#[ doc( alias = "*" ) ]
@@ -893,13 +914,18 @@ mod prim_str {}
893
914
///
894
915
/// For more about tuples, see [the book](../book/ch03-02-data-types.html#the-tuple-type).
895
916
///
917
+ // Hardcoded anchor in src/librustdoc/html/format.rs
918
+ // linked to as `#trait-implementations-1`
896
919
/// # Trait implementations
897
920
///
898
- /// If every type inside a tuple implements one of the following traits, then a
899
- /// tuple itself also implements it.
921
+ /// In this documentation the shorthand `(T₁, T₂, …, Tₙ)` is used to represent tuples of varying
922
+ /// length. When that is used, any trait bound expressed on `T` applies to each element of the
923
+ /// tuple independently. Note that this is a convenience notation to avoid repetitive
924
+ /// documentation, not valid Rust syntax.
925
+ ///
926
+ /// Due to a temporary restriction in Rust’s type system, the following traits are only
927
+ /// implemented on tuples of arity 12 or less. In the future, this may change:
900
928
///
901
- /// * [`Clone`]
902
- /// * [`Copy`]
903
929
/// * [`PartialEq`]
904
930
/// * [`Eq`]
905
931
/// * [`PartialOrd`]
@@ -911,8 +937,21 @@ mod prim_str {}
911
937
/// [`Debug`]: fmt::Debug
912
938
/// [`Hash`]: hash::Hash
913
939
///
914
- /// Due to a temporary restriction in Rust's type system, these traits are only
915
- /// implemented on tuples of arity 12 or less. In the future, this may change.
940
+ /// The following traits are implemented for tuples of any length. These traits have
941
+ /// implementations that are automatically generated by the compiler, so are not limited by
942
+ /// missing language features.
943
+ ///
944
+ /// * [`Clone`]
945
+ /// * [`Copy`]
946
+ /// * [`Send`]
947
+ /// * [`Sync`]
948
+ /// * [`Unpin`]
949
+ /// * [`UnwindSafe`]
950
+ /// * [`RefUnwindSafe`]
951
+ ///
952
+ /// [`Unpin`]: marker::Unpin
953
+ /// [`UnwindSafe`]: panic::UnwindSafe
954
+ /// [`RefUnwindSafe`]: panic::RefUnwindSafe
916
955
///
917
956
/// # Examples
918
957
///
@@ -949,6 +988,31 @@ mod prim_str {}
949
988
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
950
989
mod prim_tuple { }
951
990
991
+ // Required to make auto trait impls render.
992
+ // See src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
993
+ #[ doc( hidden) ]
994
+ impl < T > ( T , ) { }
995
+
996
+ // Fake impl that's only really used for docs.
997
+ #[ cfg( doc) ]
998
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
999
+ #[ cfg_attr( not( bootstrap) , doc( tuple_variadic) ) ]
1000
+ /// This trait is implemented on arbitrary-length tuples.
1001
+ impl < T : Clone > Clone for ( T , ) {
1002
+ fn clone ( & self ) -> Self {
1003
+ loop { }
1004
+ }
1005
+ }
1006
+
1007
+ // Fake impl that's only really used for docs.
1008
+ #[ cfg( doc) ]
1009
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1010
+ #[ cfg_attr( not( bootstrap) , doc( tuple_variadic) ) ]
1011
+ /// This trait is implemented on arbitrary-length tuples.
1012
+ impl < T : Copy > Copy for ( T , ) {
1013
+ // empty
1014
+ }
1015
+
952
1016
#[ doc( primitive = "f32" ) ]
953
1017
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
954
1018
///
0 commit comments