Skip to content

Commit f1d9661

Browse files
committed
---
yaml --- r: 272862 b: refs/heads/beta c: 3340cb3 h: refs/heads/master
1 parent 2884249 commit f1d9661

File tree

96 files changed

+2501
-1740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+2501
-1740
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: aac94545052a7a05ddea60ec11c286d8b8b64235
26+
refs/heads/beta: 3340cb3df9c2582a080763908ac47102b1e90a95
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/cfg/i686-pc-windows-gnu.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,3 @@ CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32
2525
CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
2626
CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
2727
CFG_RUSTRT_HAS_STARTUP_OBJS_i686-pc-windows-gnu := 1
28-
# FIXME(#31030) - there's not a great reason to disable jemalloc here
29-
CFG_DISABLE_JEMALLOC_i686-pc-windows-gnu := 1

branches/beta/mk/cfg/x86_64-pc-windows-gnu.mk

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,3 @@ CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32
2525
CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
2626
CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
2727
CFG_RUSTRT_HAS_STARTUP_OBJS_x86_64-pc-windows-gnu := 1
28-
# FIXME(#31030) - there's not a great reason to disable jemalloc here
29-
CFG_DISABLE_JEMALLOC_x86_64-pc-windows-gnu := 1

branches/beta/src/bootstrap/build/sanity.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn check(build: &mut Build) {
7979
}
8080

8181
// Make sure musl-root is valid if specified
82-
if target.contains("musl") {
82+
if target.contains("musl") && target.contains("x86_64") {
8383
match build.config.musl_root {
8484
Some(ref root) => {
8585
if fs::metadata(root.join("lib/libc.a")).is_err() {

branches/beta/src/doc/book/iterators.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ Now that you know more Rust, we can talk in detail about how this works.
1414
Ranges (the `0..10`) are 'iterators'. An iterator is something that we can
1515
call the `.next()` method on repeatedly, and it gives us a sequence of things.
1616

17+
(By the way, a range with two dots like `0..10` is inclusive on the left (so it
18+
starts at 0) and exclusive on the right (so it ends at 9). A mathematician
19+
would write "[0, 10)". To get a range that goes all the way up to 10 you can
20+
write `0...10`.)
21+
1722
Like this:
1823

1924
```rust

branches/beta/src/doc/book/syntax-index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@
6666
* `..` (`..`, `expr..`, `..expr`, `expr..expr`): right-exclusive range literal.
6767
* `..` (`..expr`): struct literal update syntax. See [Structs (Update syntax)].
6868
* `..` (`variant(x, ..)`, `struct_type { x, .. }`): "and the rest" pattern binding. See [Patterns (Ignoring bindings)].
69-
* `...` (`expr ... expr`): inclusive range pattern. See [Patterns (Ranges)].
69+
* `...` (`...expr`, `expr...expr`) *in an expression*: inclusive range expression. See [Iterators].
70+
* `...` (`expr...expr`) *in a pattern*: inclusive range pattern. See [Patterns (Ranges)].
7071
* `/` (`expr / expr`): arithmetic division. Overloadable (`Div`).
7172
* `/=` (`var /= expr`): arithmetic division & assignment.
7273
* `:` (`pat: type`, `ident: type`): constraints. See [Variable Bindings], [Functions], [Structs], [Traits].
@@ -205,6 +206,7 @@
205206
[Functions (Early Returns)]: functions.html#early-returns
206207
[Functions]: functions.html
207208
[Generics]: generics.html
209+
[Iterators]: iterators.html
208210
[Lifetimes]: lifetimes.html
209211
[Loops (`for`)]: loops.html#for
210212
[Loops (`loop`)]: loops.html#loop

branches/beta/src/doc/book/vectors.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,36 @@ for i in v {
115115
}
116116
```
117117

118+
Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
119+
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
120+
For example, the following code does not compile.
121+
122+
```rust,ignore
123+
let mut v = vec![1, 2, 3, 4, 5];
124+
125+
for i in v {
126+
println!("Take ownership of the vector and its element {}", i);
127+
}
128+
129+
for i in v {
130+
println!("Take ownership of the vector and its element {}", i);
131+
}
132+
```
133+
134+
Whereas the following works perfectly,
135+
136+
```rust
137+
let mut v = vec![1, 2, 3, 4, 5];
138+
139+
for i in &v {
140+
println!("This is a reference to {}", i);
141+
}
142+
143+
for i in &v {
144+
println!("This is a reference to {}", i);
145+
}
146+
```
147+
118148
Vectors have many more useful methods, which you can read about in [their
119149
API documentation][vec].
120150

branches/beta/src/doc/reference.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,10 @@ The currently implemented features of the reference compiler are:
22772277
`#[derive_Foo] #[derive_Bar]`, which can be user-defined syntax
22782278
extensions.
22792279

2280+
* `inclusive_range_syntax` - Allows use of the `a...b` and `...b` syntax for inclusive ranges.
2281+
2282+
* `inclusive_range` - Allows use of the types that represent desugared inclusive ranges.
2283+
22802284
* `intrinsics` - Allows use of the "rust-intrinsics" ABI. Compiler intrinsics
22812285
are inherently unstable and no promise about them is made.
22822286

@@ -2747,6 +2751,25 @@ let y = 0..10;
27472751
assert_eq!(x, y);
27482752
```
27492753

2754+
Similarly, the `...` operator will construct an object of one of the
2755+
`std::ops::RangeInclusive` variants.
2756+
2757+
```
2758+
# #![feature(inclusive_range_syntax)]
2759+
1...2; // std::ops::RangeInclusive
2760+
...4; // std::ops::RangeToInclusive
2761+
```
2762+
2763+
The following expressions are equivalent.
2764+
2765+
```
2766+
# #![feature(inclusive_range_syntax, inclusive_range)]
2767+
let x = std::ops::RangeInclusive::NonEmpty {start: 0, end: 10};
2768+
let y = 0...10;
2769+
2770+
assert_eq!(x, y);
2771+
```
2772+
27502773
### Unary operator expressions
27512774

27522775
Rust defines the following unary operators. They are all written as prefix operators,

branches/beta/src/jemalloc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit e24a1a025a1f214e40eedafe3b9c7b1d69937922
1+
Subproject commit aab1c0a0e0b39825b16673128729ef46310a5da8

branches/beta/src/libcollections/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#![feature(fmt_internals)]
4141
#![feature(fmt_radix)]
4242
#![feature(heap_api)]
43-
#![feature(iter_arith)]
43+
#![feature(inclusive_range)]
4444
#![feature(iter_arith)]
4545
#![feature(lang_items)]
4646
#![feature(nonzero)]

branches/beta/src/libcollections/range.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ pub trait RangeArgument<T> {
3535
}
3636
}
3737

38+
// FIXME add inclusive ranges to RangeArgument
3839

3940
impl<T> RangeArgument<T> for RangeFull {}
4041

branches/beta/src/libcollections/string.rs

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use core::fmt;
5959
use core::hash;
6060
use core::iter::FromIterator;
6161
use core::mem;
62-
use core::ops::{self, Add};
62+
use core::ops::{self, Add, Index, IndexMut};
6363
use core::ptr;
6464
use core::slice;
6565
use core::str::pattern::Pattern;
@@ -1606,6 +1606,24 @@ impl ops::Index<ops::RangeFull> for String {
16061606
unsafe { str::from_utf8_unchecked(&self.vec) }
16071607
}
16081608
}
1609+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1610+
impl ops::Index<ops::RangeInclusive<usize>> for String {
1611+
type Output = str;
1612+
1613+
#[inline]
1614+
fn index(&self, index: ops::RangeInclusive<usize>) -> &str {
1615+
Index::index(&**self, index)
1616+
}
1617+
}
1618+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1619+
impl ops::Index<ops::RangeToInclusive<usize>> for String {
1620+
type Output = str;
1621+
1622+
#[inline]
1623+
fn index(&self, index: ops::RangeToInclusive<usize>) -> &str {
1624+
Index::index(&**self, index)
1625+
}
1626+
}
16091627

16101628
#[stable(feature = "derefmut_for_string", since = "1.2.0")]
16111629
impl ops::IndexMut<ops::Range<usize>> for String {
@@ -1635,6 +1653,20 @@ impl ops::IndexMut<ops::RangeFull> for String {
16351653
unsafe { mem::transmute(&mut *self.vec) }
16361654
}
16371655
}
1656+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1657+
impl ops::IndexMut<ops::RangeInclusive<usize>> for String {
1658+
#[inline]
1659+
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut str {
1660+
IndexMut::index_mut(&mut **self, index)
1661+
}
1662+
}
1663+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1664+
impl ops::IndexMut<ops::RangeToInclusive<usize>> for String {
1665+
#[inline]
1666+
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut str {
1667+
IndexMut::index_mut(&mut **self, index)
1668+
}
1669+
}
16381670

16391671
#[stable(feature = "rust1", since = "1.0.0")]
16401672
impl ops::Deref for String {

branches/beta/src/libcollections/vec.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,24 @@ impl<T> ops::Index<ops::RangeFull> for Vec<T> {
12261226
self
12271227
}
12281228
}
1229+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1230+
impl<T> ops::Index<ops::RangeInclusive<usize>> for Vec<T> {
1231+
type Output = [T];
1232+
1233+
#[inline]
1234+
fn index(&self, index: ops::RangeInclusive<usize>) -> &[T] {
1235+
Index::index(&**self, index)
1236+
}
1237+
}
1238+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1239+
impl<T> ops::Index<ops::RangeToInclusive<usize>> for Vec<T> {
1240+
type Output = [T];
1241+
1242+
#[inline]
1243+
fn index(&self, index: ops::RangeToInclusive<usize>) -> &[T] {
1244+
Index::index(&**self, index)
1245+
}
1246+
}
12291247

12301248
#[stable(feature = "rust1", since = "1.0.0")]
12311249
impl<T> ops::IndexMut<ops::Range<usize>> for Vec<T> {
@@ -1255,6 +1273,20 @@ impl<T> ops::IndexMut<ops::RangeFull> for Vec<T> {
12551273
self
12561274
}
12571275
}
1276+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1277+
impl<T> ops::IndexMut<ops::RangeInclusive<usize>> for Vec<T> {
1278+
#[inline]
1279+
fn index_mut(&mut self, index: ops::RangeInclusive<usize>) -> &mut [T] {
1280+
IndexMut::index_mut(&mut **self, index)
1281+
}
1282+
}
1283+
#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")]
1284+
impl<T> ops::IndexMut<ops::RangeToInclusive<usize>> for Vec<T> {
1285+
#[inline]
1286+
fn index_mut(&mut self, index: ops::RangeToInclusive<usize>) -> &mut [T] {
1287+
IndexMut::index_mut(&mut **self, index)
1288+
}
1289+
}
12581290

12591291
#[stable(feature = "rust1", since = "1.0.0")]
12601292
impl<T> ops::Deref for Vec<T> {

0 commit comments

Comments
 (0)