about summary refs log tree commit diff
path: root/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs
blob: 4485ea14712aabe50710b55d5fa0988e5fa14b87 (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
//@ check-pass

#![allow(incomplete_features)]
#![feature(generic_const_exprs)]

use std::marker::PhantomData;

pub trait Bytes {
    const BYTES: usize;
}

#[derive(Clone, Debug)]
pub struct Conster<OT>
where
    OT: Bytes,
    [(); OT::BYTES]: Sized,
{
    _offset_type: PhantomData<fn(OT) -> OT>,
}

impl<OT> Conster<OT>
where
    OT: Bytes,
    [(); OT::BYTES]: Sized,
{
    pub fn new() -> Self {
        Conster { _offset_type: PhantomData }
    }
}

pub fn make_conster<COT>() -> Conster<COT>
where
    COT: Bytes,
    [(); COT::BYTES]: Sized,
{
    Conster::new()
}

fn main() {}