Skip to content

Commit 58d0e67

Browse files
committed
Added compiler flags to example code, removed unexpected curly
1 parent 4091466 commit 58d0e67

File tree

1 file changed

+2
-4
lines changed
  • src/librustc_error_codes/error_codes

1 file changed

+2
-4
lines changed

src/librustc_error_codes/error_codes/E0637.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ An underscore `_` character has been used as the identifier for a lifetime,
22
or a const generic has been borrowed without an explicit lifetime.
33

44
Erroneous example with an underscore:
5-
```
5+
```compile_fail,E0106,E0637
66
fn 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

2121
Erroneous example with const generic:
22-
```
22+
```compile_fail,E0637
2323
struct A<const N: &u8>;
2424
//~^ ERROR `&` without an explicit lifetime name cannot be used here
2525
trait B {}
@@ -35,7 +35,6 @@ impl<const N: &u8> B for A<N> {}
3535
3636
fn bar<const N: &u8>() {}
3737
//~^ ERROR `&` without an explicit lifetime name cannot be used here
38-
}
3938
```
4039

4140
Const generics cannot be borrowed without specifying a lifetime.The
@@ -56,6 +55,5 @@ impl<const N: &'a u8> A<N> {
5655
impl<const N: &'a u8> B for A<N> {}
5756
5857
fn bar<const N: &'a u8>() {}
59-
}
6058
```
6159
[bk-no]: https://doc.rust-lang.org/book/appendix-02-operators.html#non-operator-symbols

0 commit comments

Comments
 (0)