mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
Add lang items for ranges.
This commit is contained in:
parent
21ea66f47a
commit
53c5fcb99f
@ -882,9 +882,11 @@ macro_rules! countable_impl(
|
||||
countable_impl!(uint u8 u16 u32 u64 int i8 i16 i32 i64)
|
||||
|
||||
/// An unbounded range.
|
||||
#[lang="full_range"]
|
||||
pub struct FullRange;
|
||||
|
||||
/// A range which i bounded at both ends.
|
||||
#[lang="range"]
|
||||
pub struct Range<Idx> {
|
||||
/// The lower bound of the range (inclusive).
|
||||
pub start: Idx,
|
||||
@ -926,6 +928,7 @@ impl<Idx: Clone + Countable> DoubleEndedIterator<Idx> for Range<Idx> {
|
||||
}
|
||||
|
||||
/// A range which is only bounded below.
|
||||
#[lang="range_from"]
|
||||
pub struct RangeFrom<Idx> {
|
||||
/// The lower bound of the range (inclusive).
|
||||
pub start: Idx,
|
||||
|
@ -267,6 +267,9 @@ lets_do_this! {
|
||||
IndexMutTraitLangItem, "index_mut", index_mut_trait;
|
||||
SliceTraitLangItem, "slice", slice_trait;
|
||||
SliceMutTraitLangItem, "slice_mut", slice_mut_trait;
|
||||
RangeStructLangItem, "range", range_struct;
|
||||
RangeFromStructLangItem, "range_from", range_from_struct;
|
||||
FullRangeStructLangItem, "full_range", full_range_struct;
|
||||
|
||||
UnsafeTypeLangItem, "unsafe", unsafe_type;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user