Skip to content

ICE on binding pattern containing generic #15873

Closed
@Dr-Emann

Description

@Dr-Emann

Minimal Test Example:

struct Cell<T> {
    value: T,
}

fn main() {
    let Cell{ value: _ } = 0u;
}

Rust first complains about mismatched types (expected uint but found a structure pattern). It then throws an ICE (internal compiler error: Type parameter T out of range when substituting (root type=T)).

Machine Details

OS: Ubuntu 14.04
rustc version: rustc 0.12.0-pre-nightly (f15d6d28396e8700b6c3f2704204a2769e710403 2014-07-20 22:46:29 +0000)

Rust Backtrace:

stack backtrace:
   1:     0x7ffc1df16d80 - rt::backtrace::imp::write::h86f9dc98984aaec9A7p
   2:     0x7ffc1df1a220 - failure::on_fail::h03e0e71824a692d7Psq
   3:     0x7ffc21f895d0 - unwind::begin_unwind_inner::h9ad6a00aad1794b670d
   4:     0x7ffc1eee8200 - unwind::begin_unwind::h269032659814541452
   5:     0x7ffc1eee8140 - diagnostic::SpanHandler::span_bug::h63ac709398ee5f0ba8C
   6:     0x7ffc227a4c70 - driver::session::Session::span_bug::h27378b3585e1de30ovx
   7:     0x7ffc22888aa0 - middle::subst::SubstFolder<'a>.TypeFolder::fold_ty::h9845df3f2f23c8a52CW
   8:     0x7ffc228889b0 - middle::subst::T.Subst::subst_spanned::h1568587282395775799
   9:     0x7ffc22afe140 - middle::ty::lookup_field_type::hc9d48e64a3082ebce0F
  10:     0x7ffc22b60dd0 - middle::typeck::check::_match::check_struct_pat_fields::habfd09d00a12994dG4H
  11:     0x7ffc22b65460 - middle::typeck::check::_match::check_struct_pat::hd69db1c8b6198d0dgcI
  12:     0x7ffc22b56060 - middle::typeck::check::_match::check_pat::h8e216cf3caae2bc4QgI
  13:     0x7ffc22c55450 - middle::typeck::check::check_decl_local::h9fa81396170a42c3CtV
  14:     0x7ffc22c55670 - middle::typeck::check::check_stmt::h34fac881637a2946JvV
  15:     0x7ffc22bdcb40 - middle::typeck::check::check_block_with_expected::hec979a49390f9f38UzV
  16:     0x7ffc22bd81f0 - middle::typeck::check::check_fn::h027544c2aa1032d0QLQ
  17:     0x7ffc22bd7f10 - middle::typeck::check::check_bare_fn::h88a2d2b39d1d1420rBQ
  18:     0x7ffc22bd0dd0 - middle::typeck::check::check_item::h2bcc411317d7d9cd49Q
  19:     0x7ffc22bd7d10 - middle::typeck::check::check_item_types::h9142f27077317e82JAQ
  20:     0x7ffc22dd5980 - middle::typeck::check_crate::h6afa11ccb3a6f46fJTh
  21:     0x7ffc22eacd00 - driver::driver::phase_3_run_analysis_passes::h0a5db2b2806a5ac1Cnw
  22:     0x7ffc22ea81d0 - driver::driver::compile_input::h2714688c818fc93cD9v
  23:     0x7ffc22f53640 - driver::run_compiler::hdc3f7737fe0af6fbDiz
  24:     0x7ffc22f53550 - driver::main_args::closure.$x22closure$x22$LP$138065$RP$
  25:     0x7ffc22f66bf0 - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$139209$RP$
  26:     0x7ffc22f669b0 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$139186$RP$
  27:     0x7ffc222ea210 - task::spawn_opts::closure.$x22closure$x22$LP$8165$RP$
  28:     0x7ffc21fe0ab0 - rust_try
  29:     0x7ffc21f86680 - unwind::try::h0fa4943ea00a482ewPd
  30:     0x7ffc21f863e0 - task::Task::run::hf8555f915ed22c94S0c
  31:     0x7ffc222ea000 - task::spawn_opts::closure.$x22closure$x22$LP$8111$RP$
  32:     0x7ffc21f88660 - thread::thread_start::he6fee52c0ee35cbcqnd
  33:     0x7ffc1d27d0c0 - start_thread
  34:     0x7ffc21c4b2d9 - __clone
  35:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions