diff options
author | Aleksey Kladov <[email protected]> | 2021-06-15 19:45:25 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-06-15 19:45:25 +0100 |
commit | 0bb1f1bc90ee0f0f92f55823fc2e0c12c6acb680 (patch) | |
tree | f1aca0344f6da61352d822bba49b92202919abec /crates/test_utils/src | |
parent | f4b52682dad6dbf31fb17beb645e362e359ee119 (diff) |
internal: add ranges to minicore
Diffstat (limited to 'crates/test_utils/src')
-rw-r--r-- | crates/test_utils/src/minicore.rs | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/crates/test_utils/src/minicore.rs b/crates/test_utils/src/minicore.rs index a61459f6d..f9f14b7df 100644 --- a/crates/test_utils/src/minicore.rs +++ b/crates/test_utils/src/minicore.rs | |||
@@ -10,6 +10,7 @@ | |||
10 | //! Available flags: | 10 | //! Available flags: |
11 | //! sized: | 11 | //! sized: |
12 | //! slice: | 12 | //! slice: |
13 | //! range: | ||
13 | //! unsize: sized | 14 | //! unsize: sized |
14 | //! deref: sized | 15 | //! deref: sized |
15 | //! coerce_unsized: unsize | 16 | //! coerce_unsized: unsize |
@@ -62,13 +63,52 @@ pub mod ops { | |||
62 | } | 63 | } |
63 | pub use self::deref::Deref; | 64 | pub use self::deref::Deref; |
64 | // endregion:deref | 65 | // endregion:deref |
66 | |||
67 | //region:range | ||
68 | mod range { | ||
69 | #[lang = "RangeFull"] | ||
70 | pub struct RangeFull; | ||
71 | |||
72 | #[lang = "Range"] | ||
73 | pub struct Range<Idx> { | ||
74 | pub start: Idx, | ||
75 | pub end: Idx, | ||
76 | } | ||
77 | |||
78 | #[lang = "RangeFrom"] | ||
79 | pub struct RangeFrom<Idx> { | ||
80 | pub start: Idx, | ||
81 | } | ||
82 | |||
83 | #[lang = "RangeTo"] | ||
84 | pub struct RangeTo<Idx> { | ||
85 | pub end: Idx, | ||
86 | } | ||
87 | |||
88 | #[lang = "RangeInclusive"] | ||
89 | pub struct RangeInclusive<Idx> { | ||
90 | pub(crate) start: Idx, | ||
91 | pub(crate) end: Idx, | ||
92 | pub(crate) exhausted: bool, | ||
93 | } | ||
94 | |||
95 | #[lang = "RangeToInclusive"] | ||
96 | pub struct RangeToInclusive<Idx> { | ||
97 | pub end: Idx, | ||
98 | } | ||
99 | } | ||
100 | pub use self::range::{Range, RangeFrom, RangeFull, RangeTo}; | ||
101 | pub use self::range::{RangeInclusive, RangeToInclusive}; | ||
102 | //endregion:range | ||
65 | } | 103 | } |
66 | 104 | ||
67 | // region:slice | 105 | // region:slice |
68 | pub mod slice { | 106 | pub mod slice { |
69 | #[lang = "slice"] | 107 | #[lang = "slice"] |
70 | impl<T> [T] { | 108 | impl<T> [T] { |
71 | pub fn len(&self) -> usize { loop {} } | 109 | pub fn len(&self) -> usize { |
110 | loop {} | ||
111 | } | ||
72 | } | 112 | } |
73 | } | 113 | } |
74 | // endregion:slice | 114 | // endregion:slice |