about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorJosh White <josh@animind.space>2020-02-05 06:28:31 -0500
committerJosh White <josh@animind.space>2020-02-05 06:28:31 -0500
commit82684ad30a0929afba9463b89232730a9c6dadf4 (patch)
tree64e684da21474d3aeba9f9c34cdf8a165ee31be6 /src/librustc_error_codes/error_codes
parent002287d25f6ef9718dbabd3e23c00b5ebcfb51c1 (diff)
Added long error description & modifed error_codes.rs
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0637.md22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/librustc_error_codes/error_codes/E0637.md b/src/librustc_error_codes/error_codes/E0637.md
new file mode 100644
index 00000000000..4f139b0ec49
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0637.md
@@ -0,0 +1,22 @@
+The underscore `_` character has been used as the identifier for a lifetime. 
+
+Erroneous code example:
+```
+fn some_function<'_>(x: &'_ str, y: &'_ str) -> &'_ str {
+    //Some code
+}
+```
+
+Lifetimes are named with 'ident, where ident is the name of the 
+lifetime or loop. The `_` character, which represents the ignore pattern, 
+cannot be used because it is a reserved lifetime name. 
+To fix this, use a single lowercase letter as the 
+lifetime identifier, such as `'a`. For more information, see [The Rust Book](https://doc.rust-lang.org/stable/book/appendix-02-operators.html#non-operator-symbols).
+
+Corrected code example:
+```
+fn some_function<'a>(x: &'a str, y: &'a str) -> &'a str {
+    //Some code
+}
+```
+