Skip to content

missing unreachable pattern [E0001] warning #2511

Open
@MahadMuhammad

Description

E0001 unreachable pattern

  • Note: This error code is not longer emitted by rustc.
  • You can view the same on godbolt

I tried this code from E0001

#![allow(unused)]
fn main() {
match Some(0) {
    Some(bar) => {/* ... */}
    x => {/* ... */} // This handles the `None` case
    _ => {/* ... */} // All possible cases have already been handled
}
}

I expected to see this happen:

  • Compile successfully like rustc.

Instead, this happened:

  • Give error
➜  gccrs-build gcc/crab1 ../mahad-testsuite/E0001.rs
../mahad-testsuite/E0001.rs:3:7: error: Cannot find path ‘Some’ in this scope [E0433]
    3 | match Some(0) {
      |       ^~~~
../mahad-testsuite/E0001.rs:4:5: error: Cannot find path ‘Some’ in this scope [E0433]
    4 |     Some(bar) => {/* ... */}
      |     ^~~~

Meta

  • What version of Rust GCC were you using, git sha 6c63150
  • gccrs (Compiler-Explorer-Build-gcc-dba8bc5bf8247161b6eff4f738b6479382f770f2-binutils-2.40) 13.0.1 20230417 (experimental)

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions