Skip to content

Matching unbound reference to string in tuple causes ICE #78604

Closed
@tversteeg

Description

@tversteeg

Code

fn main() {
	match ("", ()) {
		(&_, _) => (),
	}
}

Meta

rustc --version --verbose:

rustc 1.49.0-nightly (ffe52882e 2020-10-30)
binary: rustc
commit-hash: ffe52882ed79be67344dd6085559e308241e7f60
commit-date: 2020-10-30
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly

Error output

thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', compiler/rustc_mir_build/src/thir/pattern/_match.rs:2069:5
Backtrace

     Running `sccache rustc --crate-name compiler_test --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=621a9c4c255209bb -C extra-filename=-621a9c4c255209bb --out-dir /home/thomas/r/test/target/debug/deps -C incremental=/home/thomas/r/test/target/debug/incremental -L dependency=/home/thomas/r/test/target/debug/deps --extern clap=/home/thomas/r/test/target/debug/deps/libclap-1c36037ddec5517c.rlib`
thread 'rustc' panicked at 'assertion failed: rows.iter().all(|r| r.len() == v.len())', compiler/rustc_mir_build/src/thir/pattern/_match.rs:2069:5
stack backtrace:
   0: std::panicking::begin_panic
   1: rustc_mir_build::thir::pattern::_match::is_useful
   2: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
   3: rustc_mir_build::thir::pattern::_match::is_useful
   4: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
   5: rustc_mir_build::thir::pattern::_match::is_useful
   6: rustc_mir_build::thir::pattern::check_match::check_not_useful
   7: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
   8: <rustc_mir_build::thir::pattern::check_match::MatchVisitor as rustc_hir::intravisit::Visitor>::visit_expr
   9: rustc_mir_build::thir::pattern::check_match::check_match
  10: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_match>::compute
  11: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  13: rustc_data_structures::stack::ensure_sufficient_stack
  14: rustc_query_system::query::plumbing::get_query_impl
  15: rustc_query_system::query::plumbing::ensure_query_impl
  16: rustc_interface::passes::analysis
  17: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  18: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  19: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  20: rustc_data_structures::stack::ensure_sufficient_stack
  21: rustc_query_system::query::plumbing::get_query_impl
  22: rustc_interface::passes::QueryContext::enter
  23: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  24: rustc_span::with_source_map
  25: scoped_tls::ScopedKey<T>::set
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.49.0-nightly (ffe52882e 2020-10-30) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [check_match] match-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `compiler_test`

Caused by:
  process didn't exit successfully: `sccache rustc --crate-name compiler_test --edition=2018 src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=621a9c4c255209bb -C extra-filename=-621a9c4c255209bb --out-dir /home/thomas/r/test/target/debug/deps -C incremental=/home/thomas/r/test/target/debug/incremental -L dependency=/home/thomas/r/test/target/debug/deps --extern clap=/home/thomas/r/test/target/debug/deps/libclap-1c36037ddec5517c.rlib` (exit code: 101)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-exhaustiveness-checkingRelating to exhaustiveness / usefulness checking of patternsC-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.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions