docs: show Clone and Copy on () doc pages
This commit is contained in:
parent
1e6a85789e
commit
7a93567005
4 changed files with 68 additions and 2 deletions
|
@ -95,7 +95,6 @@ use crate::marker::Destruct;
|
||||||
///
|
///
|
||||||
/// * Function item types (i.e., the distinct types defined for each function)
|
/// * Function item types (i.e., the distinct types defined for each function)
|
||||||
/// * Function pointer types (e.g., `fn() -> i32`)
|
/// * Function pointer types (e.g., `fn() -> i32`)
|
||||||
/// * Tuple types, if each component also implements `Clone` (e.g., `()`, `(i32, bool)`)
|
|
||||||
/// * Closure types, if they capture no value from the environment
|
/// * Closure types, if they capture no value from the environment
|
||||||
/// or if all such captured values implement `Clone` themselves.
|
/// or if all such captured values implement `Clone` themselves.
|
||||||
/// Note that variables captured by shared reference always implement `Clone`
|
/// Note that variables captured by shared reference always implement `Clone`
|
||||||
|
|
|
@ -359,7 +359,6 @@ pub trait StructuralEq {
|
||||||
///
|
///
|
||||||
/// * Function item types (i.e., the distinct types defined for each function)
|
/// * Function item types (i.e., the distinct types defined for each function)
|
||||||
/// * Function pointer types (e.g., `fn() -> i32`)
|
/// * Function pointer types (e.g., `fn() -> i32`)
|
||||||
/// * Tuple types, if each component also implements `Copy` (e.g., `()`, `(i32, bool)`)
|
|
||||||
/// * Closure types, if they capture no value from the environment
|
/// * Closure types, if they capture no value from the environment
|
||||||
/// or if all such captured values implement `Copy` themselves.
|
/// or if all such captured values implement `Copy` themselves.
|
||||||
/// Note that variables captured by shared reference always implement `Copy`
|
/// Note that variables captured by shared reference always implement `Copy`
|
||||||
|
|
|
@ -444,6 +444,22 @@ mod prim_unit {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl () {}
|
impl () {}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
impl Clone for () {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
impl Copy for () {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(primitive = "pointer")]
|
#[doc(primitive = "pointer")]
|
||||||
#[doc(alias = "ptr")]
|
#[doc(alias = "ptr")]
|
||||||
#[doc(alias = "*")]
|
#[doc(alias = "*")]
|
||||||
|
@ -959,6 +975,24 @@ mod prim_tuple {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<T, U> (T, U) {}
|
impl<T, U> (T, U) {}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
/// This trait is implemented on arbitrary-length tuples.
|
||||||
|
impl<T: Clone> Clone for (T,) {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
/// This trait is implemented on arbitrary-length tuples.
|
||||||
|
impl<T: Copy> Copy for (T,) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(primitive = "f32")]
|
#[doc(primitive = "f32")]
|
||||||
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
|
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
|
||||||
///
|
///
|
||||||
|
|
|
@ -444,6 +444,22 @@ mod prim_unit {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl () {}
|
impl () {}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
impl Clone for () {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
impl Copy for () {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(primitive = "pointer")]
|
#[doc(primitive = "pointer")]
|
||||||
#[doc(alias = "ptr")]
|
#[doc(alias = "ptr")]
|
||||||
#[doc(alias = "*")]
|
#[doc(alias = "*")]
|
||||||
|
@ -959,6 +975,24 @@ mod prim_tuple {}
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
impl<T, U> (T, U) {}
|
impl<T, U> (T, U) {}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
/// This trait is implemented on arbitrary-length tuples.
|
||||||
|
impl<T: Clone> Clone for (T,) {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
loop {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fake impl that's only really used for docs.
|
||||||
|
#[cfg(doc)]
|
||||||
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
/// This trait is implemented on arbitrary-length tuples.
|
||||||
|
impl<T: Copy> Copy for (T,) {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
|
||||||
#[doc(primitive = "f32")]
|
#[doc(primitive = "f32")]
|
||||||
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
|
/// A 32-bit floating point type (specifically, the "binary32" type defined in IEEE 754-2008).
|
||||||
///
|
///
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue