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