3 // A test for something that NLL enables. It sometimes happens that
4 // the `while let` pattern makes some borrows from a variable (in this
5 // case, `x`) that you need in order to compute the next value for
6 // `x`. The lexical checker makes this very painful. The NLL checker
11 #[derive(Debug, PartialEq, Eq)]
17 fn find_base(mut x: Rc<Foo>) -> Rc<Foo> {
18 while let Foo::Next(n) = &*x {
25 let chain = Rc::new(Foo::Next(Rc::new(Foo::Base(44))));
26 let base = find_base(chain);
27 assert_eq!(&*base, &Foo::Base(44));