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

Closed
bblum opened this Issue Aug 17, 2012 · 3 comments

Projects

None yet

3 participants

@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 ()
@catamorphism catamorphism was assigned Aug 18, 2012
@catamorphism

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

@nikomatsakis

Correction: resolve ought to be rejecting it.

@catamorphism

Reproduced as of a477c5a

@catamorphism catamorphism was unassigned by bblum Jun 16, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment