3 Add(&'a Ast<'a>, &'a Ast<'a>)
9 let z = Ast::Add(&x, &y);
13 fn compute(x: &Ast) -> usize {
16 Ast::Add(x, y) => { compute(x) + compute(y) }
20 fn map_nums<'a,'b, F>(x: &Ast, f: &mut F) -> &'a Ast<'b> where F: FnMut(usize) -> usize {
23 return &Ast::Num((*f)(x)); //~ ERROR cannot return reference to temporary value
26 let m_x = map_nums(x, f);
27 let m_y = map_nums(y, f);
28 return &Ast::Add(m_x, m_y); //~ ERROR cannot return reference to temporary value