mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 01:04:03 +00:00
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>
24 lines
767 B
Plaintext
24 lines
767 B
Plaintext
error[E0277]: `()` cannot be safely transmuted into `W<'_>` in the defining scope of `Context`
|
|
--> $DIR/region-infer.rs:20:5
|
|
|
|
|
LL | test();
|
|
| ^^^^ The size of `()` is smaller than the size of `W<'_>`
|
|
|
|
|
note: required by a bound in `test`
|
|
--> $DIR/region-infer.rs:11:12
|
|
|
|
|
LL | fn test<'a>()
|
|
| ---- required by a bound in this function
|
|
LL | where
|
|
LL | W<'a>: BikeshedIntrinsicFrom<
|
|
| ____________^
|
|
LL | | (),
|
|
LL | | Context,
|
|
LL | | { Assume { alignment: true, lifetimes: true, safety: true, validity: true } },
|
|
LL | | >,
|
|
| |_________^ required by this bound in `test`
|
|
|
|
error: aborting due to previous error
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|