2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-11-24 11:56:24 +00:00
|
|
|
#![allow(dead_code, unreachable_patterns)]
|
2019-05-30 10:20:30 +00:00
|
|
|
#![allow(ellipsis_inclusive_range_patterns)]
|
2015-05-04 07:55:16 +00: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 10:20:30 +00: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 07:55:16 +00:00
|
|
|
}
|