Closed
Description
hi when i use rust 1.53 version some code about pattern match below make me confused,and i think this is a bug or a problem that cannot be ignored.
let x = Some(2);
assert!(matches!(x,Some(1 | 2)));//ok x is Some(2)
assert!(matches!(Some(1),Some(1|2)));//ok
assert!(matches!(Some(2),Some(1|2)));//ok
let y = Some(1 | 2);//y is Some(3)
// assert!(matches!(Some(3),Some(1|2)));// error, Some(1|2) =>is Some(1) | Some(2) or Some(3)?
Metadata
Metadata
Assignees
Labels
No labels