diff options
| author | Josh White <jwhite927@gmail.com> | 2020-02-08 06:18:42 -0500 |
|---|---|---|
| committer | Josh White <jwhite927@gmail.com> | 2020-02-08 06:18:42 -0500 |
| commit | 58d0e67f504fb55ccbe1094265d029a10bc168c7 (patch) | |
| tree | 2da1692b9650391ab4a7040f0a323750bd25d9ee /src/librustc_error_codes/error_codes | |
| parent | 409146673c38ffeed1a9c93b9d1736be9de3cce4 (diff) | |
Added compiler flags to example code, removed unexpected curly
Diffstat (limited to 'src/librustc_error_codes/error_codes')
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0637.md | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/librustc_error_codes/error_codes/E0637.md b/src/librustc_error_codes/error_codes/E0637.md index f2ec7fa0b49..9b5db8fe733 100644 --- a/src/librustc_error_codes/error_codes/E0637.md +++ b/src/librustc_error_codes/error_codes/E0637.md @@ -2,7 +2,7 @@ An underscore `_` character has been used as the identifier for a lifetime, or a const generic has been borrowed without an explicit lifetime. Erroneous example with an underscore: -``` +```compile_fail,E0106,E0637 fn foo<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {} // ^^ `'_` is a reserved lifetime name ``` @@ -19,7 +19,7 @@ fn <'a>(str1: &'a str, str2: &'a str) -> &'a str {} ``` Erroneous example with const generic: -``` +```compile_fail,E0637 struct A<const N: &u8>; //~^ ERROR `&` without an explicit lifetime name cannot be used here trait B {} @@ -35,7 +35,6 @@ impl<const N: &u8> B for A<N> {} fn bar<const N: &u8>() {} //~^ ERROR `&` without an explicit lifetime name cannot be used here -} ``` Const generics cannot be borrowed without specifying a lifetime.The @@ -56,6 +55,5 @@ impl<const N: &'a u8> A<N> { impl<const N: &'a u8> B for A<N> {} fn bar<const N: &'a u8>() {} -} ``` [bk-no]: https://doc.rust-lang.org/book/appendix-02-operators.html#non-operator-symbols |
