Skip to content

Segementation fault when calling a method #39292

Closed
@ulysseB

Description

@ulysseB

The following code generates a segfault when executed.

trait Foo<T> {
    fn print<'a>(&'a self) where T: 'a { println!("foo"); }
}

impl<'a> Foo<&'a ()> for () { }

trait Bar: for<'a> Foo<&'a ()> { }

impl Bar for () {}

fn main() {
    (&() as &Bar).print(); // Segfault
}

rust version:

rustc 1.16.0-nightly (9761b17d5 2017-01-21)
binary: rustc
commit-hash: 9761b17d558d0c980d4d2d5a0baba54f2bc6b63a
commit-date: 2017-01-21
host: x86_64-unknown-linux-gnu
release: 1.16.0-nightly
LLVM version: 3.9

Metadata

Metadata

Assignees

Labels

I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-highHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions