]> git.lizzy.rs Git - rust.git/commit
auto merge of #11839 : typelist/rust/issue3008, r=huonw
authorbors <bors@rust-lang.org>
Thu, 30 Jan 2014 06:21:29 +0000 (22:21 -0800)
committerbors <bors@rust-lang.org>
Thu, 30 Jan 2014 06:21:29 +0000 (22:21 -0800)
commit056363ff362231c6e78543290bbc5c151b899f3d
treee98d7598b4bf62311246fb0b090e5d24e4aede3c
parent3cb72a3655cdbe1db7a3555ade0c909d541bf336
parent8d097b3bfb7af5c171f0177720e7388a294081e9
auto merge of #11839 : typelist/rust/issue3008, r=huonw

It was possible to trigger a stack overflow in rustc because the routine used to verify enum representability,
type_structurally_contains, would recurse on inner types until hitting the original type. The overflow condition was when a different structurally recursive type (enum or struct) was contained in the type being checked.

I suspect my solution isn't as efficient as it could be. I pondered adding a cache of previously-seen types to avoid duplicating work (if enums A and B both contain type C, my code goes through C twice), but I didn't want to do anything that may not be necessary.

I'm a new contributor, so please pay particular attention to any unidiomatic code, misuse of terminology, bad naming of tests, or similar horribleness :)

Updated to verify struct representability as well.

Fixes #3008.
Fixes #3779.