Skip to content

Internal compiler error casting to trait type twice #3689

Closed
@ben0x539

Description

@ben0x539

I accidentally had something like stdout() as io::Writer and got an ICE, but it also happens with trivial traits/trait impls like this:

trait Foo {}
impl (): Foo {}

fn main() {
    let _a = () as Foo as Foo;
}

rustc just errors out with an unexpected failure, and says

rust: task failed at 'get_vtable: expected a static origin', /home/ben/code/repos/rust/src/rustc/middle/trans/meth.rs:507

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-trait-systemArea: Trait systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions