Closed
Description
I tried this code:
#![feature(transmutability, core_intrinsics)]
use std::mem::{Assume, BikeshedIntrinsicFrom};
fn extend<'a>(src: &'a u8) -> &'static u8 {
transmute::<&'a u8, &'static u8>(src)
}
fn transmute<Src, Dst>(src: Src) -> Dst
where
Dst: BikeshedIntrinsicFrom<Src>,
{
unsafe { core::intrinsics::transmute_unchecked(src) }
}
fn main() {}
I expected to see this to fail with a compilation error. Instead it succeeded.
Meta
rustc --version --verbose
:
rustc 1.82.0-nightly (3e9bd8b56 2024-08-08)
binary: rustc
commit-hash: 3e9bd8b566a47c5d1c1dbc7e043b4b7fa5330eca
commit-date: 2024-08-08
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0