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

Clarify Unsize documentation #117495

Merged
merged 2 commits into from
Nov 2, 2023
Merged

Conversation

compiler-errors
Copy link
Member

The documentation erroneously says that:

/// - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
/// - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
///   are met:
///   - `T: Unsize<U>`.
///   - Only the last field of `Foo` has a type involving `T`.
///   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.

Specifically, T: Unsize<U> is not required to hold -- only the final field must implement FinalField<T>: Unsize<FinalField<U>>. This can be demonstrated by the test I added.


Second commit fleshes out the documentation a lot more.

@rustbot
Copy link
Collaborator

rustbot commented Nov 1, 2023

r? @TaKO8Ki

(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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 1, 2023
@compiler-errors
Copy link
Member Author

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Nov 1, 2023
@rustbot rustbot assigned m-ou-se and unassigned TaKO8Ki Nov 1, 2023
@lcnr
Copy link
Contributor

lcnr commented Nov 2, 2023

don't think this needs explicit libs-api approval. The documentation matches the actual builtin rules.

r? @lcnr
@bors r+ rollup

@rustbot rustbot assigned lcnr and unassigned m-ou-se Nov 2, 2023
@bors
Copy link
Contributor

bors commented Nov 2, 2023

📌 Commit 1221b7b has been approved by lcnr

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 Nov 2, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 2, 2023
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#117394 (use global cache when computing proof trees)
 - rust-lang#117495 (Clarify `Unsize` documentation)
 - rust-lang#117509 (Remove support for alias `-Z symbol-mangling-version`)
 - rust-lang#117512 (Expand mem::offset_of! docs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 9575625 into rust-lang:master Nov 2, 2023
11 checks passed
@rustbot rustbot added this to the 1.75.0 milestone Nov 2, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Nov 2, 2023
Rollup merge of rust-lang#117495 - compiler-errors:unsize-docs, r=lcnr

Clarify `Unsize` documentation

The documentation erroneously says that:

```rust
/// - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
/// - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
///   are met:
///   - `T: Unsize<U>`.
///   - Only the last field of `Foo` has a type involving `T`.
///   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.
```

Specifically, `T: Unsize<U>` is not required to hold -- only the final field must implement `FinalField<T>: Unsize<FinalField<U>>`. This can be demonstrated by the test I added.

---

Second commit fleshes out the documentation a lot more.
bors-ferrocene bot added a commit to ferrocene/ferrocene that referenced this pull request Nov 3, 2023
82: Automated pull from upstream `master` r=tshepang a=github-actions[bot]


This PR pulls the following changes from the upstream repository:

* rust-lang/rust#117313
* rust-lang/rust#117131
* rust-lang/rust#117134
* rust-lang/rust#117471
* rust-lang/rust#117521
* rust-lang/rust#117513
  * rust-lang/rust#117512
  * rust-lang/rust#117509
  * rust-lang/rust#117495
  * rust-lang/rust#117394
* rust-lang/rust#117466
* rust-lang/rust#117204
* rust-lang/rust#117386
* rust-lang/rust#117506



Co-authored-by: Nicholas Nethercote <n.nethercote@gmail.com>
Co-authored-by: roblabla <unfiltered@roblab.la>
Co-authored-by: Michael Goulet <michael@errs.io>
Co-authored-by: massivebird <gdrakemail@gmail.com>
Co-authored-by: bors <bors@rust-lang.org>
Co-authored-by: Zalathar <Zalathar@users.noreply.github.com>
Co-authored-by: lcnr <rust@lcnr.de>
Co-authored-by: Joshua Liebow-Feeser <joshlf@users.noreply.github.com>
Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants