Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: Generics + Fn + overloaded_calls #16508

Closed
japaric opened this issue Aug 14, 2014 · 1 comment
Closed

ICE: Generics + Fn + overloaded_calls #16508

japaric opened this issue Aug 14, 2014 · 1 comment
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@japaric
Copy link
Member

japaric commented Aug 14, 2014

STR:

#![feature(overloaded_calls)]

use std::ops::Fn;

struct G;

impl<'a, A: Add<int, int>> Fn<(A,), int> for G {
    extern "rust-call" fn call(&self, (arg,): (A,)) -> int {
        arg.add(&1)
    }
}

fn main() {
    // ICE trigger
    G(1i);
}

Backtrace:

task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/librustc/middle/subst.rs:420

stack backtrace:
   1:     0x7fcce8fb0980 - rt::backtrace::imp::write::h500c7cd49c94d6cbo1q
   2:     0x7fcce8fb3a20 - <unknown>
   3:     0x7fcced528c40 - unwind::begin_unwind_inner::h78b0bc3908c6581cM8d
   4:     0x7fcced528930 - unwind::begin_unwind_fmt::h3b08875489dd9563h6d
   5:     0x7fcced5288f0 - rust_begin_unwind
   6:     0x7fcced566480 - failure::begin_unwind::h97ffd813929e6ce8n5j
   7:     0x7fcced56a120 - failure::fail_bounds_check::h83d6c17dc7061617A3j
   8:     0x7fccedfcb9f0 - middle::trans::common::find_vtable::h3c080be41502d99dym5
   9:     0x7fccedf70e80 - middle::trans::meth::trans_method_callee::h14eb916f1e57823dBYi
  10:     0x7fccedf99fd0 - <unknown>
  11:     0x7fccedf6f2b0 - middle::trans::callee::trans_call_inner::h35fcd3dc6cf92b24QM0
  12:     0x7fccedf999a0 - middle::trans::callee::trans_method_call::hfbb10b0bb60fb1df6H0
  13:     0x7fccedfa7980 - <unknown>
  14:     0x7fccedf65970 - middle::trans::expr::trans_into::h6a75ea5632764d57WG1
  15:     0x7fccedf65f00 - middle::trans::controlflow::trans_block::h4e3ce5bcb386b47byKX
  16:     0x7fccee017fd0 - middle::trans::base::trans_closure::h97b70672122772e4Ffd
  17:     0x7fccedf56d10 - middle::trans::base::trans_fn::h427f2b74d34d9e51rsd
  18:     0x7fccedf57320 - middle::trans::monomorphize::monomorphic_fn::h458ee6f7220bf52aQ6W
  19:     0x7fccedf8eb70 - middle::trans::callee::trans_fn_ref_with_vtables::ha9be7a0f3a6494ac6k0
  20:     0x7fccedf8c3f0 - middle::trans::callee::trans_fn_ref::h04e8c8720c3a684bd6Z
  21:     0x7fccedf70e80 - middle::trans::meth::trans_method_callee::h14eb916f1e57823dBYi
  22:     0x7fccedfc36f0 - <unknown>
  23:     0x7fccedf6f2b0 - middle::trans::callee::trans_call_inner::h35fcd3dc6cf92b24QM0
  24:     0x7fccedfa7980 - <unknown>
  25:     0x7fccedf65970 - middle::trans::expr::trans_into::h6a75ea5632764d57WG1
  26:     0x7fccedf64de0 - middle::trans::controlflow::trans_stmt_semi::h4bd6143bef5cdfaaFJX
  27:     0x7fccedf64510 - middle::trans::controlflow::trans_stmt::he411548830d9db52pFX
  28:     0x7fccedf65f00 - middle::trans::controlflow::trans_block::h4e3ce5bcb386b47byKX
  29:     0x7fccee017fd0 - middle::trans::base::trans_closure::h97b70672122772e4Ffd
  30:     0x7fccedf56d10 - middle::trans::base::trans_fn::h427f2b74d34d9e51rsd
  31:     0x7fccedf51bd0 - middle::trans::base::trans_item::ha5f8c6dffd457508sLd
  32:     0x7fccee024450 - middle::trans::base::trans_crate::hc8a067c8e67c4194ZFe
  33:     0x7fccee4459b0 - driver::driver::phase_4_translate_to_llvm::h0b6bfb0e08d77749xCx
  34:     0x7fccee43cc30 - driver::driver::compile_input::h7879a63579b438beafx
  35:     0x7fccee4e8400 - <unknown>
  36:     0x7fccee4e8310 - <unknown>
  37:     0x7fccee4fac60 - <unknown>
  38:     0x7fccee4faa60 - <unknown>
  39:     0x7fcced883b30 - <unknown>
  40:     0x7fcced578970 - <unknown>
  41:     0x7fcced578960 - rust_try
  42:     0x7fcced5262a0 - unwind::try::h36697dac480a0e50hXd
  43:     0x7fcced526040 - task::Task::run::h0fb2de2c85c53b00T4c
  44:     0x7fcced8838f0 - <unknown>
  45:     0x7fcced527e80 - <unknown>
  46:     0x7fcce832b000 - start_thread
  47:     0x7fcced1f7269 - clone
  48:                0x0 - <unknown>

Version:

rustc 0.12.0-pre (a8c8e3f80 2014-08-14 19:11:18 +0000)

cc @pcwalton

This is an updated version of the snippet posted by @pczarn in #15678. Issue 15678 describes an ICE that occurs during type checking, but this snippet produces a different ICE (during the translation phase), so I have opened this issue to track the second ICE.

@pczarn
Copy link
Contributor

pczarn commented Aug 15, 2014

Thanks. I had mistakenly assumed that the type checker is at fault, because I couldn't make it ICE with other combinations of type parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants