Skip to content

ICE if generic destructor invokes a method on self ("vtables missing where they are needed") #4252

Closed
@tychosci

Description

@tychosci

xyz.rs:

trait X {
    fn call(&self);
}

struct Y;
struct Z<T: X> {
    x: T
}

impl Y: X {
    fn call(&self) {
    }
}

impl<T: X> Z<T>: Drop {
    fn finalize(&self) {
        self.x.call(); // Adding this statement causes an ICE.
    }
}

fn main() {
    let y = Y;
    let _z = Z{x: y};
}

$ RUST_LOG=rustc=1,::rt::backtrace rustc xyz.rs
rust: task failed at 'option::get none', /Users/tychosci/pkg/rust/src/librustc/rustc.rc:1
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/tychosci/pkg/rust/src/librustc/rustc.rc:425
rust: domain main @0x7feecb000010 root task failed
rust: task failed at 'killed', /Users/tychosci/pkg/rust/src/libcore/task/mod.rs:570

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-destructorsArea: Destructors (`Drop`, …)A-trait-systemArea: Trait systemI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions