mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
18 lines
421 B
Rust
18 lines
421 B
Rust
// run-pass
|
|
// Test that type inference for range patterns works correctly (is bi-directional).
|
|
|
|
pub fn main() {
|
|
match 1 {
|
|
1 ..= 3 => {}
|
|
_ => panic!("should match range")
|
|
}
|
|
match 1 {
|
|
1 ..= 3u16 => {}
|
|
_ => panic!("should match range with inferred start type")
|
|
}
|
|
match 1 {
|
|
1u16 ..= 3 => {}
|
|
_ => panic!("should match range with inferred end type")
|
|
}
|
|
}
|