Commit Graph

7 Commits

Author SHA1 Message Date
Tim Diekmann 1b679e74f0
Only allow ZSTs with 1 byte alignment 2019-04-30 14:38:17 +02:00
Tim Diekmann abf73a6aeb
Support ZSTs in DispatchFromDyn 2019-04-29 14:03:40 +02:00
Vadim Petrochenkov fa72a81bea Update tests 2019-03-11 23:10:26 +03:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
Michael Hewson a468da9cfb Add a check for reprs that could change the ABI
disallow `#[repr(C)] and `#[repr(packed)]` on structs implementing DispatchFromDyn because they will change the ABI from Scalar/ScalarPair to Aggregrate, resulting in an ICE during object-safety checks or codegen
2018-11-01 18:16:59 -04:00
Michael Hewson b5b25f8196 Put backticks around field names, types and paths in error messages
Added to `DispatchFromDyn` and `CoerceUnsized` error messages
2018-11-01 18:16:59 -04:00
Michael Hewson f12c250e40 Replace CoerceSized trait with DispatchFromDyn
Rename `CoerceSized` to `DispatchFromDyn`, and reverse the direction so that, for example, you write

```
impl<T: Unsize<U>, U> DispatchFromDyn<*const U> for *const T {}
```

instead of

```
impl<T: Unsize<U>, U> DispatchFromDyn<*const T> for *const U {}
```

this way the trait is really just a subset of `CoerceUnsized`.

The checks in object_safety.rs are updated for the new trait, and some documentation and method names in there are updated for the new trait name — e.g. `receiver_is_coercible` is now called `receiver_is_dispatchable`. Since the trait now works in the opposite direction, some code had to updated here for that too.

I did not update the error messages for invalid `CoerceSized` (now `DispatchFromDyn`) implementations, except to find/replace `CoerceSized` with `DispatchFromDyn`. Will ask for suggestions in the PR thread.
2018-11-01 18:16:59 -04:00