1 // [full] check-pass 2 // revisions: full min 3 #![cfg_attr(full, feature(adt_const_params))] 4 #![cfg_attr(full, allow(incomplete_features))] 5 6 // `Range` should be usable within const generics: 7 struct _Range<const R: std::ops::Range<usize>>; 8 //[min]~^ ERROR `std::ops::Range<usize>` is forbidden 9 const RANGE : _Range<{ 0 .. 1000 }> = _Range; 10 11 // `RangeFrom` should be usable within const generics: 12 struct _RangeFrom<const R: std::ops::RangeFrom<usize>>; 13 //[min]~^ ERROR `RangeFrom<usize>` is forbidden 14 const RANGE_FROM : _RangeFrom<{ 0 .. }> = _RangeFrom; 15 16 // `RangeFull` should be usable within const generics: 17 struct _RangeFull<const R: std::ops::RangeFull>; 18 //[min]~^ ERROR `RangeFull` is forbidden 19 const RANGE_FULL : _RangeFull<{ .. }> = _RangeFull; 20 21 // Regression test for #70155 22 // `RangeInclusive` should be usable within const generics: 23 struct _RangeInclusive<const R: std::ops::RangeInclusive<usize>>; 24 //[min]~^ ERROR `RangeInclusive<usize>` is forbidden 25 const RANGE_INCLUSIVE : _RangeInclusive<{ 0 ..= 999 }> = _RangeInclusive; 26 27 // `RangeTo` should be usable within const generics: 28 struct _RangeTo<const R: std::ops::RangeTo<usize>>; 29 //[min]~^ ERROR `RangeTo<usize>` is forbidden 30 const RANGE_TO : _RangeTo<{ .. 1000 }> = _RangeTo; 31 32 // `RangeToInclusive` should be usable within const generics: 33 struct _RangeToInclusive<const R: std::ops::RangeToInclusive<usize>>; 34 //[min]~^ ERROR `RangeToInclusive<usize>` is forbidden 35 const RANGE_TO_INCLUSIVE : _RangeToInclusive<{ ..= 999 }> = _RangeToInclusive; 36 main()37pub fn main() {} 38