about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-02-09 00:53:58 +0100
committerGitHub <noreply@github.com>2020-02-09 00:53:58 +0100
commit83331151004f82c729caef6cef267aea5fc2fd4f (patch)
tree2192ef1d0cedd084583ac447adb57dea65f574ff /src
parentd6087b91db85b35f93947b33c0bc0ba0b262c6f0 (diff)
parent1177d0669ac213f12aee6c998b47ca1e8904ccf0 (diff)
downloadrust-83331151004f82c729caef6cef267aea5fc2fd4f.tar.gz
rust-83331151004f82c729caef6cef267aea5fc2fd4f.zip
Rollup merge of #68958 - GuillaumeGomez:clean-up-e0277-e0282, r=Dylan-DPC
Clean up E0277 and E0282 explanations

r? @Dylan-DPC
Diffstat (limited to 'src')
-rw-r--r--src/librustc_error_codes/error_codes/E0277.md4
-rw-r--r--src/librustc_error_codes/error_codes/E0282.md18
2 files changed, 14 insertions, 8 deletions
diff --git a/src/librustc_error_codes/error_codes/E0277.md b/src/librustc_error_codes/error_codes/E0277.md
index 2034a5b988c..2e2cd5e01fb 100644
--- a/src/librustc_error_codes/error_codes/E0277.md
+++ b/src/librustc_error_codes/error_codes/E0277.md
@@ -1,5 +1,7 @@
 You tried to use a type which doesn't implement some trait in a place which
-expected that trait. Erroneous code example:
+expected that trait.
+
+Erroneous code example:
 
 ```compile_fail,E0277
 // here we declare the Foo trait with a bar method
diff --git a/src/librustc_error_codes/error_codes/E0282.md b/src/librustc_error_codes/error_codes/E0282.md
index 54a9de0025a..49d2205f92c 100644
--- a/src/librustc_error_codes/error_codes/E0282.md
+++ b/src/librustc_error_codes/error_codes/E0282.md
@@ -1,3 +1,11 @@
+The compiler could not infer a type and asked for a type annotation.
+
+Erroneous code example:
+
+```compile_fail,E0282
+let x = "hello".chars().rev().collect();
+```
+
 This error indicates that type inference did not result in one unique possible
 type, and extra information is required. In most cases this can be provided
 by adding a type annotation. Sometimes you need to specify a generic type
@@ -8,13 +16,9 @@ parameter with a `FromIterator` bound, which for a `char` iterator is
 implemented by `Vec` and `String` among others. Consider the following snippet
 that reverses the characters of a string:
 
-```compile_fail,E0282
-let x = "hello".chars().rev().collect();
-```
-
-In this case, the compiler cannot infer what the type of `x` should be:
-`Vec<char>` and `String` are both suitable candidates. To specify which type to
-use, you can use a type annotation on `x`:
+In the first code example, the compiler cannot infer what the type of `x` should
+be: `Vec<char>` and `String` are both suitable candidates. To specify which type
+to use, you can use a type annotation on `x`:
 
 ```
 let x: Vec<char> = "hello".chars().rev().collect();