@@ -1250,6 +1250,44 @@ information see the [opt-in builtin traits RFC](https://github.com/rust-lang/
1250
1250
rfcs/blob/master/text/0019-opt-in-builtin-traits.md).
1251
1251
"## ,
1252
1252
1253
+ E0195 : r##"
1254
+ Your method's lifetime parameters do not match the trait declaration.
1255
+ Erroneous code example:
1256
+
1257
+ ```
1258
+ trait Trait {
1259
+ fn t<'a,'b:'a>(x: &'a str, y: &'b str);
1260
+ }
1261
+
1262
+ struct Foo;
1263
+
1264
+ impl Trait for Foo {
1265
+ fn t<'a,'b>(x: &'a str, y: &'b str) { // error: lifetime parameters
1266
+ // or bounds on method `t`
1267
+ // do not match the trait
1268
+ // declaration
1269
+ }
1270
+ }
1271
+ ```
1272
+
1273
+ The 'b lifetime constraints for `t` implementation does not match the
1274
+ trait declaration. Ensure lifetime declarations match exactly in both trait
1275
+ declaration and implementation. Example:
1276
+
1277
+ ```
1278
+ trait Trait {
1279
+ fn t<'a,'b:'a>(x: &'a str, y: &'b str);
1280
+ }
1281
+
1282
+ struct Foo;
1283
+
1284
+ impl Trait for Foo {
1285
+ fn t<'a,'b:'a>(x: &'a str, y: &'b str) { // ok!
1286
+ }
1287
+ }
1288
+ ```
1289
+ "## ,
1290
+
1253
1291
E0197 : r##"
1254
1292
Inherent implementations (one that do not implement a trait but provide
1255
1293
methods associated with a type) are always safe because they are not
@@ -1686,7 +1724,6 @@ register_diagnostics! {
1686
1724
E0193 , // cannot bound type where clause bounds may only be attached to types
1687
1725
// involving type parameters
1688
1726
E0194 ,
1689
- E0195 , // lifetime parameters or bounds on method do not match the trait declaration
1690
1727
E0196 , // cannot determine a type for this closure
1691
1728
E0203 , // type parameter has more than one relaxed default bound,
1692
1729
// and only one is supported
0 commit comments