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

mention how unions interact with dropping #897

Merged
merged 2 commits into from
Oct 18, 2020
Merged

Conversation

RalfJung
Copy link
Member

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I think my earlier confusion was that I was looking at it from the perspective before the recent stabilization. Am I correct to say that before rust-lang/rust#77547 that all fields were required to be Copy? If so, then my confusion was that it said write to a field that doesn't implement Copy, but why mention "Copy" if it wasn't possible to define a non-Copy field in the first place?

I see that it is now possible to have a non-Copy field with ManuallyDrop, which makes that statement make more sense, but previously it seemed confusing to me (unless I'm being dense and misunderstanding something).

src/items/unions.md Outdated Show resolved Hide resolved
@RalfJung
Copy link
Member Author

Am I correct to say that before rust-lang/rust#77547 that all fields were required to be Copy? If so, then my confusion was that it said write to a field that doesn't implement Copy, buy why mention "Copy" if it wasn't possible to define a non-Copy field in the first place?

You are correct for stable Rust. The docs were likely written by someone who thought of what is possible when enabling nightly feature gates.

Co-authored-by: Eric Huss <eric@huss.org>
Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, TYVM!

@ehuss ehuss merged commit d850fd2 into rust-lang:master Oct 18, 2020
@RalfJung RalfJung deleted the union branch October 18, 2020 22:10
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Oct 29, 2020
Update books

## nomicon

7 commits in 6e57e64501f61873ab80cb78a07180a22751a5d6..69333eddb1de92fd17e272ce4677cc983d3bd71d
2020-09-14 11:40:23 -0400 to 2020-10-17 15:44:12 -0700
- Tweak GHA config (rust-lang/nomicon#240)
- Fix link for `[T]` (rust-lang/nomicon#239)
- Update casts.md (rust-lang/nomicon#232)
- [WIP] Add more links (rust-lang/nomicon#180)
- Data Race definition should be more precise (rust-lang/nomicon#219)
- Update the diagnostic of `error[E0597]` in dropck.md (rust-lang/nomicon#157)
- fix typo in Lifetimes mutable reference aliasing section (rust-lang/nomicon#225)

## reference

3 commits in 1b78182e71709169dc0f1c3acdc4541b6860e1c4..10c16caebe475d0d11bec0531b95d7697856c13c
2020-10-11 13:53:47 -0700 to 2020-10-25 20:51:26 -0700
- Add `unsafe` for `mod` and `extern`. (rust-lang/reference#898)
- mention how unions interact with dropping (rust-lang/reference#897)
- Add `move_ref_pattern` docs (rust-lang/reference#881)

## book

2 commits in 451a1e30f2dd137aa04e142414eafb8d05f87f84..13e1c05420bca86ecc79e4ba5b6d02de9bd53c62
2020-10-05 09:11:18 -0500 to 2020-10-20 14:57:32 -0500
- Referencing to Appendix B (rust-lang/book#2481)
- Use GITHUB_PATH instead of add-path (rust-lang/book#2477)

## rust-by-example

2 commits in 152475937a8d8a1f508d8eeb57db79139bc803d9..99eafee0cb14e6ec641bf02a69d7b30f6058349a
2020-10-09 09:29:50 -0300 to 2020-10-21 14:21:55 -0300
- Formatting footer items. (rust-lang/rust-by-example#1385)
- Add partial moves example for `move_ref_pattern` stabilization (rust-lang/rust-by-example#1377)

## edition-guide

3 commits in 81f16863014de60b53de401d71ff904d163ee030..7bc9b7a5e800f79df62947cb7d566fd2fbaf19fe
2020-08-27 13:56:31 -0700 to 2020-10-23 18:31:23 -0500
- A few small updates. (rust-lang/edition-guide#221)
- Clarify the limitation of ? in main and tests (rust-lang/edition-guide#219)
- Update deprecated GitHub Actions commands. (rust-lang/edition-guide#220)
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.

2 participants