() } } (Playground) Output: 42 E...">

Incorrect "unreachable pattern" warning. · Issue #70372 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@steffahn

Description

@steffahn

Not much to comment about. The supposedly “unreachable” pattern is obviously reached.

fn main() { match (3,42) { (a,) | (,a) if a > 10 => {println!("{}", a)} _ => () } }

(Playground)

Output:

Errors:

   Compiling playground v0.0.1 (/playground)
warning: unreachable pattern
 --> src/main.rs:4:17
  |
4 |         (a,_) | (_,a) if a > 10 => {println!("{}", a)}
  |                 ^^^^^
  |
  = note: `#[warn(unreachable_patterns)]` on by default

    Finished release [optimized] target(s) in 0.78s
     Running `target/release/playground`

This issue has been assigned to @AminArria via this comment.