about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-01-07 13:46:12 +0900
committerGitHub <noreply@github.com>2020-01-07 13:46:12 +0900
commit1e7a6a8b5c6783fa25cff6b785b816f5306af880 (patch)
treeba50226c604287f617fd0ee83340533078ddd9a2
parent2c25ad5d28aaf105156ebbc111f42411f0447467 (diff)
parent99fda5c1cec9ab67c3da197b5679408d2e51d093 (diff)
downloadrust-1e7a6a8b5c6783fa25cff6b785b816f5306af880.tar.gz
rust-1e7a6a8b5c6783fa25cff6b785b816f5306af880.zip
Rollup merge of #67934 - GuillaumeGomez:clean-up-e0178, r=Dylan-DPC
Clean up E0178 explanation

r? @Dylan-DPC
-rw-r--r--src/librustc_error_codes/error_codes/E0178.md25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/librustc_error_codes/error_codes/E0178.md b/src/librustc_error_codes/error_codes/E0178.md
index 07980ad83f1..0c6f918632f 100644
--- a/src/librustc_error_codes/error_codes/E0178.md
+++ b/src/librustc_error_codes/error_codes/E0178.md
@@ -1,16 +1,27 @@
-In types, the `+` type operator has low precedence, so it is often necessary
-to use parentheses.
+The `+` type operator was used in an ambiguous context.
 
-For example:
+Erroneous code example:
 
 ```compile_fail,E0178
 trait Foo {}
 
 struct Bar<'a> {
-    w: &'a Foo + Copy,   // error, use &'a (Foo + Copy)
-    x: &'a Foo + 'a,     // error, use &'a (Foo + 'a)
-    y: &'a mut Foo + 'a, // error, use &'a mut (Foo + 'a)
-    z: fn() -> Foo + 'a, // error, use fn() -> (Foo + 'a)
+    x: &'a Foo + 'a,     // error!
+    y: &'a mut Foo + 'a, // error!
+    z: fn() -> Foo + 'a, // error!
+}
+```
+
+In types, the `+` type operator has low precedence, so it is often necessary
+to use parentheses:
+
+```
+trait Foo {}
+
+struct Bar<'a> {
+    x: &'a (Foo + 'a),     // ok!
+    y: &'a mut (Foo + 'a), // ok!
+    z: fn() -> (Foo + 'a), // ok!
 }
 ```