Skip to content

'rustc' panicked at 'assertion failed: slice_layout_is_correct #27819

Closed
@jc00ke

Description

@jc00ke

caveat This is my first bit of Rust and I don't know what I'm doing 😉

This is from the anagram exercism.io exercise.

rustc 1.2.0 (082e47636 2015-08-03)

// src/lib.rs
pub fn anagrams_for(input: String, inputs: &[str]) -> Vec<&str> {
    //vec![]; // either this line or the following crashes the compiler
    Vec::new()
}
// test/anagram.rs
extern crate anagram;

#[test]
fn test_no_matches() {
    let inputs = ["hello", "world", "zombies", "pants"];
    let outputs: Vec<&str> = vec![];
    assert_eq!(anagram::anagrams_for("diaper", &inputs), outputs);
}
 ✘  ~/p/e/r/anagram  env RUST_BACKTRACE=1 cargo test                                                                                                                                [42/1878]
   Compiling anagram v0.0.0 (file:///home/jesse/projects/exercism/rust/anagram)
src/lib.rs:1:21: 1:26 warning: unused variable: `input`, #[warn(unused_variables)] on by default
src/lib.rs:1 pub fn anagrams_for(input: String, inputs: &[str]) -> Vec<&str> {
                                 ^~~~~
src/lib.rs:1:36: 1:42 warning: unused variable: `inputs`, #[warn(unused_variables)] on by default
src/lib.rs:1 pub fn anagrams_for(input: String, inputs: &[str]) -> Vec<&str> {
                                                ^~~~~~
src/lib.rs:1:21: 1:26 warning: unused variable: `input`, #[warn(unused_variables)] on by default
src/lib.rs:1 pub fn anagrams_for(input: String, inputs: &[str]) -> Vec<&str> {
                                 ^~~~~
src/lib.rs:1:36: 1:42 warning: unused variable: `inputs`, #[warn(unused_variables)] on by default
src/lib.rs:1 pub fn anagrams_for(input: String, inputs: &[str]) -> Vec<&str> {
                                                ^~~~~~
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/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'assertion failed: slice_layout_is_correct(cx, &member_llvm_types[..], element_type)', ../src/librustc_trans/trans/debuginfo/metadata.rs:578

stack backtrace:
   1:     0x7ff96f530c4e - sys::backtrace::write::h31b60a04d5b9a81ckqs
   2:     0x7ff96f538af4 - panicking::on_panic::haca2ec19b0bb0f31B8w
   3:     0x7ff96f4fb63e - rt::unwind::begin_unwind_inner::h384bd76ff13d8e66fOw
   4:     0x7ff96e293621 - rt::unwind::begin_unwind::h15718610102880726541
   5:     0x7ff96e376582 - trans::debuginfo::metadata::vec_slice_metadata::h8832f07417ebf4b9Erx
   6:     0x7ff96e373fa6 - trans::debuginfo::metadata::type_metadata::hcf538bf9e35f8f3eZzx
   7:     0x7ff96e3780e0 - trans::debuginfo::metadata::subroutine_type_metadata::h2880dec6745c8f31Kvx
   8:     0x7ff96e3739c9 - trans::debuginfo::metadata::type_metadata::hcf538bf9e35f8f3eZzx
   9:     0x7ff96e2e847a - trans::debuginfo::create_function_debug_context::ha597308c509cb8feDFz
  10:     0x7ff96e2e6e44 - trans::base::new_fn_ctxt::ha6c42323ccb9337bkEh
  11:     0x7ff96e2ef966 - trans::base::trans_closure::h156dc0882252fa829Zh
  12:     0x7ff96e2f4137 - trans::base::trans_fn::hdf4d8bfec748d8fdIai
  13:     0x7ff96e2f70ef - trans::base::trans_item::h1aca2e2c0a402055Yyi
  14:     0x7ff96e304198 - trans::base::trans_crate::h0af30d7c2fe5d7984mj
  15:     0x7ff96fa9cf0e - driver::phase_4_translate_to_llvm::h4cc021d1bd4d13e70Oa
  16:     0x7ff96fa97946 - driver::phase_3_run_analysis_passes::closure.15761
  17:     0x7ff96fa929da - middle::ty::with_ctxt::h6668214031915206547
  18:     0x7ff96fa8d797 - driver::phase_3_run_analysis_passes::h7079152999418445164
  19:     0x7ff96fa6fff6 - driver::compile_input::h68c27ba828e71325Tba
  20:     0x7ff96fb4caf3 - run_compiler::h21d74b88eec3fe3bx7b
  21:     0x7ff96fb4a4ce - boxed::F.FnBox<A>::call_box::h16056439662428537931
  22:     0x7ff96fb49d19 - rt::unwind::try::try_fn::h6148543393464578718
  23:     0x7ff96f5b0e58 - rust_try_inner
  24:     0x7ff96f5b0e45 - rust_try
  25:     0x7ff96f523ec7 - rt::unwind::try::inner_try::h472293c152f3b97e8Jw
  26:     0x7ff96fb49f2b - boxed::F.FnBox<A>::call_box::h18323747056190398050
  27:     0x7ff96f537751 - sys::thread::Thread::new::thread_start::hed666015e7925bf95Tv
  28:     0x7ff969b976a9 - start_thread
  29:     0x7ff96f189eec - clone
  30:                0x0 - <unknown>

Build failed, waiting for other jobs to finish...
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/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'assertion failed: slice_layout_is_correct(cx, &member_llvm_types[..], element_type)', ../src/librustc_trans/trans/debuginfo/metadata.rs:578

stack backtrace:
   1:     0x7faa52844c4e - sys::backtrace::write::h31b60a04d5b9a81ckqs
   2:     0x7faa5284caf4 - panicking::on_panic::haca2ec19b0bb0f31B8w
   3:     0x7faa5280f63e - rt::unwind::begin_unwind_inner::h384bd76ff13d8e66fOw
   4:     0x7faa515a7621 - rt::unwind::begin_unwind::h15718610102880726541
   5:     0x7faa5168a582 - trans::debuginfo::metadata::vec_slice_metadata::h8832f07417ebf4b9Erx
   6:     0x7faa51687fa6 - trans::debuginfo::metadata::type_metadata::hcf538bf9e35f8f3eZzx
   7:     0x7faa5168c0e0 - trans::debuginfo::metadata::subroutine_type_metadata::h2880dec6745c8f31Kvx
   8:     0x7faa516879c9 - trans::debuginfo::metadata::type_metadata::hcf538bf9e35f8f3eZzx
   9:     0x7faa515fc47a - trans::debuginfo::create_function_debug_context::ha597308c509cb8feDFz
  10:     0x7faa515fae44 - trans::base::new_fn_ctxt::ha6c42323ccb9337bkEh
  11:     0x7faa51603966 - trans::base::trans_closure::h156dc0882252fa829Zh
  12:     0x7faa51608137 - trans::base::trans_fn::hdf4d8bfec748d8fdIai
  13:     0x7faa5160b0ef - trans::base::trans_item::h1aca2e2c0a402055Yyi
  14:     0x7faa51618198 - trans::base::trans_crate::h0af30d7c2fe5d7984mj
  15:     0x7faa52db0f0e - driver::phase_4_translate_to_llvm::h4cc021d1bd4d13e70Oa
  16:     0x7faa52dab946 - driver::phase_3_run_analysis_passes::closure.15761
  17:     0x7faa52da69da - middle::ty::with_ctxt::h6668214031915206547
  18:     0x7faa52da1797 - driver::phase_3_run_analysis_passes::h7079152999418445164
  19:     0x7faa52d83ff6 - driver::compile_input::h68c27ba828e71325Tba
  20:     0x7faa52e60af3 - run_compiler::h21d74b88eec3fe3bx7b
  21:     0x7faa52e5e4ce - boxed::F.FnBox<A>::call_box::h16056439662428537931
  22:     0x7faa52e5dd19 - rt::unwind::try::try_fn::h6148543393464578718
  23:     0x7faa528c4e58 - rust_try_inner
  24:     0x7faa528c4e45 - rust_try
  25:     0x7faa52837ec7 - rt::unwind::try::inner_try::h472293c152f3b97e8Jw
  26:     0x7faa52e5df2b - boxed::F.FnBox<A>::call_box::h18323747056190398050
  27:     0x7faa5284b751 - sys::thread::Thread::new::thread_start::hed666015e7925bf95Tv
  28:     0x7faa4ceab6a9 - start_thread
  29:     0x7faa5249deec - clone
  30:                0x0 - <unknown>

Could not compile `anagram`.

To learn more, run the command again with --verbose.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)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