@@ -996,7 +996,7 @@ impl<T> (T,) {}
996
996
// Fake impl that's only really used for docs.
997
997
#[ cfg( doc) ]
998
998
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
999
- #[ doc( tuple_variadic ) ]
999
+ #[ cfg_attr ( not ( bootstrap ) , doc( fake_variadic ) ) ]
1000
1000
/// This trait is implemented on arbitrary-length tuples.
1001
1001
impl < T : Clone > Clone for ( T , ) {
1002
1002
fn clone ( & self ) -> Self {
@@ -1007,7 +1007,7 @@ impl<T: Clone> Clone for (T,) {
1007
1007
// Fake impl that's only really used for docs.
1008
1008
#[ cfg( doc) ]
1009
1009
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1010
- #[ doc( tuple_variadic ) ]
1010
+ #[ cfg_attr ( not ( bootstrap ) , doc( fake_variadic ) ) ]
1011
1011
/// This trait is implemented on arbitrary-length tuples.
1012
1012
impl < T : Copy > Copy for ( T , ) {
1013
1013
// empty
@@ -1441,11 +1441,16 @@ mod prim_ref {}
1441
1441
/// Note that all of this is not portable to platforms where function pointers and data pointers
1442
1442
/// have different sizes.
1443
1443
///
1444
- /// ### Traits
1444
+ /// ### Trait implementations
1445
1445
///
1446
- /// Function pointers implement the following traits:
1446
+ /// In this documentation the shorthand `fn (T₁, T₂, …, Tₙ)` is used to represent non-variadic
1447
+ /// function pointers of varying length. Note that this is a convenience notation to avoid
1448
+ /// repetitive documentation, not valid Rust syntax.
1449
+ ///
1450
+ /// Due to a temporary restriction in Rust's type system, these traits are only implemented on
1451
+ /// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this
1452
+ /// may change:
1447
1453
///
1448
- /// * [`Clone`]
1449
1454
/// * [`PartialEq`]
1450
1455
/// * [`Eq`]
1451
1456
/// * [`PartialOrd`]
@@ -1454,15 +1459,50 @@ mod prim_ref {}
1454
1459
/// * [`Pointer`]
1455
1460
/// * [`Debug`]
1456
1461
///
1462
+ /// The following traits are implemented for function pointers with any number of arguments and
1463
+ /// any ABI. These traits have implementations that are automatically generated by the compiler,
1464
+ /// so are not limited by missing language features:
1465
+ ///
1466
+ /// * [`Clone`]
1467
+ /// * [`Copy`]
1468
+ /// * [`Send`]
1469
+ /// * [`Sync`]
1470
+ /// * [`Unpin`]
1471
+ /// * [`UnwindSafe`]
1472
+ /// * [`RefUnwindSafe`]
1473
+ ///
1457
1474
/// [`Hash`]: hash::Hash
1458
1475
/// [`Pointer`]: fmt::Pointer
1476
+ /// [`UnwindSafe`]: panic::UnwindSafe
1477
+ /// [`RefUnwindSafe`]: panic::RefUnwindSafe
1459
1478
///
1460
- /// Due to a temporary restriction in Rust's type system, these traits are only implemented on
1461
- /// functions that take 12 arguments or less, with the `"Rust"` and `"C"` ABIs. In the future, this
1462
- /// may change.
1463
- ///
1464
- /// In addition, function pointers of *any* signature, ABI, or safety are [`Copy`], and all *safe*
1465
- /// function pointers implement [`Fn`], [`FnMut`], and [`FnOnce`]. This works because these traits
1466
- /// are specially known to the compiler.
1479
+ /// In addition, all *safe* function pointers implement [`Fn`], [`FnMut`], and [`FnOnce`], because
1480
+ /// these traits are specially known to the compiler.
1467
1481
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1468
1482
mod prim_fn { }
1483
+
1484
+ // Required to make auto trait impls render.
1485
+ // See src/librustdoc/passes/collect_trait_impls.rs:collect_trait_impls
1486
+ #[ doc( hidden) ]
1487
+ #[ cfg( not( bootstrap) ) ]
1488
+ impl < Ret , T > fn ( T ) -> Ret { }
1489
+
1490
+ // Fake impl that's only really used for docs.
1491
+ #[ cfg( doc) ]
1492
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1493
+ #[ cfg_attr( not( bootstrap) , doc( fake_variadic) ) ]
1494
+ /// This trait is implemented on function pointers with any number of arguments.
1495
+ impl < Ret , T > Clone for fn ( T ) -> Ret {
1496
+ fn clone ( & self ) -> Self {
1497
+ loop { }
1498
+ }
1499
+ }
1500
+
1501
+ // Fake impl that's only really used for docs.
1502
+ #[ cfg( doc) ]
1503
+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1504
+ #[ cfg_attr( not( bootstrap) , doc( fake_variadic) ) ]
1505
+ /// This trait is implemented on function pointers with any number of arguments.
1506
+ impl < Ret , T > Copy for fn ( T ) -> Ret {
1507
+ // empty
1508
+ }
0 commit comments