Closed
Description
trait Zero {
const ZERO: Self;
}
impl Zero for i32 {
const ZERO: Self = 0;
}
fn foo() {
match 1 {
Zero::ZERO ..= 1 => {},
_ => {},
}
}
currently throws E0029:
error[E0029]: only `char` and numeric types are allowed in range patterns
--> src/lib.rs:11:9
|
11 | Zero::ZERO ..= 1 => {},
| ^^^^^^^^^^ - this is of type `{integer}`
| |
| this is of type `_` but it should be `char` or numeric
For more information about this error, try `rustc --explain E0029`.
while it should infer the constant to be <i32 as Zero>::ZERO
.
@rustbot modify labels: +T-compiler +A-inference
@rustbot claim