From 3024efff59368d6271dab1a8ac78434175647e9b Mon Sep 17 00:00:00 2001 From: bstrie <865233+bstrie@users.noreply.github.com> Date: Sat, 5 Jun 2021 17:20:51 -0400 Subject: [PATCH] Update Copy/Clone documentation WRT arrays --- compiler/rustc_error_codes/src/error_codes/E0206.md | 9 +++------ library/core/src/clone.rs | 1 - library/core/src/marker.rs | 1 - 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_error_codes/src/error_codes/E0206.md b/compiler/rustc_error_codes/src/error_codes/E0206.md index da53b671ad0..4405a2149ce 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0206.md +++ b/compiler/rustc_error_codes/src/error_codes/E0206.md @@ -4,15 +4,12 @@ enum. Erroneous code example: ```compile_fail,E0206 -type Foo = [u8; 256]; -impl Copy for Foo { } // error! - #[derive(Copy, Clone)] struct Bar; impl Copy for &'static mut Bar { } // error! ``` -You can only implement `Copy` for a struct or an enum. Both of the previous -examples will fail, because neither `[u8; 256]` nor `&'static mut Bar` -(mutable reference to `Bar`) is a struct or enum. +You can only implement `Copy` for a struct or an enum. +The previous example will fail because `&'static mut Bar` +is not a struct or enum. diff --git a/library/core/src/clone.rs b/library/core/src/clone.rs index 281ff3badfb..6f9579043c3 100644 --- a/library/core/src/clone.rs +++ b/library/core/src/clone.rs @@ -93,7 +93,6 @@ /// /// * Function item types (i.e., the distinct types defined for each function) /// * 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)`) /// * Closure types, if they capture no value from the environment /// or if all such captured values implement `Clone` themselves. diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index 37446bafacb..71eea43aa54 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -359,7 +359,6 @@ pub trait StructuralEq { /// /// * Function item types (i.e., the distinct types defined for each function) /// * 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)`) /// * Closure types, if they capture no value from the environment /// or if all such captured values implement `Copy` themselves.