|
1 | 1 | //@ check-pass |
2 | 2 |
|
3 | 3 | #![feature(generic_const_items, min_generic_const_args)] |
4 | | -#![feature(adt_const_params)] |
5 | | -#![allow(incomplete_features)] |
| 4 | +#![feature(adt_const_params, unsized_const_params, generic_const_parameter_types)] |
| 5 | +#![expect(incomplete_features)] |
| 6 | + |
| 7 | +use std::marker::{ConstParamTy, ConstParamTy_}; |
6 | 8 |
|
7 | 9 | trait Owner { |
8 | 10 | type const C<const N: u32>: u32; |
9 | 11 | type const K<const N: u32>: u32; |
10 | | - // #[type_const] |
11 | | - // const Q<T>: Maybe<T>; |
| 12 | + type const Q<T: ConstParamTy_>: Maybe<T>; |
12 | 13 | } |
13 | 14 |
|
14 | 15 | impl Owner for () { |
15 | 16 | type const C<const N: u32>: u32 = N; |
16 | 17 | type const K<const N: u32>: u32 = const { 99 + 1 }; |
17 | | - // FIXME(mgca): re-enable once we properly support ctors and generics on paths |
18 | | - // #[type_const] |
19 | | - // const Q<T>: Maybe<T> = Maybe::Nothing; |
| 18 | + type const Q<T: ConstParamTy_>: Maybe<T> = Maybe::Nothing::<T>; |
20 | 19 | } |
21 | 20 |
|
22 | 21 | fn take0<const N: u32>(_: impl Owner<C<N> = { N }>) {} |
23 | 22 | fn take1(_: impl Owner<K<99> = 100>) {} |
24 | | -// FIXME(mgca): re-enable once we properly support ctors and generics on paths |
25 | | -// fn take2(_: impl Owner<Q<()> = { Maybe::Just(()) }>) {} |
| 23 | +fn take2(_: impl Owner<Q<()> = { Maybe::Just::<()>(()) }>) {} |
26 | 24 |
|
27 | 25 | fn main() { |
28 | 26 | take0::<128>(()); |
29 | 27 | take1(()); |
30 | 28 | } |
31 | 29 |
|
32 | | -#[derive(PartialEq, Eq, std::marker::ConstParamTy)] |
| 30 | +#[derive(PartialEq, Eq, ConstParamTy)] |
33 | 31 | enum Maybe<T> { |
34 | 32 | Nothing, |
35 | 33 | Just(T), |
|
0 commit comments