Skip to content

Segfault when using static with None values. #9056

Closed
@flaper87

Description

@flaper87
struct Test {
    m: Option<~str>
}

static DEFAULT: Test = Test{m: None};

struct Test2 {
    m: int
}

static DEFAULT2: Test2 = Test2{m: 1};

fn testing(a: Test) {
    println("Called");
}

fn testing2(a: Test2) {
    println("Called");
}

fn main() {
    testing2(DEFAULT2); // Prints
    testing(DEFAULT); //Segfault
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    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