1 #![feature(unboxed_closures)] 2 3 use std::io::Read; 4 to_fn_once<A,F:FnOnce<A>>(f: F) -> F5fn to_fn_once<A,F:FnOnce<A>>(f: F) -> F { f } 6 main()7fn main() { 8 let x = 1; 9 to_fn_once(move|| { x = 2; }); 10 //~^ ERROR: cannot assign to `x`, as it is not declared as mutable 11 12 let s = std::io::stdin(); 13 to_fn_once(move|| { s.read_to_end(&mut Vec::new()); }); 14 //~^ ERROR: cannot borrow `s` as mutable, as it is not declared as mutable 15 } 16