Skip to content

Commit

Permalink
Mark _ as unreachable
Browse files Browse the repository at this point in the history
Rust's exhaustiveness checking is based entirely on enums and never
values, so this fails because u8 simply isn't an enum type.

    error[E0004]: non-exhaustive patterns: `_` not covered
      --> src/main.rs:39:26
       |
    39 |     let op_bytes = match op_code {
       |                          ^^^^^^^ pattern `_` not covered

rust-lang/rust#12483
  • Loading branch information
twe4ked committed Aug 11, 2018
1 parent cdb3ab0 commit 0c95881
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ fn disassemble(pc: u16, buffer: &Vec<u8>) -> u16 {
0xfd => { not_implemented() },
0xfe => { disassemble_2("CPI", buffer[pc + 1]) },
0xff => { disassemble_1("RST 7") },
_ => { not_implemented() }
_ => unreachable!()
};

op_bytes
Expand Down

0 comments on commit 0c95881

Please sign in to comment.