Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
steveklabnik
on Feb 7, 2017
|
parent
|
context
|
favorite
| on:
Rust's 2017 Roadmap
It happens if b() returns an owned value that c() returns a reference to. In that case,
a.b().c()
b here is temporary, and so is freed at the end of the line, making the return of c dangling
let temp = a.b(); temp.c();
Now that the return of b() is not temporary, it will last to the end of the scope and so c is fine.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: