File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
1+ // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
22// file at the top-level directory of this distribution and at
33// http://rust-lang.org/COPYRIGHT.
44//
88// option. This file may not be copied, modified, or distributed
99// except according to those terms.
1010
11- // compile-flags: -Z borrowck=mir -Z nll
12-
13- // This example comes from the NLL RFC.
11+ #![ feature( nll) ]
1412
1513struct List < T > {
1614 value : T ,
1715 next : Option < Box < List < T > > > ,
1816}
1917
20- fn to_refs < T > ( list : & mut List < T > ) -> Vec < & mut T > {
21- let mut list = list;
18+ fn to_refs < T > ( mut list : & mut List < T > ) -> Vec < & mut T > {
2219 let mut result = vec ! [ ] ;
2320 loop {
2421 result. push ( & mut list. value ) ;
@@ -31,4 +28,7 @@ fn to_refs<T>(list: &mut List<T>) -> Vec<&mut T> {
3128}
3229
3330fn main ( ) {
31+ let mut list = List { value : 1 , next : None } ;
32+ let vec = to_refs ( & mut list) ;
33+ assert_eq ! ( vec![ & mut 1 ] , vec) ;
3434}
You can’t perform that action at this time.
0 commit comments