mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 13:36:49 +00:00
Safe Transmute: Disable coinduction support
This patch just removes the `#[rustc_coinductive]` annotation from `BikeshedIntrinsicFrom` and flips the related tests to `check-fail`. Once an FCP for setting the annotation on the trait is approved, it could be enabled again.
This commit is contained in:
parent
d2164d5c9a
commit
64a54df86f
@ -5,7 +5,6 @@
|
||||
/// notwithstanding whatever safety checks you have asked the compiler to [`Assume`] are satisfied.
|
||||
#[unstable(feature = "transmutability", issue = "99571")]
|
||||
#[lang = "transmute_trait"]
|
||||
#[rustc_coinductive]
|
||||
pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }>
|
||||
where
|
||||
Src: ?Sized,
|
||||
|
@ -1,4 +1,5 @@
|
||||
// check-pass
|
||||
// check-fail
|
||||
// FIXME(bryangarza): Change to check-pass when coinduction is supported for BikeshedIntrinsicFrom
|
||||
#![feature(transmutability)]
|
||||
|
||||
mod assert {
|
||||
@ -21,5 +22,5 @@ mod assert {
|
||||
fn main() {
|
||||
#[repr(C)] struct A(bool, &'static A);
|
||||
#[repr(C)] struct B(u8, &'static B);
|
||||
assert::is_maybe_transmutable::<&'static A, &'static B>();
|
||||
assert::is_maybe_transmutable::<&'static A, &'static B>(); //~ ERROR overflow evaluating the requirement
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
error[E0275]: overflow evaluating the requirement `B: BikeshedIntrinsicFrom<A, assert::Context, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>`
|
||||
--> $DIR/recursive-wrapper-types-bit-compatible.rs:25:5
|
||||
|
|
||||
LL | assert::is_maybe_transmutable::<&'static A, &'static B>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `is_maybe_transmutable`
|
||||
--> $DIR/recursive-wrapper-types-bit-compatible.rs:11:14
|
||||
|
|
||||
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
||||
| --------------------- required by a bound in this function
|
||||
LL | where
|
||||
LL | Dst: BikeshedIntrinsicFrom<Src, Context, {
|
||||
| ______________^
|
||||
LL | | Assume {
|
||||
LL | | alignment: true,
|
||||
LL | | lifetimes: false,
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }>
|
||||
| |__________^ required by this bound in `is_maybe_transmutable`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
@ -1,4 +1,5 @@
|
||||
// check-pass
|
||||
// check-fail
|
||||
// FIXME(bryangarza): Change to check-pass when coinduction is supported for BikeshedIntrinsicFrom
|
||||
#![feature(transmutability)]
|
||||
|
||||
mod assert {
|
||||
@ -21,6 +22,6 @@ mod assert {
|
||||
fn main() {
|
||||
#[repr(C)] struct A(&'static B);
|
||||
#[repr(C)] struct B(&'static A);
|
||||
assert::is_maybe_transmutable::<&'static A, &'static B>();
|
||||
assert::is_maybe_transmutable::<&'static A, &'static B>(); //~ overflow evaluating the requirement
|
||||
assert::is_maybe_transmutable::<&'static B, &'static A>();
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
error[E0275]: overflow evaluating the requirement `A: BikeshedIntrinsicFrom<B, assert::Context, Assume { alignment: true, lifetimes: false, safety: true, validity: false }>`
|
||||
--> $DIR/recursive-wrapper-types.rs:25:5
|
||||
|
|
||||
LL | assert::is_maybe_transmutable::<&'static A, &'static B>();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: required by a bound in `is_maybe_transmutable`
|
||||
--> $DIR/recursive-wrapper-types.rs:11:14
|
||||
|
|
||||
LL | pub fn is_maybe_transmutable<Src, Dst>()
|
||||
| --------------------- required by a bound in this function
|
||||
LL | where
|
||||
LL | Dst: BikeshedIntrinsicFrom<Src, Context, {
|
||||
| ______________^
|
||||
LL | | Assume {
|
||||
LL | | alignment: true,
|
||||
LL | | lifetimes: false,
|
||||
... |
|
||||
LL | | }
|
||||
LL | | }>
|
||||
| |__________^ required by this bound in `is_maybe_transmutable`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0275`.
|
Loading…
Reference in New Issue
Block a user