Add lang items for ranges.

This commit is contained in:
Nick Cameron 2014-12-13 17:19:54 +13:00
parent 21ea66f47a
commit 53c5fcb99f
2 changed files with 6 additions and 0 deletions

View File

@ -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,

View File

@ -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;