rust-lang / rust-lang/reference

`Foo<T>` can implement `CoerceUnsized<Foo<U>>` when `T` implements `CoerceUnsized<U>` rather than `CoerceUnsized<Foo<U>>`

Open
#1,574 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-coercions
Dominant language
Rust
Stars
1.6k
Forks
607
PR merge metrics
PR metrics pending

Description

https://doc.rust-lang.org/reference/type-coercions.html#unsized-coercions

Additionally, a type Foo<T> can implement CoerceUnsized<Foo<U>> when T implements Unsize<U> or CoerceUnsized<Foo<U>>. This allows it to provide a unsized coercion to Foo<U>.

However, the document of CoerceUnsized regarding the corresponding case says:

you can directly implement CoerceUnsized<Wrap<U>> for Wrap<T> where T: CoerceUnsized<U>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Rust Reference unsized-coercions section and the std::ops::CoerceUnsized documentation linked in the issue. Compare their descriptions of the generic coercion relationship and update the documentation so the corresponding cases agree. Done means the two linked documents describe the same supported behavior accurately.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.