8f1cec8d84
This patch enables support for references in Safe Transmute, by generating nested obligations during trait selection. Specifically, when we call `confirm_transmutability_candidate(...)`, we now recursively traverse the `rustc_transmute::Answer` tree and create obligations for all the `Answer` variants, some of which include multiple nested `Answer`s. Also, to handle recursive types, enable support for coinduction for the Safe Transmute trait (`BikeshedIntrinsicFrom`) by adding the `#[rustc_coinduction]` annotation. Also fix some small logic issues when reducing the `or` and `and` combinations in `rustc_transmute`, so that we don't end up with additional redundant `Answer`s in the tree. Co-authored-by: Jack Wrenn <jack@wrenn.fyi>
25 lines
1004 B
Plaintext
25 lines
1004 B
Plaintext
error[E0277]: `Src` cannot be safely transmuted into `Dst` in the defining scope of `should_pad_variants::Context`
|
|
--> $DIR/should_pad_variants.rs:44:36
|
|
|
|
|
LL | assert::is_transmutable::<Src, Dst, Context>();
|
|
| ^^^ At least one value of `Src` isn't a bit-valid value of `Dst`
|
|
|
|
|
note: required by a bound in `is_transmutable`
|
|
--> $DIR/should_pad_variants.rs:13:14
|
|
|
|
|
LL | pub fn is_transmutable<Src, Dst, Context>()
|
|
| --------------- required by a bound in this function
|
|
LL | where
|
|
LL | Dst: BikeshedIntrinsicFrom<Src, Context, {
|
|
| ______________^
|
|
LL | | Assume::ALIGNMENT
|
|
LL | | .and(Assume::LIFETIMES)
|
|
LL | | .and(Assume::SAFETY)
|
|
LL | | .and(Assume::VALIDITY)
|
|
LL | | }>
|
|
| |__________^ required by this bound in `is_transmutable`
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|