Skip to content

ICE: this path really should be doomed #134162

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

fn main() {
    struct X;

    let xs = [X, X, X];
    let eq = xs == [panic!("panic evaluated"); 2];
}

original:

fn main() {
    struct X;
    //~^ HELP consider annotating `X` with `#[derive(PartialEq)]`
    let xs = [X, X, X];
    let eq = xs == [panic!("panic evaluated"); 2];
    //~^ ERROR binary operation `==` cannot be applied to type `[X; 3]`
}

Version information

rustc 1.85.0-nightly (33c245b9e 2024-12-10)
binary: rustc
commit-hash: 33c245b9e98bc91e18ea1c5033824f4c6f92766f
commit-date: 2024-12-10
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: unreachable expression
 --> /tmp/icemaker_global_tempdir.NcZ6cDcOgb7d/rustc_testrunner_tmpdir_reporting.dN0NI0VTaCoG/mvce.rs:5:20
  |
5 |     let eq = xs == [panic!("panic evaluated"); 2];
  |                    ^-------------------------^^^^
  |                    ||
  |                    |any code following this expression is unreachable
  |                    unreachable expression
  |
  = note: `#[warn(unreachable_code)]` on by default

warning: 1 warning emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: this path really should be doomed...
 --> /tmp/icemaker_global_tempdir.NcZ6cDcOgb7d/rustc_testrunner_tmpdir_reporting.dN0NI0VTaCoG/mvce.rs:5:17
  |
5 |     let eq = xs == [panic!("panic evaluated"); 2];
  |                 ^^
  |
note: delayed at compiler/rustc_hir_typeck/src/op.rs:925:28 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.NcZ6cDcOgb7d/rustc_testrunner_tmpdir_reporting.dN0NI0VTaCoG/mvce.rs:5:17
  |
5 |     let eq = xs == [panic!("panic evaluated"); 2];
  |                 ^^

error: internal compiler error: expression with never type wound up being adjusted
 --> /tmp/icemaker_global_tempdir.NcZ6cDcOgb7d/rustc_testrunner_tmpdir_reporting.dN0NI0VTaCoG/mvce.rs:5:21
  |
5 |     let eq = xs == [panic!("panic evaluated"); 2];
  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at compiler/rustc_hir_typeck/src/expr.rs:76:43 - disabled backtrace
 --> /tmp/icemaker_global_tempdir.NcZ6cDcOgb7d/rustc_testrunner_tmpdir_reporting.dN0NI0VTaCoG/mvce.rs:5:21
  |
5 |     let eq = xs == [panic!("panic evaluated"); 2];
  |                     ^^^^^^^^^^^^^^^^^^^^^^^^^
  = note: this error: internal compiler error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)

error: internal compiler error: TyKind::Error constructed but no error reported
  |
  = note: delayed at compiler/rustc_hir_typeck/src/op.rs:303:17 - disabled backtrace

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: please make sure that you have updated to the latest nightly

note: rustc 1.85.0-nightly (33c245b9e 2024-12-10) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.S-has-bisectionStatus: a bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions