Duplicate pattern in match arms are an unreachable pattern?

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=0165ca8264e6fc7ce0abed4b67381b2f

It should say something like "duplicate pattern detected". Or is there a meaning to this error? It kinda implies that the matching runs from the top to bottom.

That’s correct. The patterns are checked in order from first to last.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.