Skip to content

ICE: assertion failed: ty::type_is_sized(bcx.tcx(), contents_ty) #16813

Closed
@ftxqxd

Description

@ftxqxd
fn main() {
    let _x: Box<str> = box *"hello world";
    // or
    let array: &[int] = &[1, 2, 3];
    let _x: Box<[int]> = box *array;
}

Backtrace:

   1:     0x7f62f2541650 - rt::backtrace::imp::write::h181fa8e50bc89ce2c0q
   2:     0x7f62f2544840 - failure::on_fail::hba6871ae9bb311dcTlr
   3:     0x7f62f6a4a990 - unwind::begin_unwind_inner::hf3a56bcd81afe0e0Zie
   4:     0x7f62f709c9c0 - unwind::begin_unwind::h8240616298916404461
   5:     0x7f62f74b8d80 - middle::trans::expr::trans_uniq_expr::h317a2d92b749083dFM4
   6:     0x7f62f74b99a0 - middle::trans::expr::trans_unary::h22e5b651b1142eaeAI4
   7:     0x7f62f74ab830 - middle::trans::expr::trans_unadjusted::h150972cc252325afqn3
   8:     0x7f62f7466870 - middle::trans::expr::trans_into::hb63d23d59acc8215ty2
   9:     0x7f62f754e700 - middle::trans::_match::store_local::closure.119488
  10:     0x7f62f754e3f0 - middle::trans::_match::mk_binding_alloca::h12157238278011980296
  11:     0x7f62f7514e50 - middle::trans::_match::store_local::hd7189604ebb2e530Ici
  12:     0x7f62f7465ee0 - middle::trans::base::init_local::hcb5a26826102c0514Pd
  13:     0x7f62f74653f0 - middle::trans::controlflow::trans_stmt::hb5192738e53305174mY
  14:     0x7f62f7466e10 - middle::trans::controlflow::trans_block::h5c7f8178d7ae6df6fsY
  15:     0x7f62f751de20 - middle::trans::base::trans_closure::ha81c621565b1e345DIe
  16:     0x7f62f7457840 - middle::trans::base::trans_fn::hbcc99ce806591b4eqUe
  17:     0x7f62f7452b20 - middle::trans::base::trans_item::hd2607056928773e9qcf
  18:     0x7f62f7528ae0 - middle::trans::base::trans_crate::h7dbb2b5a9ea016b8R6f
  19:     0x7f62f78fd2f0 - driver::driver::phase_4_translate_to_llvm::hce3fce77484f9606iUy
  20:     0x7f62f78f4ca0 - driver::driver::compile_input::hf125f40590bf31f2Jwy
  21:     0x7f62f7987680 - driver::run_compiler::h1d4595c155add46fC3B
  22:     0x7f62f7987590 - driver::main_args::closure.138472
  23:     0x7f62f7999820 - task::TaskBuilder<S>::try_future::closure.139590
  24:     0x7f62f7999620 - task::TaskBuilder<S>::spawn_internal::closure.139567
  25:     0x7f62f6dae690 - task::spawn_opts::closure.8369
  26:     0x7f62f6aa37d0 - rust_try_inner
  27:     0x7f62f6aa37c0 - rust_try
  28:     0x7f62f6a47fc0 - unwind::try::h069fe54a754725e6f7d
  29:     0x7f62f6a47d80 - task::Task::run::h8e0b3c8b9f2bf003zdd
  30:     0x7f62f6dae3f0 - task::spawn_opts::closure.8315
  31:     0x7f62f6a49b80 - thread::thread_start::hf0ad07d9ecab4ed9lCd
  32:     0x7f62f18b80c0 - start_thread
  33:     0x7f62f6711359 - __clone
  34:                0x0 - <unknown>

This seemingly is caused by trans_uniq_expr assuming that the type being boxed is sized. This assertion is not present in the equivalent for &-pointers, trans_addr_of.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-DSTsArea: Dynamically-sized types (DSTs)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