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

Internal compiler error related to sizing of unboxes closures #16791

Closed
TethysSvensson opened this issue Aug 27, 2014 · 2 comments
Closed

Internal compiler error related to sizing of unboxes closures #16791

TethysSvensson opened this issue Aug 27, 2014 · 2 comments
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@TethysSvensson
Copy link
Contributor

$ apt-cache policy rust-nightly && rustc -v verbose
rust-nightly:
  Installed: 201408270406~e61ec99~utopic
  Candidate: 201408270406~e61ec99~utopic
  Version table:
 *** 201408270406~e61ec99~utopic 0
        500 http://ppa.launchpad.net/hansjorg/rust/ubuntu/ utopic/main amd64 Packages
        100 /var/lib/dpkg/status
rustc 0.12.0-pre
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 0.12.0-pre
$ cat main.rs 
#![feature(unboxed_closures)]

pub fn foo<T>(val: &mut Box<FnOnce<(), T>>) {
  *val = (box |:| fail!()) as Box<FnOnce<(), T>>;
}

fn main() {
  foo::<uint>(fail!());
}
$ RUST_BACKTRACE=1 rustc main.rs 
error: internal compiler error: fictitious type T in sizing_type_of()
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 'Box<Any>', /build/buildd/rust-nightly-201408270406~e61ec99~utopic/src/libsyntax/ast_util.rs:776

stack backtrace:
   1:     0x7ffe660e1570 - rt::backtrace::imp::write::h7ecc632a9b3f8170c0q
   2:     0x7ffe660e4760 - <unknown>
   3:     0x7ffe668cb950 - unwind::begin_unwind_inner::he71f311595519d03Zie
   4:     0x7ffe648d48a0 - <unknown>
   5:     0x7ffe648d5210 - diagnostic::Handler::bug::h71a8332c712ab61fshF
   6:     0x7ffe66cb9480 - driver::session::Session::bug::h368ac7c552292ba9VWz
   7:     0x7ffe67082060 - middle::trans::type_of::sizing_type_of::h07776af08b7a3e8dna9
   8:     0x7ffe67093370 - middle::trans::common::type_is_immediate::h3c7174239cf11b44KK5
   9:     0x7ffe670f98c0 - middle::trans::type_of::type_of_rust_fn::hdd7ebcc9914412b5Y68
  10:     0x7ffe6710dfa0 - middle::trans::base::decl_rust_fn::h2c22481267fa98f9rwc
  11:     0x7ffe670a2f20 - middle::trans::closure::get_or_create_declaration_if_unboxed_closure::hf773d28cab905f70XQi
  12:     0x7ffe670cb090 - middle::trans::closure::trans_unboxed_closure::haa3242fe8e2e464boWi
  13:     0x7ffe670b2c60 - <unknown>
  14:     0x7ffe6706cdd0 - middle::trans::expr::trans_into::h63efa240a252a4b9js2
  15:     0x7ffe670beb30 - <unknown>
  16:     0x7ffe670bf750 - <unknown>
  17:     0x7ffe670b1d00 - <unknown>
  18:     0x7ffe6706e5a0 - middle::trans::expr::trans::h489987e1dd80e087fw2
  19:     0x7ffe670b1d00 - <unknown>
  20:     0x7ffe6706e5a0 - middle::trans::expr::trans::h489987e1dd80e087fw2
  21:     0x7ffe670b2c60 - <unknown>
  22:     0x7ffe670b1d00 - <unknown>
  23:     0x7ffe6706e5a0 - middle::trans::expr::trans::h489987e1dd80e087fw2
  24:     0x7ffe670b5510 - <unknown>
  25:     0x7ffe6706cdd0 - middle::trans::expr::trans_into::h63efa240a252a4b9js2
  26:     0x7ffe6706c280 - middle::trans::controlflow::trans_stmt_semi::hab7df555c62b5a36dlY
  27:     0x7ffe6706b950 - middle::trans::controlflow::trans_stmt::h2e9e6b84acdd95beWgY
  28:     0x7ffe6706d370 - middle::trans::controlflow::trans_block::hef69e6e8a650479d7lY
  29:     0x7ffe67122d00 - middle::trans::base::trans_closure::h7b69e84eff2769876xe
  30:     0x7ffe6705dda0 - middle::trans::base::trans_fn::h19628e9480b57bbaTJe
  31:     0x7ffe6705e3f0 - middle::trans::monomorphize::monomorphic_fn::h076aedfb221422245IX
  32:     0x7ffe67099040 - middle::trans::callee::trans_fn_ref_with_vtables::h39f7f4eaad71e3f2Wc1
  33:     0x7ffe67096710 - middle::trans::callee::trans_fn_ref::ha50314f0ad039cab4Y0
  34:     0x7ffe670a40a0 - <unknown>
  35:     0x7ffe670765c0 - middle::trans::callee::trans_call_inner::h10aebb5fe7685fdaLD1
  36:     0x7ffe670a3e30 - middle::trans::callee::trans_call::hc4f2c9ea0dad7130Qx1
  37:     0x7ffe670b2c60 - <unknown>
  38:     0x7ffe6706cdd0 - middle::trans::expr::trans_into::h63efa240a252a4b9js2
  39:     0x7ffe6706c280 - middle::trans::controlflow::trans_stmt_semi::hab7df555c62b5a36dlY
  40:     0x7ffe6706b950 - middle::trans::controlflow::trans_stmt::h2e9e6b84acdd95beWgY
  41:     0x7ffe6706d370 - middle::trans::controlflow::trans_block::hef69e6e8a650479d7lY
  42:     0x7ffe67122d00 - middle::trans::base::trans_closure::h7b69e84eff2769876xe
  43:     0x7ffe6705dda0 - middle::trans::base::trans_fn::h19628e9480b57bbaTJe
  44:     0x7ffe670590e0 - middle::trans::base::trans_item::h699a0ee17313c445T1e
  45:     0x7ffe6712d9c0 - middle::trans::base::trans_crate::hab4da120219fc0d5kWf
  46:     0x7ffe674ff480 - driver::driver::phase_4_translate_to_llvm::h070ebeccefe401090yy
  47:     0x7ffe674f6e30 - driver::driver::compile_input::hbae99ff27dbd49ferby
  48:     0x7ffe67588c50 - <unknown>
  49:     0x7ffe67588b60 - <unknown>
  50:     0x7ffe6759ade0 - <unknown>
  51:     0x7ffe6759abe0 - <unknown>
  52:     0x7ffe67fd75f0 - <unknown>
  53:     0x7ffe669241d0 - <unknown>
  54:     0x7ffe669241c0 - rust_try
  55:     0x7ffe668c8f80 - unwind::try::hcf3a6c26a049b912f7d
  56:     0x7ffe668c8d40 - task::Task::run::hb31a60d7e6df8450zdd
  57:     0x7ffe67fd7350 - <unknown>
  58:     0x7ffe668cab40 - <unknown>
  59:     0x7ffe65b780c0 - start_thread
  60:     0x7ffe66592359 - __clone
  61:                0x0 - <unknown>
@huonw huonw added O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-closures Area: Closures (`|…| { … }`) labels Sep 7, 2014
@huonw huonw removed the O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state label Sep 7, 2014
@aturon aturon mentioned this issue Oct 16, 2014
47 tasks
@bkoropoff
Copy link
Contributor

This seems to be due to the ty_unboxed_closure variant having no way to track substititions, resulting in monomorphization not working properly.

@bkoropoff
Copy link
Contributor

I'm working on plumbing Substs throughout the compiler for ty_unboxed_closure. It seems promising so far.

bkoropoff added a commit to bkoropoff/rust that referenced this issue Oct 28, 2014
bors added a commit that referenced this issue Oct 28, 2014
…osures, r=nikomatsakis

This allows unboxed closures that reference free type/region parameters to be monomorphized correctly in trans.

It was necessary to make `ty_unboxed_closure` carry around a `Substs` to accomplish this.  Plumbing this through typeck revealed several areas where type/region parameters in unboxed closure types are possibly not being handled correctly.  Since my goal was just to fix trans, I decided to leave FIXME comments on areas that still need attention and seek feedback on the best way to clean them up, possibly as a follow-up PR.

Closes #16791
@bors bors closed this as completed in f0cc3a9 Oct 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-closures Area: Closures (`|…| { … }`) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants