Skip to content

Commit

Permalink
Change '.f' to '.field' in code example.
Browse files Browse the repository at this point in the history
There is no field called '.f' in any of the defined structs.

Signed-off-by: mulhern <[email protected]>
  • Loading branch information
mulkieran committed Nov 7, 2016
1 parent fd4b0de commit c2c4a75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions data types.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ Struct S {
fn foo(x: Rc<RefCell<S>>) {
{
let s = x.borrow();
println!("the field, twice {} {}", s.f, x.borrow().field);
println!("the field, twice {} {}", s.field, x.borrow().field);
// let s = x.borrow_mut(); // Error - we've already borrowed the contents of x
}

let s = x.borrow_mut(); // OK, the earlier borrows are out of scope
s.f = 45;
s.field = 45;
// println!("The field {}", x.borrow().field); // Error - can't mut and immut borrow
println!("The field {}", s.f);
println!("The field {}", s.field);
}
```

Expand Down

0 comments on commit c2c4a75

Please sign in to comment.