Skip to content
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

ICE: 'assertion failed: ty::type_is_sized(bcx.tcx(), contents_ty)', /home/laumann/rustlang/src/librustc/middle/trans/expr.rs:1556 #17651

Closed
laumann opened this issue Sep 30, 2014 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@laumann
Copy link
Contributor

laumann commented Sep 30, 2014

enum AnEnum {
    Something(Box<[u8]>)
}

fn main() {
    let buf = [0u8, ..1024];

    let (tx, rx) = channel();
    spawn(proc() {
        tx.send(Something(box *buf.slice(0, 10)));
    });

    let _smth = rx.recv();
}

Compilation backtrace

> RUST_BACKTRACE=1 rustc bug-report.rs                                                                               ~/rust@sneglzilla
error: internal compiler error: unexpected failure
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 'assertion failed: ty::type_is_sized(bcx.tcx(), contents_ty)', /home/laumann/rustlang/src/librustc/middle/trans/expr.rs:1556

stack backtrace:
   1:     0x7fce2e68b7f0 - rt::backtrace::imp::write::h18da00e3fa21aa27UVq
   2:     0x7fce2e68e980 - failure::on_fail::hf0bf9ceb951d492amhr
   3:     0x7fce32c0e070 - unwind::begin_unwind_inner::h6b7f27e30df90d49SUd
   4:     0x7fce3325f3d0 - unwind::begin_unwind::h11203309285505231177
   5:     0x7fce3364dff0 - middle::trans::expr::trans_uniq_expr::hf654a567423fe43f8T4
   6:     0x7fce3364eb00 - middle::trans::expr::trans_unary::hf911da575068b68f2P4
   7:     0x7fce33643e80 - middle::trans::expr::trans_unadjusted::hccc8ccb9a94a90ec2v3
   8:     0x7fce33607cd0 - middle::trans::expr::trans_into::h6cee4eb39aeb67db4K2
   9:     0x7fce33659160 - middle::trans::expr::trans_adt::hf361baf5d06d970aaH4
  10:     0x7fce3363c5b0 - middle::trans::base::trans_named_tuple_constructor::hef48ebcafb37b2f3Cdf
  11:     0x7fce3360fae0 - middle::trans::callee::trans_call_inner::h6360d135c41f8588V01
  12:     0x7fce336368c0 - middle::trans::callee::trans_call::hbcb2abdb833634a2gV1
  13:     0x7fce336452e0 - middle::trans::expr::trans_rvalue_dps_unadjusted::ha391dd13a949111bd93
  14:     0x7fce33643e80 - middle::trans::expr::trans_unadjusted::hccc8ccb9a94a90ec2v3
  15:     0x7fce336092a0 - middle::trans::expr::trans::heb5629bc9dc8455bYO2
  16:     0x7fce3363cd20 - middle::trans::callee::trans_args::hfb38277828a15ad7Sl2
  17:     0x7fce3360fae0 - middle::trans::callee::trans_call_inner::h6360d135c41f8588V01
  18:     0x7fce33637580 - middle::trans::callee::trans_method_call::h045a13573e018f1coW1
  19:     0x7fce336452e0 - middle::trans::expr::trans_rvalue_dps_unadjusted::ha391dd13a949111bd93
  20:     0x7fce33607cd0 - middle::trans::expr::trans_into::h6cee4eb39aeb67db4K2
  21:     0x7fce336070a0 - middle::trans::controlflow::trans_stmt_semi::hb02369797d17f5e1fRY
  22:     0x7fce33606650 - middle::trans::controlflow::trans_stmt::h5279c34802b7a3172MY
  23:     0x7fce33608160 - middle::trans::controlflow::trans_block::h5bbf02ac441333a58RY
  24:     0x7fce336452e0 - middle::trans::expr::trans_rvalue_dps_unadjusted::ha391dd13a949111bd93
  25:     0x7fce33607cd0 - middle::trans::expr::trans_into::h6cee4eb39aeb67db4K2
  26:     0x7fce33608160 - middle::trans::controlflow::trans_block::h5bbf02ac441333a58RY
  27:     0x7fce336b3b00 - middle::trans::base::trans_closure::h2de5277f401e7e0eSXe
  28:     0x7fce3365a640 - middle::trans::closure::trans_expr_fn::h38a72da08133e093k4i
  29:     0x7fce336452e0 - middle::trans::expr::trans_rvalue_dps_unadjusted::ha391dd13a949111bd93
  30:     0x7fce33643e80 - middle::trans::expr::trans_unadjusted::hccc8ccb9a94a90ec2v3
  31:     0x7fce336092a0 - middle::trans::expr::trans::heb5629bc9dc8455bYO2
  32:     0x7fce3363cd20 - middle::trans::callee::trans_args::hfb38277828a15ad7Sl2
  33:     0x7fce3360fae0 - middle::trans::callee::trans_call_inner::h6360d135c41f8588V01
  34:     0x7fce336368c0 - middle::trans::callee::trans_call::hbcb2abdb833634a2gV1
  35:     0x7fce336452e0 - middle::trans::expr::trans_rvalue_dps_unadjusted::ha391dd13a949111bd93
  36:     0x7fce33607cd0 - middle::trans::expr::trans_into::h6cee4eb39aeb67db4K2
  37:     0x7fce336070a0 - middle::trans::controlflow::trans_stmt_semi::hb02369797d17f5e1fRY
  38:     0x7fce33606650 - middle::trans::controlflow::trans_stmt::h5279c34802b7a3172MY
  39:     0x7fce33608160 - middle::trans::controlflow::trans_block::h5bbf02ac441333a58RY
  40:     0x7fce336b3b00 - middle::trans::base::trans_closure::h2de5277f401e7e0eSXe
  41:     0x7fce335fa1b0 - middle::trans::base::trans_fn::h8818c59c3b560decg9e
  42:     0x7fce335f76c0 - middle::trans::base::trans_item::hbdab4d8b520880d6zsf
  43:     0x7fce336bee00 - middle::trans::base::trans_crate::h8dc93a451eb88c6ePsg
  44:     0x7fce33ab8bf0 - driver::driver::phase_4_translate_to_llvm::hae0d2e943d04f1f7bZw
  45:     0x7fce33ab04c0 - driver::driver::compile_input::hd932c63f3dc5f11b9vw
  46:     0x7fce33b31c80 - driver::run_compiler::ha2ce4a245eb2a747dmA
  47:     0x7fce33b31b60 - driver::main_args::closure.146353
  48:     0x7fce33295bf0 - task::TaskBuilder<S>::try_future::closure.101568
  49:     0x7fce332959e0 - task::TaskBuilder<S>::spawn_internal::closure.101539
  50:     0x7fce32f676d0 - task::spawn_opts::closure.8494
  51:     0x7fce32c6e220 - rust_try_inner
  52:     0x7fce32c6e210 - rust_try
  53:     0x7fce32c0b200 - unwind::try::he73fe587a864f313AJd
  54:     0x7fce32c0b090 - task::Task::run::h3386e28ab4ecfaf2UYc
  55:     0x7fce32f67440 - task::spawn_opts::closure.8434
  56:     0x7fce32c0d110 - thread::thread_start::h86c5236ebccc312cpjd
  57:     0x7fce2da36250 - start_thread
  58:     0x7fce328e43b9 - clone
  59:                0x0 - <unknown>

Version

> rustc --version
rustc 0.12.0-dev (740905042 2014-09-29 23:52:21 +0000)

Seems to be very similar to #16813 and #17118, but the difference is trying to send the value over a channel (removing this gives a "cannot move a value of type [u8]: the size of [u8] cannot be statically determined)

@kmcallister kmcallister added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Oct 1, 2014
@laumann
Copy link
Contributor Author

laumann commented Oct 12, 2014

Just to update after the 0.12 release. I tried compiling the above example and am getting the same result (so this issue is still relevant).

> rustc --version=verbose
rustc 0.13.0-dev (86509d8d7 2014-10-12 02:22:14 +0000)
binary: rustc
commit-hash: 86509d8d7ab68c5e4202dea9ff1bfb79409f2f8d
commit-date: 2014-10-12 02:22:14 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev

@bkoropoff
Copy link
Contributor

Reduced test case:

fn main() {
    (|| { box *([0u].as_slice()) })();
}

Something about the closure lets it get past type checking when it shouldn't.

@bkoropoff
Copy link
Contributor

This looks simple, I'll hopefully have a PR shortly.

bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 12, 2014
This correctly catches moves of unsized values in nested
functions and closures.

Closes issue rust-lang#17651
bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 12, 2014
@alexcrichton
Copy link
Member

Closed by #17984

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

No branches or pull requests

4 participants