-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-transmutability`#![feature(transmutability)]``#![feature(transmutability)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
#![feature(transmutability)]
use std::mem::{Assume, MaybeUninit, TransmuteFrom};
pub fn is_transmutable<Src, Dst>() where Dst: TransmuteFrom<Src, { Assume::SAFETY }>{}
#[derive(Copy, Clone)]
#[repr(u8)]
enum B0 { Value = 0 }
#[derive(Copy, Clone)]
#[repr(u8)]
enum B1 { Value = 1 }
fn main() {
is_transmutable::<(B0, B0), MaybeUninit<(B0, B0)>>(); // ok
is_transmutable::<(B0, B0), MaybeUninit<(B0, B1)>>(); // unexpected error: `(B0, B0)` cannot be safely transmuted into `MaybeUninit<(B0, B1)>`
is_transmutable::<(B0, B0), MaybeUninit<(B1, B0)>>(); // ok
is_transmutable::<(B0, B0), MaybeUninit<(B1, B1)>>(); // ok
}
cc @jswrenn
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.F-transmutability`#![feature(transmutability)]``#![feature(transmutability)]`T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.