mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +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")
|
|
}
|
|
}
|