Skip to content

ICE with polymorphic struct without <T> with destructor #3214

Closed
@bblum

Description

@bblum
fn foo<T>() {
    struct foo {
        mut x: T;
        drop { }
    }
}
fn main() { }

prints error: internal compiler error: type_of with ty_param

The workaround for this is easy - just write foo<T> to "thread the type variable through", as it were. I'm not sure if this should be permitted or error.

Backtrace:

#3  0x00007ffff5a03913 in driver::session::__extensions__::meth5509::bug ()
#4  0x00007ffff5a1311a in middle::trans::type_of::type_of ()
#5  0x00007ffff5a22abb in middle::trans::type_of::type_of::anon ()
#6  0x00007ffff5a229e5 in vec::map5905 ()
#7  0x00007ffff5a135d1 in middle::trans::type_of::type_of ()
#8  0x00007ffff5a71a43 in middle::trans::base::trans_class_dtor ()
#9  0x00007ffff5aa9eb1 in middle::trans::base::trans_struct_def ()
#10 0x00007ffff5a76b34 in middle::trans::base::trans_item ()
#11 0x00007ffff5a775c2 in middle::trans::base::trans_item ()
#12 0x00007ffff5ac884c in middle::trans::base::trans_crate ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyI-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