@@ -1458,6 +1458,33 @@ return, for example with a `loop` that never breaks or a call to another
1458
1458
diverging function (such as `panic!()`).
1459
1459
"## ,
1460
1460
1461
+ E0172 : r##"
1462
+ This error means that an attempt was made to specify the type of a variable with
1463
+ a combination of a concrete type and a trait. Consider the following example:
1464
+
1465
+ ```
1466
+ fn foo(bar: i32+std::fmt::Display) {}
1467
+ ```
1468
+
1469
+ The code is trying to specify that we want to receive a signed 32-bit integer
1470
+ which also implements `Display`. This doesn't make sense: when we pass `i32`, a
1471
+ concrete type, it implicitly includes all of the traits that it implements.
1472
+ This includes `Display`, `Debug`, `Clone`, and a host of others.
1473
+
1474
+ If `i32` implements the trait we desire, there's no need to specify the trait
1475
+ separately. If it does not, then we need to `impl` the trait for `i32` before
1476
+ passing it into `foo`. Either way, a fixed definition for `foo` will look like
1477
+ the following:
1478
+
1479
+ ```
1480
+ fn foo(bar: i32) {}
1481
+ ```
1482
+
1483
+ To learn more about traits, take a look at the Book:
1484
+
1485
+ https://doc.rust-lang.org/book/traits.html
1486
+ "## ,
1487
+
1461
1488
E0178 : r##"
1462
1489
In types, the `+` type operator has low precedence, so it is often necessary
1463
1490
to use parentheses.
@@ -2178,7 +2205,6 @@ register_diagnostics! {
2178
2205
E0164 ,
2179
2206
E0167 ,
2180
2207
E0168 ,
2181
- E0172 ,
2182
2208
E0173 , // manual implementations of unboxed closure traits are experimental
2183
2209
E0174 , // explicit use of unboxed closure methods are experimental
2184
2210
E0182 ,
0 commit comments