Closed
Description
The compiler goes into an infinite loop compiling this code (an incomplete finger tree implementation):
struct Digit<T> {
elem: T,
next: Option<Box<Digit<T>>>
}
enum Node<T> {
Node2(T, T),
Node3(T, T, T)
}
enum FingerTree<T> {
Empty,
Single(T),
Deep(Digit<T>, Box<FingerTree<Node<T>>>, Digit<T>)
}
impl <T> FingerTree<T> {
fn dequeue(&self, elem: T) -> FingerTree<T> {
match self {
Empty => FingerTree::Single(elem)
}
}
}
fn main() {
let ft = FingerTree::Empty;
let ft2 = ft.dequeue(123);
}
Tested with latest nightly. I can also cause this to happen by pasting this into the box on the rust-lang homepage.