Skip to content

ICE instead of Sized error for impl method parameters. #20433

Closed
@jakevn

Description

@jakevn

This should produce "error: the trait core::kinds::Sized is not implemented for the type [i32]", instead, I get an ICE:

fn main() {}

struct The;

impl The {
    fn iceman(c: Vec<[i32]>) {}
}

Backtrace:

rust_ice.rs:3:1: 3:12 warning: struct is never used: `The`, #[warn(dead_code)] on by default
rust_ice.rs:3 struct The;
              ^~~~~~~~~~~
rust_ice.rs:6:5: 6:32 warning: method is never used: `iceman`, #[warn(dead_code)] on by default
rust_ice.rs:6     fn iceman(c: Vec<[i32]>) {}
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~
rust_ice.rs:6:15: 6:16 warning: unused variable: `c`, #[warn(unused_variables)] on by default
rust_ice.rs:6     fn iceman(c: Vec<[i32]>) {}
                            ^
rust_ice.rs:1:1: 1:1 error: internal compiler error: Encountered errors `[FulfillmentError(Obligation(trait_ref=Binder(TraitRef([i32], core::kinds::Sized)),depth=1),Unimplemented)]` fulfilling `Binder(TraitRef([[i32]], core::slice::SliceExt<[i32]>))` during trans
rust_ice.rs:1 fn main() {}
              ^
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:     0x7f33d482e4e0 - sys::backtrace::write::h3142c4f521aedc71P8s
   2:     0x7f33d484f020 - failure::on_fail::h96f6ace5c8bff0c9Epz
   3:     0x7f33d47c0e10 - rt::unwind::begin_unwind_inner::hc3999f9d372f7a58J3y
   4:     0x7f33cf873570 - rt::unwind::begin_unwind::h10111639098180125188
   5:     0x7f33cf8734f0 - diagnostic::SpanHandler::span_bug::hd6b9a1ea237fce23LQF
   6:     0x7f33d27559b0 - session::Session::span_bug::hbfb784398a3dc817Y4l
   7:     0x7f33d360b470 - trans::common::fulfill_obligation::hc8b7d0a0b224c7beizl
   8:     0x7f33d35a6560 - trans::meth::trans_method_callee::h9fd5be0400c5b65dqbz
   9:     0x7f33d35ccbd0 - trans::callee::trans_call_inner::h16444080059011058807
  10:     0x7f33d35d0940 - trans::expr::trans_rvalue_dps_unadjusted::hd93ea3e23b6c2193vYi
  11:     0x7f33d35cf560 - trans::expr::trans_unadjusted::h9822a6f091cedd27Uki
  12:     0x7f33d3591a50 - trans::expr::trans::hc23f1714b57b798fKAh
  13:     0x7f33d35d5e70 - trans::expr::trans_rvalue_stmt_unadjusted::h4c06468ef766281aYRi
  14:     0x7f33d3590750 - trans::expr::trans_into::hdec62f82c5c1d5019wh
  15:     0x7f33d358fb30 - trans::controlflow::trans_stmt_semi::h7929149b039128998Ud
  16:     0x7f33d3590e90 - trans::controlflow::trans_block::h439a055f0a2397541Vd
  17:     0x7f33d35d0940 - trans::expr::trans_rvalue_dps_unadjusted::hd93ea3e23b6c2193vYi
  18:     0x7f33d3590750 - trans::expr::trans_into::hdec62f82c5c1d5019wh
  19:     0x7f33d3590e90 - trans::controlflow::trans_block::h439a055f0a2397541Vd
  20:     0x7f33d35d0940 - trans::expr::trans_rvalue_dps_unadjusted::hd93ea3e23b6c2193vYi
  21:     0x7f33d3590750 - trans::expr::trans_into::hdec62f82c5c1d5019wh
  22:     0x7f33d3590e90 - trans::controlflow::trans_block::h439a055f0a2397541Vd
  23:     0x7f33d364e270 - trans::base::trans_closure::h0a77e4babef06f2ejSt
  24:     0x7f33d3585470 - trans::base::trans_fn::h78e6b504f6ce26bd32t
  25:     0x7f33d35858c0 - trans::monomorphize::monomorphic_fn::h932c2ca429c3e656Epd
  26:     0x7f33d35b5b70 - trans::glue::trans_struct_drop::hc85c5f219467a8cfaJe
  27:     0x7f33d35b3b10 - trans::glue::make_drop_glue::h9ea0c98eca42a660IZe
  28:     0x7f33d35b0220 - trans::glue::get_drop_glue::hf1e9b42d29872e2fOBe
  29:     0x7f33d35a6040 - trans::glue::drop_ty::hff66dc301707979bCxe
  30:     0x7f33d36c32a0 - trans::cleanup::DropValue<$u{27}tcx$GT$.Cleanup$LT$$u{27}tcx$GT$::trans::he0bbb5b7434ed53eRvL
  31:     0x7f33d35a5d10 - trans::cleanup::FunctionContext<$u{27}blk$C$$u{20}$u{27}tcx$GT$.CleanupMethods$LT$$u{27}blk$C$$u{20}$u{27}tcx$GT$::pop_and_trans_custom_cleanup_scope::h72817269f5bff9e4KwK
  32:     0x7f33d364e270 - trans::base::trans_closure::h0a77e4babef06f2ejSt
  33:     0x7f33d3585470 - trans::base::trans_fn::h78e6b504f6ce26bd32t
  34:     0x7f33d35808c0 - trans::base::trans_item::ha2393d33c104fcefVnu
  35:     0x7f33d36560a0 - trans::base::trans_crate::hc993063bff48abcd4iv
  36:     0x7f33d4d8be20 - driver::phase_4_translate_to_llvm::h67031b086b8a7b50mDa
  37:     0x7f33d4d60130 - driver::compile_input::h90e0b2585828e67dwba
  38:     0x7f33d4f2ee30 - thunk::F.Invoke<A,$u{20}R$GT$::invoke::h10327424606084347905
  39:     0x7f33d4f2d540 - rt::unwind::try::try_fn::h7262054690848404912
  40:     0x7f33d48b4970 - rust_try_inner
  41:     0x7f33d48b4960 - rust_try
  42:     0x7f33d4f2d850 - thunk::F.Invoke<A,$u{20}R$GT$::invoke::h10390161790289041717
  43:     0x7f33d483e600 - sys::thread::thread_start::h3a59f8e8259d23afK1v
  44:     0x7f33cf077fe0 - start_thread
  45:     0x7f33d4468749 - __clone
  46:                0x0 - <unknown>

Playpen: http://is.gd/IorwwY

Note that this also produces an ICE in 0.12.

Rustc version:
rustc 0.13.0-nightly (636663172 2014-12-28 16:21:58 +0000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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