about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_error_codes/error_codes.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0637.md32
-rw-r--r--src/test/ui/const-generics/const-param-elided-lifetime.stderr1
-rw-r--r--src/test/ui/error-codes/E0637.stderr1
-rw-r--r--src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr3
-rw-r--r--src/test/ui/underscore-lifetime/in-binder.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr3
-rw-r--r--src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2015.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2018.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2015.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2018.stderr1
-rw-r--r--src/test/ui/underscore-lifetime/where-clauses.stderr1
17 files changed, 50 insertions, 3 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index c3d9ed08898..ba43b29538d 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -353,6 +353,7 @@ E0631: include_str!("./error_codes/E0631.md"),
 E0633: include_str!("./error_codes/E0633.md"),
 E0635: include_str!("./error_codes/E0635.md"),
 E0636: include_str!("./error_codes/E0636.md"),
+E0637: include_str!("./error_codes/E0637.md"),
 E0638: include_str!("./error_codes/E0638.md"),
 E0639: include_str!("./error_codes/E0639.md"),
 E0641: include_str!("./error_codes/E0641.md"),
@@ -584,7 +585,6 @@ E0746: include_str!("./error_codes/E0746.md"),
     E0632, // cannot provide explicit generic arguments when `impl Trait` is
            // used in argument position
     E0634, // type has conflicting packed representaton hints
-    E0637, // "'_" is not a valid lifetime bound
     E0640, // infer outlives requirements
 //  E0645, // trait aliases not finished
     E0657, // `impl Trait` can only capture lifetimes bound at the fn level
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..e114d3d0f94
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0637.md
@@ -0,0 +1,32 @@
+An underscore `_` character has been used as the identifier for a lifetime.
+
+Erroneous example:
+```compile_fail,E0106,E0637
+fn longest<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
+         //^^ `'_` is a reserved lifetime name
+    if str1.len() > str2.len() {
+        str1
+    } else {
+        str2
+    }
+}
+```
+`'_`, cannot be used as a lifetime identifier because it is a reserved for the
+anonymous lifetime. To fix this, use a lowercase letter such as 'a, or a series
+of lowercase letters such as `'foo`.  For more information, see [the
+book][bk-no].  For more information on using the anonymous lifetime in rust
+nightly, see [the nightly book][bk-al].
+
+Corrected example:
+```
+fn longest<'a>(str1: &'a str, str2: &'a str) -> &'a str {
+    if str1.len() > str2.len() {
+        str1
+    } else {
+        str2
+    }
+}
+```
+
+[bk-no]: https://doc.rust-lang.org/book/appendix-02-operators.html#non-operator-symbols
+[bk-al]: https://doc.rust-lang.org/nightly/edition-guide/rust-2018/ownership-and-lifetimes/the-anonymous-lifetime.html
diff --git a/src/test/ui/const-generics/const-param-elided-lifetime.stderr b/src/test/ui/const-generics/const-param-elided-lifetime.stderr
index 93133c507fe..6841d1fdf36 100644
--- a/src/test/ui/const-generics/const-param-elided-lifetime.stderr
+++ b/src/test/ui/const-generics/const-param-elided-lifetime.stderr
@@ -38,3 +38,4 @@ LL | #![feature(const_generics)]
 
 error: aborting due to 5 previous errors
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/error-codes/E0637.stderr b/src/test/ui/error-codes/E0637.stderr
index 9c3ca87ed7e..d19ebfd15a5 100644
--- a/src/test/ui/error-codes/E0637.stderr
+++ b/src/test/ui/error-codes/E0637.stderr
@@ -18,3 +18,4 @@ LL | impl<'a: '_> Bar<'a> {
 
 error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr b/src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr
index 8720288b53e..9f410c0dbbb 100644
--- a/src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr
+++ b/src/test/ui/generics/issue-65285-incorrect-explicit-lifetime-name-needed.stderr
@@ -18,4 +18,5 @@ LL | fn bar<'b, L: X<&'b Nested<i32>>>(){}
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+Some errors have detailed explanations: E0106, E0637.
+For more information about an error, try `rustc --explain E0106`.
diff --git a/src/test/ui/underscore-lifetime/in-binder.stderr b/src/test/ui/underscore-lifetime/in-binder.stderr
index 1b936dd9aec..fcd7eddb576 100644
--- a/src/test/ui/underscore-lifetime/in-binder.stderr
+++ b/src/test/ui/underscore-lifetime/in-binder.stderr
@@ -36,3 +36,4 @@ LL | fn foo<'_>() {
 
 error: aborting due to 6 previous errors
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr
index c7cda38e476..ada4551baef 100644
--- a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr
+++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr
@@ -38,4 +38,5 @@ LL | fn foo2<'a>(_: &'a u8, y: &'a u8) -> &'a u8 { y }
 
 error: aborting due to 5 previous errors
 
-For more information about this error, try `rustc --explain E0106`.
+Some errors have detailed explanations: E0106, E0637.
+For more information about an error, try `rustc --explain E0106`.
diff --git a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr
index 6fa74d4e310..4b38a26f957 100644
--- a/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr
+++ b/src/test/ui/underscore-lifetime/underscore-outlives-bounds.stderr
@@ -6,3 +6,4 @@ LL | impl<'b: '_> Foo<'b> for i32 {}
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr
index eec8e4b8468..fe726cb49c7 100644
--- a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2015.stderr
@@ -6,3 +6,4 @@ LL |     T: WithType<&u32>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr
index eec8e4b8468..fe726cb49c7 100644
--- a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-ampersand.rust2018.stderr
@@ -6,3 +6,4 @@ LL |     T: WithType<&u32>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2015.stderr b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2015.stderr
index d2c3e352045..95939fd6b7e 100644
--- a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2015.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2015.stderr
@@ -6,3 +6,4 @@ LL |     T: WithRegion<'_>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2018.stderr b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2018.stderr
index d2c3e352045..95939fd6b7e 100644
--- a/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2018.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-inherent-impl-underscore.rust2018.stderr
@@ -6,3 +6,4 @@ LL |     T: WithRegion<'_>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr b/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr
index 586b2b6aeaf..fbd14de2107 100644
--- a/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2015.stderr
@@ -6,3 +6,4 @@ LL |     T: WithType<&u32>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr b/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr
index 586b2b6aeaf..fbd14de2107 100644
--- a/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-trait-impl-region.rust2018.stderr
@@ -6,3 +6,4 @@ LL |     T: WithType<&u32>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2015.stderr b/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2015.stderr
index faabf57a7df..92caff0dcde 100644
--- a/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2015.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2015.stderr
@@ -6,3 +6,4 @@ LL |     T: WithRegion<'_>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2018.stderr b/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2018.stderr
index faabf57a7df..92caff0dcde 100644
--- a/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2018.stderr
+++ b/src/test/ui/underscore-lifetime/where-clause-trait-impl-underscore.rust2018.stderr
@@ -6,3 +6,4 @@ LL |     T: WithRegion<'_>
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0637`.
diff --git a/src/test/ui/underscore-lifetime/where-clauses.stderr b/src/test/ui/underscore-lifetime/where-clauses.stderr
index 8674a925c11..1a3ea4af7e1 100644
--- a/src/test/ui/underscore-lifetime/where-clauses.stderr
+++ b/src/test/ui/underscore-lifetime/where-clauses.stderr
@@ -12,3 +12,4 @@ LL | impl<T: '_> Foo<'static> for Vec<T> {}
 
 error: aborting due to 2 previous errors
 
+For more information about this error, try `rustc --explain E0637`.