Skip to content

ICE: 'called Result::unwrap() on an Err value: FallbackToConstRef(())', compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:169:83 #82909

Closed

Description

Code

struct Sum(u32, u32);
impl PartialEq for Sum {
    fn eq(&self, other: &Self) -> bool {
        0 == 0
    }
}
#[derive(PartialEq)]
enum Eek {
    UnusedByTheConst(Sum),
}
const SUM_THREE: Eek = Eek::UnusedByTheConst(Sum(3, 0));
const EEK_ONE: &[Eek] = &[SUM_THREE];
fn main() {
    match &&&[][..] {
        &&EEK_ONE => {}
    }
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (234781afe 2021-03-07)
binary: rustc
commit-hash: 234781afe33d3f339b002f85f948046d8476cfc9
commit-date: 2021-03-07
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

warning: to use a constant of type `Eek` in a pattern, `Eek` must be annotated with `#[derive(PartialEq, Eq)]`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:15:11
   |
15 |         &&EEK_ONE => {}
   |           ^^^^^^^
   |
   = note: `#[warn(indirect_structural_match)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: FallbackToConstRef(())', compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:169:83
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

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

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: rustc 1.52.0-nightly (234781afe 2021-03-07) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_match] match-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: unused variable: `other`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:18
  |
3 |     fn eq(&self, other: &Self) -> bool {
  |                  ^^^^^ help: if this is intentional, prefix it with an underscore: `_other`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 2 warnings emitted
Backtrace

warning: to use a constant of type `Eek` in a pattern, `Eek` must be annotated with `#[derive(PartialEq, Eq)]`
  --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:15:11
   |
15 |         &&EEK_ONE => {}
   |           ^^^^^^^
   |
   = note: `#[warn(indirect_structural_match)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>

thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: FallbackToConstRef(())', compiler/rustc_mir_build/src/thir/pattern/const_to_pat.rs:169:83
stack backtrace:
   0: rust_begin_unwind
             at /rustc/234781afe33d3f339b002f85f948046d8476cfc9/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/234781afe33d3f339b002f85f948046d8476cfc9/library/core/src/panicking.rs:92:14
   2: core::option::expect_none_failed
             at /rustc/234781afe33d3f339b002f85f948046d8476cfc9/library/core/src/option.rs:1301:5
   3: rustc_mir_build::thir::pattern::const_to_pat::ConstToPat::to_pat
   4: rustc_infer::infer::InferCtxtBuilder::enter
   5: rustc_mir_build::thir::pattern::const_to_pat::<impl rustc_mir_build::thir::pattern::PatCtxt>::const_to_pat
   6: rustc_mir_build::thir::pattern::PatCtxt::lower_path
   7: rustc_mir_build::thir::pattern::PatCtxt::lower_pattern
   8: rustc_mir_build::thir::pattern::PatCtxt::lower_pattern
   9: rustc_mir_build::thir::pattern::PatCtxt::lower_pattern
  10: rustc_mir_build::thir::pattern::check_match::MatchVisitor::lower_pattern
  11: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  12: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  13: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
  14: rustc_mir_build::thir::pattern::check_match::check_match
  15: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  16: rustc_data_structures::stack::ensure_sufficient_stack
  17: rustc_query_system::query::plumbing::force_query_with_job
  18: rustc_query_system::query::plumbing::get_query_impl
  19: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_match
  20: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  21: rustc_session::utils::<impl rustc_session::session::Session>::time
  22: rustc_interface::passes::analysis
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::force_query_with_job
  26: rustc_query_system::query::plumbing::get_query_impl
  27: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  28: rustc_interface::passes::QueryContext::enter
  29: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  30: rustc_span::with_source_map
  31: rustc_interface::interface::create_compiler_and_run
  32: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

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

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: rustc 1.52.0-nightly (234781afe 2021-03-07) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_match] match-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
warning: unused variable: `other`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:3:18
  |
3 |     fn eq(&self, other: &Self) -> bool {
  |                  ^^^^^ help: if this is intentional, prefix it with an underscore: `_other`
  |
  = note: `#[warn(unused_variables)]` on by default

warning: 2 warnings emitted

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

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions