Skip to content

"or-patterns should have already been handled" when using feature(or_patterns) #72680

Closed
@Zenithsiz

Description

When using the or_patterns feature, attempting to match on a tuple creates a compiler panic.

The following code causes the panic.

#![feature(or_patterns)]

fn f(s: &str, num: usize) {
	match (s, num) {
		("", 0) | ("a" | "b", 1) => (),
		
		_ => ()
	}
}

(Also available at the playground)

This occurs both on the playground and on my local machine on a previous version (details below).

Meta

Rust version from the playground:

1.45.0-nightly
(2020-05-26 5239f5c)

Local version:

rustc 1.45.0-nightly (a74d186 2020-05-14)
binary: rustc
commit-hash: a74d186
commit-date: 2020-05-14
host: x86_64-pc-windows-msvc
release: 1.45.0-nightly
LLVM version: 9.0

Playground backtrace:

  Compiling playground v0.0.1 (/playground)
error: internal compiler error: src/librustc_mir_build/build/matches/test.rs:70: or-patterns should have already been handled

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:907:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.0-nightly (5239f5c57 2020-05-26) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

error: aborting due to previous error

error: could not compile `playground`.

To learn more, run the command again with --verbose.

Local backtrace:

error: internal compiler error: src\librustc_mir_build\build\matches\test.rs:70: or-patterns should have already been handled

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:907:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.45.0-nightly (a74d1862d 2020-05-14) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type cdylib

note: some of the compiler flags provided by cargo are hidden

EDIT: Added local machine backtrace too

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-patternsRelating to patterns and pattern matchingC-bugCategory: This is a bug.F-or_patterns`#![feature(or_patterns)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions