Skip to content
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

Avoid lifetime annotation in struct example #1378

Merged

Conversation

xiaochuanyu
Copy link
Contributor

@xiaochuanyu xiaochuanyu commented Sep 2, 2020

This is one of the options of addressing #1371.

The current example in Structure section uses lifetime annotation without any explanation.
In my opinion, using lifetime annotations so early on in the book may do more harm than good by confusing people. This PR makes it so that we avoids using lifetime annotations in the example all together similar to Rust programming language book https://doc.rust-lang.org/book/ch05-01-defining-structs.html.

It might be worthwhile to also have a lightweight section about ownership immediately after Structures section.

@rust-highfive
Copy link

r? @marioidival

(rust_highfive has picked a reviewer for you, use r? to override)

@xiaochuanyu xiaochuanyu changed the title Remove lifetime annotation from struct example Avoid lifetime annotation in struct example Sep 11, 2020
@marioidival marioidival merged commit 2ba048e into rust-lang:master Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants