Skip to content

ICE when specializing function with wrong number of parameters #16338

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

Closed
japaric opened this issue Aug 7, 2014 · 0 comments · Fixed by #16554
Closed

ICE when specializing function with wrong number of parameters #16338

japaric opened this issue Aug 7, 2014 · 0 comments · Fixed by #16554
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@japaric
Copy link
Member

japaric commented Aug 7, 2014

STR

use std::mem;
use std::raw::Slice;

unsafe fn foo<T>(s: &mut [T]) {
    // GOOD
    let Slice { data: data, len: len } = mem::transmute::<&mut [T], Slice<T>>(s);

    // ICE
    let Slice { data: data, len: len } = mem::transmute::<&mut [T]>(s);
}

fn main() {}

Output

ice.rs:9:42: 9:68 error: too few type parameters provided: expected 2 parameter(s) but found 1 parameter(s) [E0089]
ice.rs:9     let Slice { data: data, len: len } = mem::transmute::<&mut [T]>(s);
                                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~
ice.rs:1:1: 1:1 error: internal compiler error: Type parameter <generic #0> out of range when substituting (root type=*const <generic #0>)
ice.rs:1 use std::mem;
         ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/libsyntax/ast_util.rs:784

Backtrace

   1:     0x7fa3eba4aea0 - rt::backtrace::imp::write::h8c6f09e2c045ded4t9p
   2:     0x7fa3eba4df40 - <unknown>
   3:     0x7fa3eff78870 - unwind::begin_unwind_inner::hde1fdf0d3c58be46M8d
   4:     0x7fa3ec5c5330 - <unknown>
   5:     0x7fa3ec5c5280 - diagnostic::SpanHandler::span_bug::hb643991b73dd73ceBID
   6:     0x7fa3f077ffa0 - driver::session::Session::span_bug::h1958b9cf10e9936dPix
   7:     0x7fa3f085b820 - middle::subst::SubstFolder<'a>.TypeFolder::fold_ty::hce1dda7c9bfc1345nuW
   8:     0x7fa3f085b820 - middle::subst::SubstFolder<'a>.TypeFolder::fold_ty::hce1dda7c9bfc1345nuW
   9:     0x7fa3f085b730 - <unknown>
  10:     0x7fa3f0aa35e0 - middle::ty::lookup_field_type::heb4c950674abc5c0L3F
  11:     0x7fa3f0afaa50 - middle::typeck::check::_match::check_struct_pat_fields::h528d0ebfe42c2cf1L2H
  12:     0x7fa3f0afdf30 - middle::typeck::check::_match::check_struct_pat::h2604e2d1497de3f1t9H
  13:     0x7fa3f0af05e0 - middle::typeck::check::_match::check_pat::h85bcdea4f0a9f3f86dI
  14:     0x7fa3f0c08610 - middle::typeck::check::check_decl_local::h5110173195dc124a2mV
  15:     0x7fa3f0c08830 - middle::typeck::check::check_stmt::h3bf06fef24ff92409oV
  16:     0x7fa3f0b72d90 - <unknown>
  17:     0x7fa3f0b6ebf0 - <unknown>
  18:     0x7fa3f0b6e910 - <unknown>
  19:     0x7fa3f0b67a90 - middle::typeck::check::check_item::h90885b67c7c48ea1m1Q
  20:     0x7fa3f0b6e710 - middle::typeck::check::check_item_types::h935cc44dce5d3acbQrQ
  21:     0x7fa3f05c02d0 - <unknown>
  22:     0x7fa3f0d7a940 - middle::typeck::check_crate::h679dbd3e8e3966d8GJh
  23:     0x7fa3f0e4b0d0 - driver::driver::phase_3_run_analysis_passes::ha24ce155c6a41a29Ibw
  24:     0x7fa3f0e46240 - driver::driver::compile_input::h2be4ad1a0cb48e63XXv
  25:     0x7fa3f0ee8d70 - <unknown>
  26:     0x7fa3f0ee8c80 - <unknown>
  27:     0x7fa3f0efac80 - <unknown>
  28:     0x7fa3f0efaa80 - <unknown>
  29:     0x7fa3f02d1d60 - <unknown>
  30:     0x7fa3effc7ec0 - <unknown>
  31:     0x7fa3effc7eb0 - rust_try
  32:     0x7fa3eff75ed0 - unwind::try::hbe9a6258c56c4daahXd
  33:     0x7fa3eff75c70 - task::Task::run::hf1f50bebcf947c0cT4c
  34:     0x7fa3f02d1b20 - <unknown>
  35:     0x7fa3eff77ab0 - <unknown>
  36:     0x7fa3eadca000 - start_thread
  37:     0x7fa3efc47269 - clone
  38:                0x0 - <unknown>

Version

rustc 0.12.0-pre (8a02304a4 2014-08-07 11:31:05 +0000)

Similar ICE message/backtrace to #15873 and #16218, but triggered differently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants