Skip to content

doc: Small changes to ownership guide. #19994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 22, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/doc/guide-ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ fn main() {
let f = Foo { x: y }; // -+ f goes into scope
// stuff // |
// |
} // -+ f & y go out of scope
} // -+ f and y go out of scope
```

Our `f` lives within the scope of `y`, so everything works. What if it didn't?
Expand All @@ -342,7 +342,7 @@ fn main() {
let y = &5i; // ---+ y goes into scope
let f = Foo { x: y }; // ---+ f goes into scope
x = &f.x; // | | error here
} // ---+ f & y go out of scope
} // ---+ f and y go out of scope
// |
println!("{}", x); // |
} // -+ x goes out of scope
Expand Down Expand Up @@ -395,7 +395,7 @@ struct Wheel {
}

fn main() {
let car = Car { name: "DeLorian".to_string() };
let car = Car { name: "DeLorean".to_string() };

for _ in range(0u, 4) {
Wheel { size: 360, owner: car };
Expand Down Expand Up @@ -431,7 +431,7 @@ struct Wheel {
}

fn main() {
let car = Car { name: "DeLorian".to_string() };
let car = Car { name: "DeLorean".to_string() };

let car_owner = Rc::new(car);

Expand Down