Skip to content

ICE returning unboxed closure #16672

Closed
Closed
@pfalabella

Description

@pfalabella

I get an ICE when trying to compile the following:

#![feature(unboxed_closures)]

fn main() {
    let f = |&: x: uint| x.to_string();
    let bar = foo(f);
    println!("{}", bar.call((1,)));
}

fn foo<A, B, F: Fn<(A,) ,B>>(f: F) -> Box<Fn<(A,) ,B>> {
   ( box |&: x: A| f.call((x,))) as Box<Fn<(A,) ,B>>
}

the ICE:

error: internal compiler error: fictitious type ty_param(middle::ty::ParamTy{space: FnSpace, idx: 2u, def_id: syntax::ast::DefId{krate: 0u32, node: 98u32}}) 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>', C:\bot\slave\nightly-win\build\src\libsyntax\ast_util.rs:776

Rust version:

$ rustc -v
rustc 0.12.0-pre-nightly (4dfdc697e 2014-08-21 00:51:00 +0000)

maybe related to #13970 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-closuresArea: Closures (`|…| { … }`)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