Skip to content

Segfault with pattern guards, copy bindings, impls, and structs #3370

Closed
@pcwalton

Description

@pcwalton

This code causes a free of garbage memory and crashes:

struct Url {
    scheme: ~str,
    port: Option<~str>
}

impl Url {
    fn normalized_url(&self) {
        match self.port {
            Some(copy port) if true => {}
            _ => {}
        }
    }
}

fn main() {
    let url: Url = Url {
        scheme: ~"http",
        port: None,
    };
    url.normalized_url();
}

Doesn't seem to be related to explicit self. The pattern guard is necessary in order to cause the crash.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-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