about summary refs log tree commit diff
path: root/tests/ui/type-alias-impl-trait/bad-transmute-itiat.rs
blob: 8314b28eeac4bcf3c577a8504fba51525e5bcc14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// regression test for rust-lang/rust#125758

#![feature(impl_trait_in_assoc_type)]

trait Trait {
    type Assoc2;
}

struct Bar;
impl Trait for Bar {
    type Assoc2 = impl std::fmt::Debug;
    //~^ ERROR unconstrained opaque type
}

struct Foo {
    field: <Bar as Trait>::Assoc2,
}

static BAR: u8 = 42;
static FOO2: &Foo = unsafe { std::mem::transmute(&BAR) };

fn main() {}