about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-12-21 15:29:45 +0100
committerGitHub <noreply@github.com>2019-12-21 15:29:45 +0100
commita01f956f981d8ab41093d01460d40c17e2b996cc (patch)
tree28928dd1f547667fc8d4301fab61b4da4f7ddfb4 /src/librustc_error_codes/error_codes
parent6e3b1d63b6445cb55d75b1c360e99752e7c1fb94 (diff)
parentdce0f06f953d4f0f46cc7ca108c55f326febc790 (diff)
downloadrust-a01f956f981d8ab41093d01460d40c17e2b996cc.tar.gz
rust-a01f956f981d8ab41093d01460d40c17e2b996cc.zip
Rollup merge of #67422 - GuillaumeGomez:cleanup-err-codes, r=Dylan-DPC
Cleanup err codes

r? @Dylan-DPC
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0120.md10
-rw-r--r--src/librustc_error_codes/error_codes/E0121.md24
2 files changed, 25 insertions, 9 deletions
diff --git a/src/librustc_error_codes/error_codes/E0120.md b/src/librustc_error_codes/error_codes/E0120.md
index 99c2a493a46..dc7258d8731 100644
--- a/src/librustc_error_codes/error_codes/E0120.md
+++ b/src/librustc_error_codes/error_codes/E0120.md
@@ -1,5 +1,7 @@
-An attempt was made to implement Drop on a trait, which is not allowed: only
-structs and enums can implement Drop. An example causing this error:
+Drop was implemented on a trait, which is not allowed: only structs and
+enums can implement Drop.
+
+Erroneous code example:
 
 ```compile_fail,E0120
 trait MyTrait {}
@@ -10,7 +12,7 @@ impl Drop for MyTrait {
 ```
 
 A workaround for this problem is to wrap the trait up in a struct, and implement
-Drop on that. An example is shown below:
+Drop on that:
 
 ```
 trait MyTrait {}
@@ -22,7 +24,7 @@ impl <T: MyTrait> Drop for MyWrapper<T> {
 
 ```
 
-Alternatively, wrapping trait objects requires something like the following:
+Alternatively, wrapping trait objects requires something:
 
 ```
 trait MyTrait {}
diff --git a/src/librustc_error_codes/error_codes/E0121.md b/src/librustc_error_codes/error_codes/E0121.md
index 069d0fc48fb..06fe396d50d 100644
--- a/src/librustc_error_codes/error_codes/E0121.md
+++ b/src/librustc_error_codes/error_codes/E0121.md
@@ -1,10 +1,24 @@
-In order to be consistent with Rust's lack of global type inference,
-type and const placeholders are disallowed by design in item signatures.
+The type placeholder `_` was used within a type on an item's signature.
 
-Examples of this error include:
+Erroneous code example:
 
 ```compile_fail,E0121
-fn foo() -> _ { 5 } // error, explicitly write out the return type instead
+fn foo() -> _ { 5 } // error
 
-static BAR: _ = "test"; // error, explicitly write out the type instead
+static BAR: _ = "test"; // error
+```
+
+In those cases, you need to provide the type explicitly:
+
+```
+fn foo() -> i32 { 5 } // ok!
+
+static BAR: &str = "test"; // ok!
+```
+
+The type placeholder `_` can be used outside item's signature as follows:
+
+```
+let x = "a4a".split('4')
+    .collect::<Vec<_>>(); // No need to precise the Vec's generic type.
 ```