]> git.lizzy.rs Git - rust.git/blob - tests/ui/pattern/issue-88074-pat-range-type-inference-err.rs
Rollup merge of #106749 - glandium:dwarf, r=Mark-Simulacrum
[rust.git] / tests / ui / pattern / issue-88074-pat-range-type-inference-err.rs
1 trait Zero {
2     const ZERO: Self;
3 }
4
5 impl Zero for String {
6     const ZERO: Self = String::new();
7 }
8
9 fn foo() {
10      match String::new() {
11         Zero::ZERO ..= Zero::ZERO => {},
12         //~^ ERROR only `char` and numeric types are allowed in range patterns
13         _ => {},
14     }
15 }
16
17 fn bar() {
18     match Zero::ZERO {
19         Zero::ZERO ..= Zero::ZERO => {},
20         //~^ ERROR type annotations needed [E0282]
21         _ => {},
22     }
23 }
24
25 fn main() {
26     foo();
27     bar();
28 }