mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 03:33:59 +00:00
6266358237
- Only create dst -> src obligation if Dst is mutable - Add some long comments to explain parts of the transmutability code that were unclear to me when reading - Update/add tests
18 lines
425 B
Rust
18 lines
425 B
Rust
// check-fail
|
|
//[next] compile-flags: -Ztrait-solver=next
|
|
|
|
#![feature(transmutability)]
|
|
mod assert {
|
|
use std::mem::{Assume, BikeshedIntrinsicFrom};
|
|
pub struct Context;
|
|
|
|
pub fn is_transmutable<Src, Dst>()
|
|
where
|
|
Dst: BikeshedIntrinsicFrom<Src, Context, { Assume::SAFETY }>
|
|
{}
|
|
}
|
|
|
|
fn main() {
|
|
assert::is_transmutable::<&'static mut bool, &'static mut u8>() //~ ERROR cannot be safely transmuted
|
|
}
|