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

Commit 1eeb8df

Browse files
authored
Merge pull request #195 from JohnTitor/readd-53092
Re-add issue-53092
2 parents 1d172f1 + 5664ef3 commit 1eeb8df

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

fixed/53092.rs

Lines changed: 0 additions & 23 deletions
This file was deleted.

ices/53092.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#![feature(const_fn)]
2+
#![feature(const_fn_union)]
3+
#![feature(type_alias_impl_trait)]
4+
#![feature(untagged_unions)]
5+
6+
const fn transmute<T, U>(from: T) -> U {
7+
use std::mem::ManuallyDrop;
8+
9+
union Transform<FROM, INTO> {
10+
from: ManuallyDrop<FROM>,
11+
into: ManuallyDrop<INTO>,
12+
}
13+
14+
let transformer = Transform {
15+
from: ManuallyDrop::new(from),
16+
};
17+
18+
unsafe { ManuallyDrop::into_inner(transformer.into) }
19+
}
20+
21+
type Bug<T, U> = impl Fn(T) -> U + Copy;
22+
23+
const CONST_BUG: Bug<u8, ()> = transmute(|_: u8| ());
24+
25+
fn make_bug<T, U: From<T>>() -> Bug<T, U> {
26+
|x| x.into()
27+
}
28+
29+
fn main() {
30+
let x = CONST_BUG(0);
31+
}

0 commit comments

Comments
 (0)