Rollup merge of #68908 - jwhite927:E0637, r=Dylan-DPC
Add long error code explanation message for E0637 Reference issue [#61137](https://github.com/rust-lang/rust/issues/61137) To incorporate a long error description for E0637, I have made the necessary modification to error_codes.rs and added error_codes/E0637.md, and blessed the relevant .stderror files. ~~, however when I build rustc stage 1, I am unable to make `$ rustc --explain E0637` work even though rustc appears to be able to call up the long error explanations for other errors. I wanted to guarantee this would work before moving on the blessing the various ui tests that have been affected. @GuillaumeGomez Do you know the most likely reason(s) why this would be the case?~~ Update: `$ rustc --explain E0637` works now.
This commit is contained in:
commit
531f235134
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -36,3 +36,4 @@ LL | fn foo<'_>() {
|
|||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithType<&u32>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithType<&u32>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithRegion<'_>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithRegion<'_>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithType<&u32>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithType<&u32>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithRegion<'_>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -6,3 +6,4 @@ LL | T: WithRegion<'_>
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0637`.
|
||||
|
|
|
@ -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`.
|
||||
|
|
Loading…
Reference in New Issue