Skip to content

LLVM Segmentation fault - destructuring newtype with closure #20174

@pfalabella

Description

@pfalabella

this code:

struct GradFn<F: Fn() -> uint>(F);

fn main() {
    let GradFn(x_squared) : GradFn<_> = GradFn(|| -> uint { 2u });
    let _  = x_squared();
}

ICEs with:

Global is external, but doesn't have external or weak linkage!
i64 (%closure*)* @_ZN4main19unboxed_closure.944E
invalid linkage type for function declaration
i64 (%closure*)* @_ZN4main19unboxed_closure.944E
LLVM ERROR: Broken module found, compilation aborted!
Segmentation fault
$ rustc --version --verbose
rustc 0.13.0-nightly (34d680009 2014-12-22 00:12:47 +0000)
binary: rustc
commit-hash: 34d680009205de2302b902d8f9f5f7ae7a042f1a
commit-date: 2014-12-22 00:12:47 +0000
host: x86_64-pc-windows-gnu
release: 0.13.0-nightly

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions