Skip to content

Commit 638deb3

Browse files
committed
Rollup merge of rust-lang#25190 - nham:E0046_E0054, r=alexcrichton
cc rust-lang#24407
2 parents b022709 + 11a7bad commit 638deb3

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/librustc_typeck/diagnostics.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,28 @@
1212

1313
register_long_diagnostics! {
1414

15+
E0046: r##"
16+
When trying to make some type implement a trait `Foo`, you must, at minimum,
17+
provide implementations for all of `Foo`'s required methods (meaning the
18+
methods that do not have default implementations), as well as any required
19+
trait items like associated types or constants.
20+
"##,
21+
22+
E0054: r##"
23+
It is not allowed to cast to a bool. If you are trying to cast a numeric type
24+
to a bool, you can compare it with zero instead:
25+
26+
```
27+
let x = 5;
28+
29+
// Ok
30+
let x_is_nonzero = x != 0;
31+
32+
// Not allowed, won't compile
33+
let x_is_nonzero = x as bool;
34+
```
35+
"##,
36+
1537
E0081: r##"
1638
Enum discriminants are used to differentiate enum variants stored in memory.
1739
This error indicates that the same value was used for two or more variants,
@@ -106,11 +128,9 @@ register_diagnostics! {
106128
E0040, // explicit use of destructor method
107129
E0044,
108130
E0045,
109-
E0046,
110131
E0049,
111132
E0050,
112133
E0053,
113-
E0054,
114134
E0055,
115135
E0057,
116136
E0059,

0 commit comments

Comments
 (0)