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

DST custom coercions. #982

Merged
merged 5 commits into from
Jun 3, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Tweak newtype coercions, remove ?Sized requirement.
  • Loading branch information
nrc committed Jun 3, 2015
commit 4d803c14371ca7cbfd327b3db9735ed3ba58e31f
7 changes: 3 additions & 4 deletions text/0000-dst-coercion.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 66,8 @@ coerced to the `Target` type. E.g., the above implementation means that
## Newtype coercions

We also add a new built-in coercion for 'newtype's. If `Foo<T>` is a tuple
struct with a single field with type `T` and `T` has at least the `?Sized`
bound, then coerce_inner(`Foo<T>`) = `Foo<U>` holds for any `T` and `U` where
`T` coerces to `U`.
struct with a single field with type `T`, then coerce_inner(`Foo<T>`) = `Foo<U>`
holds for any `T` and `U` where `T` coerces to `U`.

This coercion is not opt-in. It is best thought of as an extension to the
coercion rule for structs with an unsized field, the extension is that here the
Expand Down Expand Up @@ -121,7 120,7 @@ adjustment.
### Adjustment types

We add `AdjustCustom(usize, Box<AutoAdjustment>)` and
`AdjustNewtype(Box<AutoAdjustment>)` to the `AutoAdjustment` enum. These
`AdjustNewtype(Box<AutoDerefRef>)` to the `AutoAdjustment` enum. These
represent the new custom and newtype coercions, respectively. We add
`UnsizePlaceHolder(Ty, Ty)` to the `UnsizeKind` enum to represent a placeholder
adjustment due to an `Unsize` bound.
Expand Down