“overflow while adding drop-check rules” while implementing a fingertree

烂漫一生 提交于 2019-11-28 13:51:03

You have created an infinite type.

Instantiating FingerTree<V, A> instantiates FingerTree<V, Node<V, A>> which instantiates FingerTree<V, Node<V, Node<V, A>>> which instantiates, ... and there's no end in sight.

The compiler cannot tell that the type will not actually be used at run-time, so prepares itself for the worst. And the worst is infinite.

Simply replacing the type of tree by Box<FingerTree<V, A>> solves the issue, though it may not be correct for the situation at hand.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!