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,
22or a const generic has been borrowed without an explicit lifetime.
33
44Erroneous example with an underscore:
5- ```
5+ ``` compile_fail,E0106,E0637
66fn foo<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {}
77 // ^^ `'_` is a reserved lifetime name
88```
@@ -19,7 +19,7 @@ fn <'a>(str1: &'a str, str2: &'a str) -> &'a str {}
1919```
2020
2121Erroneous example with const generic:
22- ```
22+ ``` compile_fail,E0637
2323struct A<const N: &u8>;
2424//~^ ERROR `&` without an explicit lifetime name cannot be used here
2525trait B {}
@@ -35,7 +35,6 @@ impl<const N: &u8> B for A<N> {}
3535
3636fn bar<const N: &u8>() {}
3737//~^ ERROR `&` without an explicit lifetime name cannot be used here
38- }
3938```
4039
4140Const generics cannot be borrowed without specifying a lifetime.The
@@ -56,6 +55,5 @@ impl<const N: &'a u8> A<N> {
5655impl<const N: &'a u8> B for A<N> {}
5756
5857fn bar<const N: &'a u8>() {}
59- }
6058```
6159[ 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