]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs
Add ui/impl-trait/issues folder
[rust.git] / src / test / run-pass / associated-consts / associated-const-range-match-patterns.rs
1 // run-pass
2 #![allow(dead_code, unreachable_patterns)]
3
4 struct Foo;
5
6 trait HasNum {
7     const NUM: isize;
8 }
9 impl HasNum for Foo {
10     const NUM: isize = 1;
11 }
12
13 fn main() {
14     assert!(match 2 {
15         Foo::NUM ... 3 => true,
16         _ => false,
17     });
18     assert!(match 0 {
19         -1 ... <Foo as HasNum>::NUM => true,
20         _ => false,
21     });
22     assert!(match 1 {
23         <Foo as HasNum>::NUM ... <Foo>::NUM => true,
24         _ => false,
25     });
26 }