Skip to content

ICE: &[str] in function signature #25470

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
coventry opened this issue May 16, 2015 · 3 comments
Closed

ICE: &[str] in function signature #25470

coventry opened this issue May 16, 2015 · 3 comments

Comments

@coventry
Copy link

In lib.rs, I have:

fn testfn(s: &[str]) -> u32 {
    return 1;
}
coventry@uppekha:/tmp/test$ RUST_BACKTRACE=1 cargo test --verbose
   Compiling test v0.1.0 (file:///tmp/test)
     Running `rustc src/lib.rs --crate-name test --crate-type lib -g --test -C metadata=3649b7b644aa8a1f -C extra-filename=-3649b7b644aa8a1f --out-dir /tmp/test/target/debug --emit=dep-info,link -L dependency=/tmp/test/target/debug -L dependency=/tmp/test/target/debug/deps`
     Running `rustc src/lib.rs --crate-name test --crate-type lib -g --out-dir /tmp/test/target/debug --emit=dep-info,link -L dependency=/tmp/test/target/debug -L dependency=/tmp/test/target/debug/deps`
src/lib.rs:1:1: 3:2 warning: function is never used: `testfn`, #[warn(dead_code)] on by default
src/lib.rs:1 fn testfn(s: &[str]) -> u32 {
src/lib.rs:2     return 1;
src/lib.rs:3 }
src/lib.rs:1:11: 1:12 warning: unused variable: `s`, #[warn(unused_variables)] on by default
src/lib.rs:1 fn testfn(s: &[str]) -> u32 {
                       ^
src/lib.rs:1:1: 3:2 warning: function is never used: `testfn`, #[warn(dead_code)] on by default
src/lib.rs:1 fn testfn(s: &[str]) -> u32 {
src/lib.rs:2     return 1;
src/lib.rs:3 }
src/lib.rs:1:11: 1:12 warning: unused variable: `s`, #[warn(unused_variables)] on by default
src/lib.rs:1 fn testfn(s: &[str]) -> u32 {
                       ^
error: internal compiler error: error: internal compiler error: unexpected panicunexpected 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
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: slice_layout_is_correct(cx, &member_llvm_types[..], element_type)', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_trans/trans/debuginfo.rs:2810

stack backtrace:
   1:     0x7f865b62f449 - sys::backtrace::write::hbc46dc0cfb3b9537d4r
   2:     0x7f865b637156 - panicking::on_panic::h74d3c14d86c58ac8jrw
   3:     0x7f865b5fa462 - rt::unwind::begin_unwind_inner::h382cea404b11eb00t6v
   4:     0x7f865acf137e - rt::unwind::begin_unwind::h11527883117899559464
   5:     0x7f865adf2f33 - trans::debuginfo::vec_slice_metadata::hf94e0b5f0c2f2a50cgy
   6:     0x7f865adde7fc - trans::debuginfo::type_metadata::h61fa8cb587a59ac0Ioy
   7:     0x7f865adf34c0 - trans::debuginfo::subroutine_type_metadata::h0a8adba26e117853iky
   8:     0x7f865adde1d4 - trans::debuginfo::type_metadata::h61fa8cb587a59ac0Ioy
   9:     0x7f865ad4a8b6 - trans::debuginfo::create_function_debug_context::hce33e3e89c0b549eG0w
  10:     0x7f865ad48d16 - trans::base::new_fn_ctxt::hc47263521fb5ebc7Djh
  11:     0x7f865ad51f10 - trans::base::trans_closure::h8e5687f4ccb96c5eLCh
  12:     0x7f865ad560ea - trans::base::trans_fn::h0bc8fb6dbe17d6adtNh
  13:     0x7f865ad59177 - trans::base::trans_item::h4f9c99b1e4474396Fbi
  14:     0x7f865ad6756d - trans::base::trans_crate::haa02506df24d5efcF0i
  15:     0x7f865bb7d0fa - driver::phase_4_translate_to_llvm::h86d6fb84c5c936d5hOa
  16:     0x7f865bb54faa - driver::compile_input::hb78754f2f33c01efQba
  17:     0x7f865bc164d1 - run_compiler::h258d36d5501c1cdfz4b
  18:     0x7f865bc14122 - boxed::F.FnBox<A>::call_box::h7239693171334256553
  19:     0x7f865bc13659 - rt::unwind::try::try_fn::h14329119008520845439
  20:     0x7f865b6a9ac8 - rust_try_inner
  21:     0x7f865b6a9ab5 - rust_try
  22:     0x7f865bc13908 - boxed::F.FnBox<A>::call_box::h17332056298259451807
  23:     0x7f865b636041 - sys::thread::create::thread_start::h490278b5c3c0b49faqv
  24:     0x7f8655eb8181 - start_thread
  25:     0x7f865b28047c - __clone
  26:                0x0 - <unknown>


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
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'assertion failed: slice_layout_is_correct(cx, &member_llvm_types[..], element_type)', /home/rustbuild/src/rust-buildbot/slave/stable-dist-rustc-linux/build/src/librustc_trans/trans/debuginfo.rs:2810

stack backtrace:
   1:     0x7fc298dfd449 - sys::backtrace::write::hbc46dc0cfb3b9537d4r
   2:     0x7fc298e05156 - panicking::on_panic::h74d3c14d86c58ac8jrw
   3:     0x7fc298dc8462 - rt::unwind::begin_unwind_inner::h382cea404b11eb00t6v
   4:     0x7fc2984bf37e - rt::unwind::begin_unwind::h11527883117899559464
   5:     0x7fc2985c0f33 - trans::debuginfo::vec_slice_metadata::hf94e0b5f0c2f2a50cgy
   6:     0x7fc2985ac7fc - trans::debuginfo::type_metadata::h61fa8cb587a59ac0Ioy
   7:     0x7fc2985c14c0 - trans::debuginfo::subroutine_type_metadata::h0a8adba26e117853iky
   8:     0x7fc2985ac1d4 - trans::debuginfo::type_metadata::h61fa8cb587a59ac0Ioy
   9:     0x7fc2985188b6 - trans::debuginfo::create_function_debug_context::hce33e3e89c0b549eG0w
  10:     0x7fc298516d16 - trans::base::new_fn_ctxt::hc47263521fb5ebc7Djh
  11:     0x7fc29851ff10 - trans::base::trans_closure::h8e5687f4ccb96c5eLCh
  12:     0x7fc2985240ea - trans::base::trans_fn::h0bc8fb6dbe17d6adtNh
  13:     0x7fc298527177 - trans::base::trans_item::h4f9c99b1e4474396Fbi
  14:     0x7fc29853556d - trans::base::trans_crate::haa02506df24d5efcF0i
  15:     0x7fc29934b0fa - driver::phase_4_translate_to_llvm::h86d6fb84c5c936d5hOa
  16:     0x7fc299322faa - driver::compile_input::hb78754f2f33c01efQba
  17:     0x7fc2993e44d1 - run_compiler::h258d36d5501c1cdfz4b
  18:     0x7fc2993e2122 - boxed::F.FnBox<A>::call_box::h7239693171334256553
  19:     0x7fc2993e1659 - rt::unwind::try::try_fn::h14329119008520845439
  20:     0x7fc298e77ac8 - rust_try_inner
  21:     0x7fc298e77ab5 - rust_try
  22:     0x7fc2993e1908 - boxed::F.FnBox<A>::call_box::h17332056298259451807
  23:     0x7fc298e04041 - sys::thread::create::thread_start::h490278b5c3c0b49faqv
  24:     0x7fc293686181 - start_thread
  25:     0x7fc298a4e47c - __clone
  26:                0x0 - <unknown>

Build failed, waiting for other jobs to finish...
Could not compile `test`.

Caused by:
  Process didn't exit successfully: `rustc src/lib.rs --crate-name test --crate-type lib -g --out-dir /tmp/test/target/debug --emit=dep-info,link -L dependency=/tmp/test/target/debug -L dependency=/tmp/test/target/debug/deps` (exit code: 101)
coventry@uppekha:/tmp/test$ 

Changing the signature of s to &[&str] results in compilation without error.

@Stebalien
Copy link
Contributor

dup of #24707

@arielb1
Copy link
Contributor

arielb1 commented May 16, 2015

cc #25470

@coventry
Copy link
Author

Closing as a dupe, then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants