Skip to content

ICE returning unique pointer #2059

Closed
Closed
@tedhorst

Description

@tedhorst
enum tree<T: copy> { nil, node(~tree<T>, ~tree<T>, T) }

fn tree_init<T: copy>() -> ~tree<T> {
    ~nil
}

fn tree_add<T: copy>(i: T, t: ~tree<T>) -> ~tree<T> {
    t
}

fn main() {
    let atree: ~tree<int> = tree_init();
    let btree = tree_add(1, atree);
    log(debug, btree);
}

This gives:

rust: task 102027e00 ran out of stack
error: internal compiler error unexpected failure

I got the following stack trace from lldb:

* thread #6: tid = 0x2403, 0x0000000100fdc2a4 librustrt.dylib`upcall_fail + 4 at rust_upcall.cpp:129, stop reason = breakpoint 1.1
    frame #0: 0x0000000100fdc2a4 librustrt.dylib`upcall_fail + 4 at rust_upcall.cpp:129
    frame #1: 0x00000001000055d2 rustc`monitor::_7bab36b8b67b44ab + 1634
    frame #2: 0x0000000100006d14 rustc`__morestack + 224
    frame #3: 0x0000000100004f9c rustc`monitor::_7bab36b8b67b44ab + 44
    frame #4: 0x00000001000066ea rustc`main::_6178e9efa23b8931 + 266
    frame #5: 0x0000000100fda1b5 librustrt.dylib`task_start_wrapper(spawn_args*) + 37 at rust_task.cpp:129

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-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