File tree Expand file tree Collapse file tree 1 file changed +48
-3
lines changed Expand file tree Collapse file tree 1 file changed +48
-3
lines changed Original file line number Diff line number Diff line change @@ -934,6 +934,51 @@ The number of supplied parameters much exactly match the number of defined type
934
934
parameters.
935
935
"## ,
936
936
937
+ E0088 : r##"
938
+ You gave too many lifetime parameters. Erroneous code example:
939
+
940
+ ```
941
+ fn f() {}
942
+
943
+ fn main() {
944
+ f::<'static>() // error: too many lifetime parameters provided
945
+ }
946
+ ```
947
+
948
+ Please check you give the right number of lifetime parameters. Example:
949
+
950
+ ```
951
+ fn f() {}
952
+
953
+ fn main() {
954
+ f() // ok!
955
+ }
956
+ ```
957
+
958
+ It's also important to note that the Rust compiler can generally
959
+ determine the lifetime by itself. Example:
960
+
961
+ ```
962
+ struct Foo {
963
+ value: String
964
+ }
965
+
966
+ impl Foo {
967
+ // it can be written like this
968
+ fn get_value<'a>(&'a self) -> &'a str { &self.value }
969
+ // but the compiler works fine with this too:
970
+ fn without_lifetime(&self) -> &str { &self.value }
971
+ }
972
+
973
+ fn main() {
974
+ let f = Foo { value: "hello".to_owned() };
975
+
976
+ println!("{}", f.get_value());
977
+ println!("{}", f.without_lifetime());
978
+ }
979
+ ```
980
+ "## ,
981
+
937
982
E0089 : r##"
938
983
Not enough type parameters were supplied for a function. For example:
939
984
@@ -960,13 +1005,14 @@ fn main() {
960
1005
"## ,
961
1006
962
1007
E0091 : r##"
963
- You gave an unnecessary type parameter. Erroneous code example:
1008
+ You gave an unnecessary type parameter in a type alias. Erroneous code
1009
+ example:
964
1010
965
1011
```
966
1012
type Foo<T> = u32; // error: type parameter `T` is unused
967
1013
```
968
1014
969
- Please check you didn't write to many type parameter . Example:
1015
+ Please check you didn't write too many type parameters . Example:
970
1016
971
1017
```
972
1018
type Foo = u32; // ok!
@@ -1599,7 +1645,6 @@ register_diagnostics! {
1599
1645
E0077 ,
1600
1646
E0085 ,
1601
1647
E0086 ,
1602
- E0088 ,
1603
1648
E0090 ,
1604
1649
E0092 ,
1605
1650
E0093 ,
You can’t perform that action at this time.
0 commit comments