We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
In the book written, quoting:
any output lifetimes that don't derive from inputs are unbounded
which refers to the following function of what not to do.
nomicon/src/unbounded-lifetimes.md
Lines 22 to 24 in ddfa421
My suggestion is to add after the following quote:
The easiest way to avoid unbounded lifetimes is to use lifetime elision at the function boundary.
A "correct" code example to make stuff clearer, something like:
// lifetime 'a in input and output are elided. Bounded. fn get_str(s: &str) -> &str { &s } fn main() { let soon_dropped = String::from("hello"); let not_dangling = get_str(&soon_dropped); drop(soon_dropped); println!("Invalid str: {}", not_dangling); // Invalid str: gӚ_` }
If this seems logical enough for you, I'd be more then happy to create a PR.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the book written, quoting:
which refers to the following function of what not to do.
nomicon/src/unbounded-lifetimes.md
Lines 22 to 24 in ddfa421
My suggestion is to add after the following quote:
A "correct" code example to make stuff clearer, something like:
If this seems logical enough for you, I'd be more then happy to create a PR.
The text was updated successfully, but these errors were encountered: