about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-03-01 17:23:36 +0100
committerGitHub <noreply@github.com>2020-03-01 17:23:36 +0100
commitd3a5a5d20bb128dd08ac37717f6415baf80d5039 (patch)
treed1d11d9401394a1739e96bbd54bca5aec78fea25 /src
parent22a03913f4ebd9d190c2037411301783f9178946 (diff)
parentdd142b1dc43f0e9a9b860003816b1a91b4e1a52d (diff)
downloadrust-d3a5a5d20bb128dd08ac37717f6415baf80d5039.tar.gz
rust-d3a5a5d20bb128dd08ac37717f6415baf80d5039.zip
Rollup merge of #69607 - GuillaumeGomez:cleanup-e0376, r=Dylan-DPC
Clean up E0376 explanation

r? @Dylan-DPC
Diffstat (limited to 'src')
-rw-r--r--src/librustc_error_codes/error_codes/E0376.md21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/librustc_error_codes/error_codes/E0376.md b/src/librustc_error_codes/error_codes/E0376.md
index b028aab4583..50de15bd30f 100644
--- a/src/librustc_error_codes/error_codes/E0376.md
+++ b/src/librustc_error_codes/error_codes/E0376.md
@@ -1,14 +1,6 @@
-The type you are trying to impl `CoerceUnsized` for is not a struct.
-`CoerceUnsized` can only be implemented for a struct. Unsized types are
-already able to be coerced without an implementation of `CoerceUnsized`
-whereas a struct containing an unsized type needs to know the unsized type
-field it's containing is able to be coerced. An [unsized type][1]
-is any type that the compiler doesn't know the length or alignment of at
-compile time. Any struct containing an unsized type is also unsized.
-
-[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
+`CoerceUnsized` was implemented on something that isn't a struct.
 
-Example of erroneous code:
+Erroneous code example:
 
 ```compile_fail,E0376
 #![feature(coerce_unsized)]
@@ -22,6 +14,15 @@ struct Foo<T: ?Sized> {
 impl<T, U> CoerceUnsized<U> for Foo<T> {}
 ```
 
+`CoerceUnsized` can only be implemented for a struct. Unsized types are
+already able to be coerced without an implementation of `CoerceUnsized`
+whereas a struct containing an unsized type needs to know the unsized type
+field it's containing is able to be coerced. An [unsized type][1]
+is any type that the compiler doesn't know the length or alignment of at
+compile time. Any struct containing an unsized type is also unsized.
+
+[1]: https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait
+
 The `CoerceUnsized` trait takes a struct type. Make sure the type you are
 providing to `CoerceUnsized` is a struct with only the last field containing an
 unsized type.