From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../ui/const-generics/std/const-generics-range.rs | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/test/ui/const-generics/std/const-generics-range.rs (limited to 'src/test/ui/const-generics/std/const-generics-range.rs') diff --git a/src/test/ui/const-generics/std/const-generics-range.rs b/src/test/ui/const-generics/std/const-generics-range.rs new file mode 100644 index 000000000..46c06f312 --- /dev/null +++ b/src/test/ui/const-generics/std/const-generics-range.rs @@ -0,0 +1,37 @@ +// [full] check-pass +// revisions: full min +#![cfg_attr(full, feature(adt_const_params))] +#![cfg_attr(full, allow(incomplete_features))] + +// `Range` should be usable within const generics: +struct _Range>; +//[min]~^ ERROR `std::ops::Range` is forbidden +const RANGE : _Range<{ 0 .. 1000 }> = _Range; + +// `RangeFrom` should be usable within const generics: +struct _RangeFrom>; +//[min]~^ ERROR `RangeFrom` is forbidden +const RANGE_FROM : _RangeFrom<{ 0 .. }> = _RangeFrom; + +// `RangeFull` should be usable within const generics: +struct _RangeFull; +//[min]~^ ERROR `RangeFull` is forbidden +const RANGE_FULL : _RangeFull<{ .. }> = _RangeFull; + +// Regression test for #70155 +// `RangeInclusive` should be usable within const generics: +struct _RangeInclusive>; +//[min]~^ ERROR `RangeInclusive` is forbidden +const RANGE_INCLUSIVE : _RangeInclusive<{ 0 ..= 999 }> = _RangeInclusive; + +// `RangeTo` should be usable within const generics: +struct _RangeTo>; +//[min]~^ ERROR `RangeTo` is forbidden +const RANGE_TO : _RangeTo<{ .. 1000 }> = _RangeTo; + +// `RangeToInclusive` should be usable within const generics: +struct _RangeToInclusive>; +//[min]~^ ERROR `RangeToInclusive` is forbidden +const RANGE_TO_INCLUSIVE : _RangeToInclusive<{ ..= 999 }> = _RangeToInclusive; + +pub fn main() {} -- cgit v1.2.3