forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add const generics test for all range types.
In addition to the regression test of `RangeInclusive` for rust-lang#70155, now all range types are checked for usability within const generics: - `RangeFrom` - `RangeFull` - `RangeToInclusive` - `RangeTo` - `Range` The test are moved from `test\ui\const-generics\issues\issue-70155` to `test\ui\const-generics\std\range` in anticipation of future similar tests for std types.
- Loading branch information
CDirkx
committed
Mar 23, 2020
1 parent
bd1df44
commit f080f94
Showing
6 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/std/range/const-generics-range-from.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
|
||
// `RangeFrom` should be usable within const generics: | ||
|
||
struct S<const R: std::ops::RangeFrom<usize>>; | ||
|
||
const C : S<{ 0 .. }> = S; | ||
|
||
pub fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/std/range/const-generics-range-full.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
|
||
// `RangeFull` should be usable within const generics: | ||
|
||
struct S<const R: std::ops::RangeFull>; | ||
|
||
const C : S<{ .. }> = S; | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/std/range/const-generics-range-to-inclusive.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
|
||
// `RangeToInclusive` should be usable within const generics: | ||
|
||
struct S<const R: std::ops::RangeToInclusive<usize>>; | ||
|
||
const C : S<{ ..= 999 }> = S; | ||
|
||
pub fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/std/range/const-generics-range-to.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
|
||
// `RangeTo` should be usable within const generics: | ||
|
||
struct S<const R: std::ops::RangeTo<usize>>; | ||
|
||
const C : S<{ .. 1000 }> = S; | ||
|
||
pub fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/const-generics/std/range/const-generics-range.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// check-pass | ||
#![allow(incomplete_features)] | ||
#![feature(const_generics)] | ||
|
||
// `Range` should be usable within const generics: | ||
|
||
struct S<const R: std::ops::Range<usize>>; | ||
|
||
const C : S<{ 0 .. 1000 }> = S; | ||
|
||
pub fn main() {} |