Update Copy/Clone documentation WRT arrays
This commit is contained in:
parent
ce1143e94d
commit
3024efff59
@ -4,15 +4,12 @@ enum.
|
|||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```compile_fail,E0206
|
```compile_fail,E0206
|
||||||
type Foo = [u8; 256];
|
|
||||||
impl Copy for Foo { } // error!
|
|
||||||
|
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
struct Bar;
|
struct Bar;
|
||||||
|
|
||||||
impl Copy for &'static mut Bar { } // error!
|
impl Copy for &'static mut Bar { } // error!
|
||||||
```
|
```
|
||||||
|
|
||||||
You can only implement `Copy` for a struct or an enum. Both of the previous
|
You can only implement `Copy` for a struct or an enum.
|
||||||
examples will fail, because neither `[u8; 256]` nor `&'static mut Bar`
|
The previous example will fail because `&'static mut Bar`
|
||||||
(mutable reference to `Bar`) is a struct or enum.
|
is not a struct or enum.
|
||||||
|
@ -93,7 +93,6 @@
|
|||||||
///
|
///
|
||||||
/// * 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`)
|
||||||
/// * Array types, for all sizes, if the item type also implements `Clone` (e.g., `[i32; 123456]`)
|
|
||||||
/// * Tuple types, if each component also implements `Clone` (e.g., `()`, `(i32, bool)`)
|
/// * 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.
|
||||||
|
@ -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`)
|
||||||
/// * Array types, for all sizes, if the item type also implements `Copy` (e.g., `[i32; 123456]`)
|
|
||||||
/// * Tuple types, if each component also implements `Copy` (e.g., `()`, `(i32, bool)`)
|
/// * 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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user