File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
src/librustc_error_codes/error_codes Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ An underscore `_` character has been used as the identifier for a lifetime,
2
2
or a const generic has been borrowed without an explicit lifetime.
3
3
4
4
Erroneous example with an underscore:
5
- ```
5
+ ``` compile_fail,E0106,E0637
6
6
fn foo<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {}
7
7
// ^^ `'_` is a reserved lifetime name
8
8
```
@@ -19,7 +19,7 @@ fn <'a>(str1: &'a str, str2: &'a str) -> &'a str {}
19
19
```
20
20
21
21
Erroneous example with const generic:
22
- ```
22
+ ``` compile_fail,E0637
23
23
struct A<const N: &u8>;
24
24
//~^ ERROR `&` without an explicit lifetime name cannot be used here
25
25
trait B {}
@@ -35,7 +35,6 @@ impl<const N: &u8> B for A<N> {}
35
35
36
36
fn bar<const N: &u8>() {}
37
37
//~^ ERROR `&` without an explicit lifetime name cannot be used here
38
- }
39
38
```
40
39
41
40
Const generics cannot be borrowed without specifying a lifetime.The
@@ -56,6 +55,5 @@ impl<const N: &'a u8> A<N> {
56
55
impl<const N: &'a u8> B for A<N> {}
57
56
58
57
fn bar<const N: &'a u8>() {}
59
- }
60
58
```
61
59
[ bk-no ] : https://doc.rust-lang.org/book/appendix-02-operators.html#non-operator-symbols
You can’t perform that action at this time.
0 commit comments