@@ -1476,6 +1476,33 @@ return, for example with a `loop` that never breaks or a call to another
14761476diverging function (such as `panic!()`).
14771477"## ,
14781478
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+
14791506E0178 : r##"
14801507In types, the `+` type operator has low precedence, so it is often necessary
14811508to use parentheses.
@@ -2196,7 +2223,6 @@ register_diagnostics! {
21962223 E0164 ,
21972224 E0167 ,
21982225 E0168 ,
2199- E0172 ,
22002226 E0173 , // manual implementations of unboxed closure traits are experimental
22012227 E0174 , // explicit use of unboxed closure methods are experimental
22022228 E0182 ,
0 commit comments