diff options
| author | kennytm <kennytm@gmail.com> | 2018-04-06 05:21:47 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-05-01 01:45:18 +0800 |
| commit | c916ee8511339dd231d90d7fe6be2cc6995284b9 (patch) | |
| tree | 3764919ae310d2657c4c6e5009dd7c4c8265c7ec /src/libcore | |
| parent | fba903a435ea6e0e3736541cb487586262835e48 (diff) | |
| download | rust-c916ee8511339dd231d90d7fe6be2cc6995284b9.tar.gz rust-c916ee8511339dd231d90d7fe6be2cc6995284b9.zip | |
Removed direct field usage of RangeInclusive in rustc itself.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/ops/range.rs | 2 | ||||
| -rw-r--r-- | src/libcore/tests/ops.rs | 8 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 0e21a3327fd..5a6e0050835 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -103,6 +103,7 @@ #![feature(untagged_unions)] #![feature(unwind_attributes)] #![feature(doc_alias)] +#![feature(inclusive_range_methods)] #![cfg_attr(not(stage0), feature(mmx_target_feature))] #![cfg_attr(not(stage0), feature(tbm_target_feature))] diff --git a/src/libcore/ops/range.rs b/src/libcore/ops/range.rs index c1bd1ef2d1d..59ee40fdda4 100644 --- a/src/libcore/ops/range.rs +++ b/src/libcore/ops/range.rs @@ -318,7 +318,7 @@ impl<Idx: PartialOrd<Idx>> RangeTo<Idx> { /// # Examples /// /// ``` -/// #![feature(inclusive_range_fields)] +/// #![feature(inclusive_range_methods)] /// /// assert_eq!((3..=5), std::ops::RangeInclusive::new(3, 5)); /// assert_eq!(3 + 4 + 5, (3..=5).sum()); diff --git a/src/libcore/tests/ops.rs b/src/libcore/tests/ops.rs index bed08f86d72..d66193b1687 100644 --- a/src/libcore/tests/ops.rs +++ b/src/libcore/tests/ops.rs @@ -50,21 +50,21 @@ fn test_full_range() { #[test] fn test_range_inclusive() { - let mut r = RangeInclusive { start: 1i8, end: 2 }; + let mut r = RangeInclusive::new(1i8, 2); assert_eq!(r.next(), Some(1)); assert_eq!(r.next(), Some(2)); assert_eq!(r.next(), None); - r = RangeInclusive { start: 127i8, end: 127 }; + r = RangeInclusive::new(127i8, 127); assert_eq!(r.next(), Some(127)); assert_eq!(r.next(), None); - r = RangeInclusive { start: -128i8, end: -128 }; + r = RangeInclusive::new(-128i8, -128); assert_eq!(r.next_back(), Some(-128)); assert_eq!(r.next_back(), None); // degenerate - r = RangeInclusive { start: 1, end: -1 }; + r = RangeInclusive::new(1, -1); assert_eq!(r.size_hint(), (0, Some(0))); assert_eq!(r.next(), None); } |
