2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2018-11-24 05:56:24 -06:00
|
|
|
#![allow(dead_code, unreachable_patterns)]
|
2019-05-30 05:20:30 -05:00
|
|
|
#![allow(ellipsis_inclusive_range_patterns)]
|
2015-05-04 02:55:16 -05:00
|
|
|
|
|
|
|
struct Foo;
|
|
|
|
|
|
|
|
trait HasNum {
|
|
|
|
const NUM: isize;
|
|
|
|
}
|
|
|
|
impl HasNum for Foo {
|
|
|
|
const NUM: isize = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert!(match 2 {
|
|
|
|
Foo::NUM ... 3 => true,
|
|
|
|
_ => false,
|
|
|
|
});
|
|
|
|
assert!(match 0 {
|
|
|
|
-1 ... <Foo as HasNum>::NUM => true,
|
|
|
|
_ => false,
|
|
|
|
});
|
|
|
|
assert!(match 1 {
|
|
|
|
<Foo as HasNum>::NUM ... <Foo>::NUM => true,
|
|
|
|
_ => false,
|
|
|
|
});
|
2019-05-30 05:20:30 -05:00
|
|
|
|
|
|
|
assert!(match 2 {
|
|
|
|
Foo::NUM ..= 3 => true,
|
|
|
|
_ => false,
|
|
|
|
});
|
|
|
|
assert!(match 0 {
|
|
|
|
-1 ..= <Foo as HasNum>::NUM => true,
|
|
|
|
_ => false,
|
|
|
|
});
|
|
|
|
assert!(match 1 {
|
|
|
|
<Foo as HasNum>::NUM ..= <Foo>::NUM => true,
|
|
|
|
_ => false,
|
|
|
|
});
|
2015-05-04 02:55:16 -05:00
|
|
|
}
|