Skip to content

Adding self parameter to trait causes code to segfault #4850

Closed
@mcpherrinm

Description

@mcpherrinm

The following snippet segfaults when run. Removing the "self" parameters to thingie makes it not segfault, but makes rustc tell me that form is deprecated.

pub trait TestTrait {
  fn thingie(self) -> ~[u8];
}

impl ~[u8]: TestTrait {
  fn thingie(self) -> ~[u8] {
    ~[0u8]
  }
}

fn main() {
  let n = ~[];
  n.thingie();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-trait-systemArea: Trait 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