blob: 4ddb06e40fff32a82a2cf9dd15d92c60c2590c9f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#![feature(type_alias_impl_trait)]
#![allow(dead_code)]
type Bug<T, U> = impl Fn(T) -> U + Copy;
#[define_opaque(Bug)]
const CONST_BUG: Bug<u8, ()> = unsafe { std::mem::transmute(|_: u8| ()) };
//~^ ERROR item does not constrain `Bug::{opaque#0}`
//~| ERROR: cannot transmute between types of different sizes, or dependently-sized types
#[define_opaque(Bug)]
fn make_bug<T, U: From<T>>() -> Bug<T, U> {
|x| x.into()
}
fn main() {
CONST_BUG(0);
}
|