2 // compile-flags:-C overflow-checks=off
3 // normalize-stderr-test: ".nll/" -> "/"
6 struct Cons<T> {head:isize, tail:T}
7 trait Dot {fn dot(&self, other:Self) -> isize;}
9 fn dot(&self, _:Nil) -> isize {0}
11 impl<T:Dot> Dot for Cons<T> {
12 fn dot(&self, other:Cons<T>) -> isize {
13 self.head * other.head + self.tail.dot(other.tail)
16 fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize {
17 match n { 0 => {first.dot(second)}
18 _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
19 //~^ ERROR recursion limit
23 let n = test(1, 0, Nil::NilValue, Nil::NilValue);