Skip to content

ICE when default method relies on where clauses that object type does not satisfy #23435

Closed
@nikomatsakis

Description

@nikomatsakis

This is problem blocking #23300:

struct Foo {
    x: i32
}

trait Bar {
    fn bar(&self) where Self : Baz { self.baz(); }
}

trait Baz {
    fn baz(&self);
}

impl Bar for Foo {
}

fn main() {
    let x: &Bar = &Foo { x: 22 };
}

That example encounters an ICE when building the vtable of Bar for Foo. The problem is that the default method bar requires that Self:Baz, which is not true for Foo. This is ok, since it could never be called, but the trans code doesn't know that (yet!).

Metadata

Metadata

Assignees

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