Skip to content


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

bblum opened this Issue · 3 comments

3 participants

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.


#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 ()
@catamorphism catamorphism was assigned

Nested items (including structs) shouldn't be allowed to capture ty params, so the bug is that the typechecker should be rejecting this.


Correction: resolve ought to be rejecting it.


Reproduced as of a477c5a

@catamorphism catamorphism was unassigned by bblum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.