Skip to content
This repository

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

Closed
bblum opened this Issue August 16, 2012 · 3 comments

3 participants

Ben Blum Tim Chevalier Niko Matsakis
Ben Blum
Collaborator
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 ()
Tim Chevalier
Collaborator

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

Niko Matsakis
Collaborator

Correction: resolve ought to be rejecting it.

Tim Chevalier
Collaborator

Reproduced as of a477c5a

Tim Chevalier catamorphism closed this in 7d84505 October 15, 2012
Jay Anderson jayanderson referenced this issue from a commit November 10, 2013
Commit has since been removed from the repository and is no longer available.
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.