summaryrefslogtreecommitdiffstats
path: root/tests/ui/transmutability/issue-110892.rs
blob: ce926b39996321bd7a86ea26d0f6ff93109bc7a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// check-fail
#![feature(generic_const_exprs, transmutability)]
#![allow(incomplete_features)]

mod assert {
    use std::mem::{Assume, BikeshedIntrinsicFrom};

    pub fn is_transmutable<
        Src,
        Dst,
        Context,
        const ASSUME_ALIGNMENT: bool,
        const ASSUME_LIFETIMES: bool,
        const ASSUME_SAFETY: bool,
        const ASSUME_VALIDITY: bool,
    >()
    where
        Dst: BikeshedIntrinsicFrom<
            Src,
            Context,
            { from_options(ASSUME_ALIGNMENT, ASSUME_LIFETIMES, ASSUME_SAFETY, ASSUME_VALIDITY) }
        >,
    {}

    // This should not cause an ICE
    const fn from_options(
        , //~ ERROR expected parameter name, found `,`
        , //~ ERROR expected parameter name, found `,`
        , //~ ERROR expected parameter name, found `,`
        , //~ ERROR expected parameter name, found `,`
    ) -> Assume {} //~ ERROR mismatched types
}

fn main() {
    struct Context;
    #[repr(C)] struct Src;
    #[repr(C)] struct Dst;

    assert::is_transmutable::<Src, Dst, Context, false, false, { true }, false>();
}