Skip to content

Commit 4a1c6ce

Browse files
committed
Added long error description & modifed error_codes.rs
1 parent 442ae7f commit 4a1c6ce

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/librustc_error_codes/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ E0631: include_str!("./error_codes/E0631.md"),
353353
E0633: include_str!("./error_codes/E0633.md"),
354354
E0635: include_str!("./error_codes/E0635.md"),
355355
E0636: include_str!("./error_codes/E0636.md"),
356+
E0637: include_str!("./error_codes/E0637.md"),
356357
E0638: include_str!("./error_codes/E0638.md"),
357358
E0639: include_str!("./error_codes/E0639.md"),
358359
E0641: include_str!("./error_codes/E0641.md"),
@@ -584,7 +585,6 @@ E0746: include_str!("./error_codes/E0746.md"),
584585
E0632, // cannot provide explicit generic arguments when `impl Trait` is
585586
// used in argument position
586587
E0634, // type has conflicting packed representaton hints
587-
E0637, // "'_" is not a valid lifetime bound
588588
E0640, // infer outlives requirements
589589
// E0645, // trait aliases not finished
590590
E0657, // `impl Trait` can only capture lifetimes bound at the fn level
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The underscore `_` character has been used as the identifier for a lifetime.
2+
3+
Erroneous code example:
4+
```
5+
fn some_function<'_>(x: &'_ str, y: &'_ str) -> &'_ str {
6+
//Some code
7+
}
8+
```
9+
10+
Lifetimes are named with 'ident, where ident is the name of the
11+
lifetime or loop. The `_` character, which represents the ignore pattern,
12+
cannot be used because it is a reserved lifetime name.
13+
To fix this, use a single lowercase letter as the
14+
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).
15+
16+
Corrected code example:
17+
```
18+
fn some_function<'a>(x: &'a str, y: &'a str) -> &'a str {
19+
//Some code
20+
}
21+
```
22+

0 commit comments

Comments
 (0)