@@ -1476,6 +1476,33 @@ return, for example with a `loop` that never breaks or a call to another
1476
1476
diverging function (such as `panic!()`).
1477
1477
"## ,
1478
1478
1479
+ E0172 : r##"
1480
+ This error means that an attempt was made to specify the type of a variable with
1481
+ a combination of a concrete type and a trait. Consider the following example:
1482
+
1483
+ ```
1484
+ fn foo(bar: i32+std::fmt::Display) {}
1485
+ ```
1486
+
1487
+ The code is trying to specify that we want to receive a signed 32-bit integer
1488
+ which also implements `Display`. This doesn't make sense: when we pass `i32`, a
1489
+ concrete type, it implicitly includes all of the traits that it implements.
1490
+ This includes `Display`, `Debug`, `Clone`, and a host of others.
1491
+
1492
+ If `i32` implements the trait we desire, there's no need to specify the trait
1493
+ separately. If it does not, then we need to `impl` the trait for `i32` before
1494
+ passing it into `foo`. Either way, a fixed definition for `foo` will look like
1495
+ the following:
1496
+
1497
+ ```
1498
+ fn foo(bar: i32) {}
1499
+ ```
1500
+
1501
+ To learn more about traits, take a look at the Book:
1502
+
1503
+ https://doc.rust-lang.org/book/traits.html
1504
+ "## ,
1505
+
1479
1506
E0178 : r##"
1480
1507
In types, the `+` type operator has low precedence, so it is often necessary
1481
1508
to use parentheses.
@@ -2196,7 +2223,6 @@ register_diagnostics! {
2196
2223
E0164 ,
2197
2224
E0167 ,
2198
2225
E0168 ,
2199
- E0172 ,
2200
2226
E0173 , // manual implementations of unboxed closure traits are experimental
2201
2227
E0174 , // explicit use of unboxed closure methods are experimental
2202
2228
E0182 ,
0 commit comments