Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

Re-add issue-53092 #195

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions fixed/53092.rs

This file was deleted.

31 changes: 31 additions & 0 deletions ices/53092.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#![feature(const_fn)]
#![feature(const_fn_union)]
#![feature(type_alias_impl_trait)]
#![feature(untagged_unions)]

const fn transmute<T, U>(from: T) -> U {
use std::mem::ManuallyDrop;

union Transform<FROM, INTO> {
from: ManuallyDrop<FROM>,
into: ManuallyDrop<INTO>,
}

let transformer = Transform {
from: ManuallyDrop::new(from),
};

unsafe { ManuallyDrop::into_inner(transformer.into) }
}

type Bug<T, U> = impl Fn(T) -> U + Copy;

const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());

fn make_bug<T, U: From<T>>() -> Bug<T, U> {
|x| x.into()
}

fn main() {
let x = CONST_BUG(0);
}