diff options
Diffstat (limited to '')
-rw-r--r-- | tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs b/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs new file mode 100644 index 000000000..0ba0c5a72 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/single-satisfied-ConstEvaluatable-in-probe.rs @@ -0,0 +1,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() {} |