Skip to content

Segfault when calling a method on an owned box cast to a trait and passed to another task #5882

Closed
@mzabaluev

Description

@mzabaluev

This program compiles successfully, but segfaults:

trait A {
    fn f(&self);
}

struct B;

impl A for B {
    fn f(&self) {
    }
}

fn main() {
    let a = ~B as ~A;
    do spawn {
        a.f();
    }
}

The crash occurs in a generated thunk opaque to gdb:

#0  0x080494cb in glue_drop_2597 ()
#1  0x08048bc4 in main () at unsafe-owned.rs:15
#2  0x08048c10 in _rust_main () at unsafe-owned.rs:15
#3  0xb7495d01 in task_start_wrapper (a=0x9c4663c)
    at /home/mzabaluev/src/rust/src/rt/rust_task.cpp:162

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions