From 0bb1f1bc90ee0f0f92f55823fc2e0c12c6acb680 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 15 Jun 2021 21:45:25 +0300 Subject: internal: add ranges to minicore --- crates/test_utils/src/minicore.rs | 42 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) (limited to 'crates/test_utils') 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 @@ //! Available flags: //! sized: //! slice: +//! range: //! unsize: sized //! deref: sized //! coerce_unsized: unsize @@ -62,13 +63,52 @@ pub mod ops { } pub use self::deref::Deref; // endregion:deref + + //region:range + mod range { + #[lang = "RangeFull"] + pub struct RangeFull; + + #[lang = "Range"] + pub struct Range { + pub start: Idx, + pub end: Idx, + } + + #[lang = "RangeFrom"] + pub struct RangeFrom { + pub start: Idx, + } + + #[lang = "RangeTo"] + pub struct RangeTo { + pub end: Idx, + } + + #[lang = "RangeInclusive"] + pub struct RangeInclusive { + pub(crate) start: Idx, + pub(crate) end: Idx, + pub(crate) exhausted: bool, + } + + #[lang = "RangeToInclusive"] + pub struct RangeToInclusive { + pub end: Idx, + } + } + pub use self::range::{Range, RangeFrom, RangeFull, RangeTo}; + pub use self::range::{RangeInclusive, RangeToInclusive}; + //endregion:range } // region:slice pub mod slice { #[lang = "slice"] impl [T] { - pub fn len(&self) -> usize { loop {} } + pub fn len(&self) -> usize { + loop {} + } } } // endregion:slice -- cgit v1.2.3