1 #[derive(Copy, Clone, Debug, Eq, PartialEq)]
6 fn get(&self) -> Option<&Result<String, String>> {
10 fn mutate(&mut self) { }
14 let mut foo = Foo { };
16 // foo.get() returns type Option<&Result<String, String>>, so
17 // using `string` keeps borrow of `foo` alive. Hence calling
18 // `foo.mutate()` should be an error.
19 while let Some(Ok(string)) = foo.get() {
21 //~^ ERROR cannot borrow `foo` as mutable
22 println!("foo={:?}", *string);