@@ -223,40 +223,27 @@ impl Foo for Bar {
223
223
"## ,
224
224
225
225
E0053 : r##"
226
- For any given method of a trait, the mutabilities of the parameters must match
227
- between the trait definition and the implementation .
226
+ The parameters of any trait method must match between a trait implementation
227
+ and the trait definition.
228
228
229
- Here's an example where the mutability of the `self` parameter is wrong :
229
+ Here are a couple examples of this error :
230
230
231
231
```
232
- trait Foo { fn foo(&self); }
233
-
234
- struct Bar;
235
-
236
- impl Foo for Bar {
237
- // error, the signature should be `fn foo(&self)` instead
238
- fn foo(&mut self) { }
232
+ trait Foo {
233
+ fn foo(x: u16);
234
+ fn bar(&self);
239
235
}
240
236
241
- fn main() {}
242
- ```
243
-
244
- Here's another example, this time for a non-`self` parameter:
245
-
246
- ```
247
- trait Foo { fn foo(x: &mut bool) -> bool; }
248
-
249
237
struct Bar;
250
238
251
239
impl Foo for Bar {
252
- // error, the type of `x` should be `&mut bool` instead
253
- fn foo(x: &bool) -> bool { *x }
254
- }
240
+ // error, expected u16, found i16
241
+ fn foo(x: i16) { }
255
242
256
- fn main() {}
243
+ // error, values differ in mutability
244
+ fn foo(&mut self) { }
245
+ }
257
246
```
258
-
259
-
260
247
"## ,
261
248
262
249
E0054 : r##"
@@ -678,6 +665,48 @@ it has been disabled for now.
678
665
[iss20126]: https://github.com/rust-lang/rust/issues/20126
679
666
"## ,
680
667
668
+ E0185 : r##"
669
+ An associated function for a trait was defined to be static, but an
670
+ implementation of the trait declared the same function to be a method (i.e. to
671
+ take a `self` parameter).
672
+
673
+ Here's an example of this error:
674
+
675
+ ```
676
+ trait Foo {
677
+ fn foo();
678
+ }
679
+
680
+ struct Bar;
681
+
682
+ impl Foo for Bar {
683
+ // error, method `foo` has a `&self` declaration in the impl, but not in
684
+ // the trait
685
+ fn foo(&self) {}
686
+ }
687
+ "## ,
688
+
689
+ E0186 : r##"
690
+ An associated function for a trait was defined to be a method (i.e. to take a
691
+ `self` parameter), but an implementation of the trait declared the same function
692
+ to be static.
693
+
694
+ Here's an example of this error:
695
+
696
+ ```
697
+ trait Foo {
698
+ fn foo(&self);
699
+ }
700
+
701
+ struct Bar;
702
+
703
+ impl Foo for Bar {
704
+ // error, method `foo` has a `&self` declaration in the trait, but not in
705
+ // the impl
706
+ fn foo() {}
707
+ }
708
+ "## ,
709
+
681
710
E0197 : r##"
682
711
Inherent implementations (one that do not implement a trait but provide
683
712
methods associated with a type) are always safe because they are not
@@ -766,6 +795,14 @@ impl Foo {
766
795
```
767
796
"## ,
768
797
798
+ E0202 : r##"
799
+ Inherent associated types were part of [RFC 195] but are not yet implemented.
800
+ See [the tracking issue][iss8995] for the status of this implementation.
801
+
802
+ [RFC 195]: https://github.com/rust-lang/rfcs/pull/195
803
+ [iss8995]: https://github.com/rust-lang/rust/issues/8995
804
+ "## ,
805
+
769
806
E0204 : r##"
770
807
An attempt to implement the `Copy` trait for a struct failed because one of the
771
808
fields does not implement `Copy`. To fix this, you must implement `Copy` for the
@@ -906,6 +943,25 @@ for types as needed by the compiler, and it is currently disallowed to
906
943
explicitly implement it for a type.
907
944
"## ,
908
945
946
+ E0326 : r##"
947
+ The types of any associated constants in a trait implementation must match the
948
+ types in the trait definition. This error indicates that there was a mismatch.
949
+
950
+ Here's an example of this error:
951
+
952
+ ```
953
+ trait Foo {
954
+ const BAR: bool;
955
+ }
956
+
957
+ struct Bar;
958
+
959
+ impl Foo for Bar {
960
+ const BAR: u32 = 5; // error, expected bool, found u32
961
+ }
962
+ ```
963
+ "## ,
964
+
909
965
E0368 : r##"
910
966
This error indicates that a binary assignment operator like `+=` or `^=` was
911
967
applied to the wrong types.
@@ -1037,8 +1093,6 @@ register_diagnostics! {
1037
1093
E0174 , // explicit use of unboxed closure methods are experimental
1038
1094
E0182 ,
1039
1095
E0183 ,
1040
- E0185 ,
1041
- E0186 ,
1042
1096
E0187 , // can't infer the kind of the closure
1043
1097
E0188 , // can not cast a immutable reference to a mutable pointer
1044
1098
E0189 , // deprecated: can only cast a boxed pointer to a boxed object
@@ -1050,7 +1104,6 @@ register_diagnostics! {
1050
1104
E0194 ,
1051
1105
E0195 , // lifetime parameters or bounds on method do not match the trait declaration
1052
1106
E0196 , // cannot determine a type for this closure
1053
- E0202 , // associated items are not allowed in inherent impls
1054
1107
E0203 , // type parameter has more than one relaxed default bound,
1055
1108
// and only one is supported
1056
1109
E0207 , // type parameter is not constrained by the impl trait, self type, or predicate
@@ -1100,7 +1153,6 @@ register_diagnostics! {
1100
1153
E0323 , // implemented an associated const when another trait item expected
1101
1154
E0324 , // implemented a method when another trait item expected
1102
1155
E0325 , // implemented an associated type when another trait item expected
1103
- E0326 , // associated const implemented with different type from trait
1104
1156
E0327 , // referred to method instead of constant in match pattern
1105
1157
E0328 , // cannot implement Unsize explicitly
1106
1158
E0329 , // associated const depends on type parameter or Self.
0 commit comments