From f6889fce029bc193cc00f4b6716db05ea7b1eefe Mon Sep 17 00:00:00 2001 From: bstrie <865233+bstrie@users.noreply.github.com> Date: Mon, 8 Nov 2021 13:32:01 -0500 Subject: [PATCH 1/3] Update list of types with magic Copy impls Numeric types, char, bool, `!`, shared references, and raw pointers all have ordinary Copy impls in std, not provided by the compiler. Also, mention closures here. --- src/special-types-and-traits.md | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/special-types-and-traits.md b/src/special-types-and-traits.md index 6d054aae2..075b49216 100644 --- a/src/special-types-and-traits.md +++ b/src/special-types-and-traits.md @@ -67,13 +67,11 @@ For unions, this means all variants have to be `Copy`. `Copy` is implemented by the compiler for -* [Numeric types] -* `char`, `bool`, and [`!`] * [Tuples] of `Copy` types * [Arrays] of `Copy` types -* [Shared references] -* [Raw pointers] -* [Function pointers] and [function item types] +* [Function pointers] +* [Function items] +* [Closures] that capture no values or that only capture values of `Copy` types. ## `Clone` @@ -168,21 +166,18 @@ These implicit `Sized` bounds may be relaxed by using the special `?Sized` bound [drop check]: ../nomicon/dropck.html [dynamically sized type]: dynamically-sized-types.md [Function pointers]: types/function-pointer.md -[function item types]: types/function-item.md +[Function items]: types/function-item.md [implementation items]: items/implementations.md [indexing expressions]: expressions/array-expr.md#array-and-slice-indexing-expressions [interior mutability]: interior-mutability.md -[Numeric types]: types/numeric.md [Methods]: items/associated-items.md#associated-functions-and-methods [method resolution]: expressions/method-call-expr.md [operators]: expressions/operator-expr.md [orphan rules]: items/implementations.md#trait-implementation-coherence -[Raw pointers]: types/pointer.md#raw-pointers-const-and-mut [`static` items]: items/static-items.md -[Shared references]: types/pointer.md#shared-references- [the standard library]: ../std/index.html [trait object]: types/trait-object.md [Tuples]: types/tuple.md [Type parameters]: types/parameters.md [variance]: subtyping.md#variance -[`!`]: types/never.md +[Closures]: types/closure.md From e25fcd883d11123ed4080b6edc4daed9bd9f608c Mon Sep 17 00:00:00 2001 From: bstrie <865233+bstrie@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:56:55 -0500 Subject: [PATCH 2/3] Update src/special-types-and-traits.md Co-authored-by: Yuki Okushi --- src/special-types-and-traits.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/special-types-and-traits.md b/src/special-types-and-traits.md index 075b49216..44bae78a1 100644 --- a/src/special-types-and-traits.md +++ b/src/special-types-and-traits.md @@ -71,7 +71,7 @@ For unions, this means all variants have to be `Copy`. * [Arrays] of `Copy` types * [Function pointers] * [Function items] -* [Closures] that capture no values or that only capture values of `Copy` types. +* [Closures] that capture no values or that only capture values of `Copy` types ## `Clone` From d3cf0c6645e8049e7403e3e548d51773efd8a623 Mon Sep 17 00:00:00 2001 From: bstrie <865233+bstrie@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:58:59 -0500 Subject: [PATCH 3/3] Arrays can impl Copy/Clone themselves --- src/special-types-and-traits.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/special-types-and-traits.md b/src/special-types-and-traits.md index 44bae78a1..4bb4e6599 100644 --- a/src/special-types-and-traits.md +++ b/src/special-types-and-traits.md @@ -68,7 +68,6 @@ For unions, this means all variants have to be `Copy`. `Copy` is implemented by the compiler for * [Tuples] of `Copy` types -* [Arrays] of `Copy` types * [Function pointers] * [Function items] * [Closures] that capture no values or that only capture values of `Copy` types @@ -81,7 +80,6 @@ types: * Types with a built-in `Copy` implementation (see above) * [Tuples] of `Clone` types -* [Arrays] of `Clone` types ## `Send`