Skip to content

Primitive docs: fix confusing Send in &T's list #119424

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 30, 2023
Merged

Conversation

ojeda
Copy link
Contributor

@ojeda ojeda commented Dec 29, 2023

The two lists in this document describe what traits are implemented on references when their underlying T also implements them. However, while it is true that T: Send + Sync implies &T: Send (which is what the sentence is trying to explain), it is confusing to have Send in the list because T: Send is not needed for that. In particular, the "also require" part may be interpreted as "both T: Send and T: Sync are required".

Instead, move Send back to where it was before commit 7a47786 ("Makes docs for references a little less confusing"), i.e. to the &mut list (where no extra nota is needed, i.e. it fits naturally) and move the Sync definition/note to the bottom as something independent.

The two lists in this document describe what traits are implemented on
references when their underlying `T` also implements them. However,
while it is true that `T: Send + Sync` implies `&T: Send` (which is
what the sentence is trying to explain), it is confusing to have `Send`
in the list because `T: Send` is not needed for that. In particular,
the "also require" part may be interpreted as "both `T: Send` and
`T: Sync` are required".

Instead, move `Send` back to where it was before commit 7a47786
("Makes docs for references a little less confusing"), i.e. to the `&mut`
list (where no extra nota is needed, i.e. it fits naturally) and move the
`Sync` definition/note to the bottom as something independent.

Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
@rustbot
Copy link
Collaborator

rustbot commented Dec 29, 2023

r? @joshtriplett

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Dec 29, 2023
@est31
Copy link
Member

est31 commented Dec 30, 2023

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 30, 2023

📌 Commit dd928c8 has been approved by est31

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 30, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 30, 2023
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#119158 (Clean up alloc::sync::Weak Clone implementation)
 - rust-lang#119386 (fix typo in `IpAddr::to_canonical`)
 - rust-lang#119413 (solaris support on bootstrap lock)
 - rust-lang#119424 (Primitive docs: fix confusing `Send` in `&T`'s list)
 - rust-lang#119425 (Fix invalid check-cfg Cargo feature diagnostic help)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 19580d5 into rust-lang:master Dec 30, 2023
@rustbot rustbot added this to the 1.77.0 milestone Dec 30, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 30, 2023
Rollup merge of rust-lang#119424 - ojeda:send-sync, r=est31

Primitive docs: fix confusing `Send` in `&T`'s list

The two lists in this document describe what traits are implemented on references when their underlying `T` also implements them. However, while it is true that `T: Send + Sync` implies `&T: Send` (which is what the sentence is trying to explain), it is confusing to have `Send` in the list because `T: Send` is not needed for that. In particular, the "also require" part may be interpreted as "both `T: Send` and `T: Sync` are required".

Instead, move `Send` back to where it was before commit 7a47786 ("Makes docs for references a little less confusing"), i.e. to the `&mut` list (where no extra nota is needed, i.e. it fits naturally) and move the `Sync` definition/note to the bottom as something independent.
@ojeda ojeda deleted the send-sync branch December 30, 2023 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants