diff --git a/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs b/src/test/run-pass/nll/mutating_references.rs similarity index 73% rename from src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs rename to src/test/run-pass/nll/mutating_references.rs index 043f1215ea572..96b7362e4d939 100644 --- a/src/test/run-pass/borrowck/borrowck-nll-iterating-and-updating.rs +++ b/src/test/run-pass/nll/mutating_references.rs @@ -1,4 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -8,17 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -Z borrowck=mir -Z nll - -// This example comes from the NLL RFC. +#![feature(nll)] struct List { value: T, next: Option>>, } -fn to_refs(list: &mut List) -> Vec<&mut T> { - let mut list = list; +fn to_refs(mut list: &mut List) -> Vec<&mut T> { let mut result = vec![]; loop { result.push(&mut list.value); @@ -31,4 +28,7 @@ fn to_refs(list: &mut List) -> Vec<&mut T> { } fn main() { + let mut list = List { value: 1, next: None }; + let vec = to_refs(&mut list); + assert_eq!(vec![&mut 1], vec); }