Skip to content

Commit 3624e2c

Browse files
committed
---
yaml --- r: 196157 b: refs/heads/tmp c: 03c2f33 h: refs/heads/master i: 196155: e106072 v: v3
1 parent 795bf5d commit 3624e2c

File tree

121 files changed

+2174
-2026
lines changed

Some content is hidden

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

121 files changed

+2174
-2026
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3232
refs/heads/beta: 9854143cba679834bc4ef932858cd5303f015a0e
3333
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3434
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
35-
refs/heads/tmp: edc096d820c549319aaa9662412beb2deec39441
35+
refs/heads/tmp: 03c2f33699ba1efde47dae3162578af4e66dba8a
3636
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3737
refs/tags/homu-tmp: 53a183f0274316596bf9405944d4f0468d8c93e4
3838
refs/heads/gate: 97c84447b65164731087ea82685580cc81424412

branches/tmp/mk/crates.mk

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,18 @@ ONLY_RLIB_rustc_bitflags := 1
125125
# On channels where the only usable crate is std, only build documentation for
126126
# std. This keeps distributions small and doesn't clutter up the API docs with
127127
# confusing internal details from the crates behind the facade.
128+
#
129+
# (Disabled while cmr figures out how to change rustdoc to make reexports work
130+
# slightly nicer. Otherwise, all cross-crate links to Vec will go to
131+
# libcollections, breaking them, and [src] links for anything reexported will
132+
# not work.)
128133

129-
ifeq ($(CFG_RELEASE_CHANNEL),stable)
130-
DOC_CRATES := std
131-
else
132-
ifeq ($(CFG_RELEASE_CHANNEL),beta)
133-
DOC_CRATES := std
134-
else
134+
#ifeq ($(CFG_RELEASE_CHANNEL),stable)
135+
#DOC_CRATES := std
136+
#else
137+
#ifeq ($(CFG_RELEASE_CHANNEL),beta)
138+
#DOC_CRATES := std
139+
#else
135140
DOC_CRATES := $(filter-out rustc, \
136141
$(filter-out rustc_trans, \
137142
$(filter-out rustc_typeck, \
@@ -143,8 +148,8 @@ DOC_CRATES := $(filter-out rustc, \
143148
$(filter-out log, \
144149
$(filter-out getopts, \
145150
$(filter-out syntax, $(CRATES))))))))))))
146-
endif
147-
endif
151+
#endif
152+
#endif
148153
COMPILER_DOC_CRATES := rustc rustc_trans rustc_borrowck rustc_resolve \
149154
rustc_typeck rustc_driver syntax rustc_privacy \
150155
rustc_lint

branches/tmp/src/doc/reference.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1188,12 +1188,15 @@ the guarantee that these issues are never caused by safe code.
11881188

11891189
* Data races
11901190
* Dereferencing a null/dangling raw pointer
1191-
* Mutating an immutable value/reference without `UnsafeCell`
11921191
* Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values)
11931192
(uninitialized) memory
11941193
* Breaking the [pointer aliasing
11951194
rules](http://llvm.org/docs/LangRef.html#pointer-aliasing-rules)
11961195
with raw pointers (a subset of the rules used by C)
1196+
* `&mut` and `&` follow LLVM’s scoped [noalias] model, except if the `&T`
1197+
contains an `UnsafeCell<U>`. Unsafe code must not violate these aliasing
1198+
guarantees.
1199+
* Mutating an immutable value/reference without `UnsafeCell<U>`
11971200
* Invoking undefined behavior via compiler intrinsics:
11981201
* Indexing outside of the bounds of an object with `std::ptr::offset`
11991202
(`offset` intrinsic), with
@@ -1210,6 +1213,8 @@ the guarantee that these issues are never caused by safe code.
12101213
code. Rust's failure system is not compatible with exception handling in
12111214
other languages. Unwinding must be caught and handled at FFI boundaries.
12121215

1216+
[noalias]: http://llvm.org/docs/LangRef.html#noalias
1217+
12131218
##### Behaviour not considered unsafe
12141219

12151220
This is a list of behaviour not considered *unsafe* in Rust terms, but that may

branches/tmp/src/doc/trpl/method-syntax.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ parameter, of which there are three variants: `self`, `&self`, and `&mut self`.
5050
You can think of this first parameter as being the `x` in `x.foo()`. The three
5151
variants correspond to the three kinds of thing `x` could be: `self` if it's
5252
just a value on the stack, `&self` if it's a reference, and `&mut self` if it's
53-
a mutable reference. We should default to using `&self`, as it's the most
54-
common, as Rustaceans prefer borrowing over taking ownership, and references
55-
over mutable references. Here's an example of all three variants:
53+
a mutable reference. We should default to using `&self`, as you should prefer
54+
borrowing over taking ownership, as well as taking immutable references
55+
over mutable ones. Here's an example of all three variants:
5656

5757
```rust
5858
struct Circle {
@@ -181,17 +181,23 @@ impl Circle {
181181
}
182182
183183
struct CircleBuilder {
184-
coordinate: f64,
184+
x: f64,
185+
y: f64,
185186
radius: f64,
186187
}
187188
188189
impl CircleBuilder {
189190
fn new() -> CircleBuilder {
190-
CircleBuilder { coordinate: 0.0, radius: 0.0, }
191+
CircleBuilder { x: 0.0, y: 0.0, radius: 0.0, }
192+
}
193+
194+
fn x(&mut self, coordinate: f64) -> &mut CircleBuilder {
195+
self.x = coordinate;
196+
self
191197
}
192198
193-
fn coordinate(&mut self, coordinate: f64) -> &mut CircleBuilder {
194-
self.coordinate = coordinate;
199+
fn y(&mut self, coordinate: f64) -> &mut CircleBuilder {
200+
self.x = coordinate;
195201
self
196202
}
197203
@@ -201,18 +207,20 @@ impl CircleBuilder {
201207
}
202208
203209
fn finalize(&self) -> Circle {
204-
Circle { x: self.coordinate, y: self.coordinate, radius: self.radius }
210+
Circle { x: self.x, y: self.y, radius: self.radius }
205211
}
206212
}
207213
208214
fn main() {
209215
let c = CircleBuilder::new()
210-
.coordinate(10.0)
211-
.radius(5.0)
216+
.x(1.0)
217+
.y(2.0)
218+
.radius(2.0)
212219
.finalize();
213220
214-
215221
println!("area: {}", c.area());
222+
println!("x: {}", c.x);
223+
println!("y: {}", c.y);
216224
}
217225
```
218226

branches/tmp/src/doc/trpl/ownership.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,15 @@ thread-safe counterpart of `Rc<T>`.
472472

473473
## Lifetime Elision
474474

475-
Earlier, we mentioned *lifetime elision*, a feature of Rust which allows you to
476-
not write lifetime annotations in certain circumstances. All references have a
477-
lifetime, and so if you elide a lifetime (like `&T` instead of `&'a T`), Rust
478-
will do three things to determine what those lifetimes should be.
475+
Rust supports powerful local type inference in function bodies, but it’s
476+
forbidden in item signatures to allow reasoning about the types just based in
477+
the item signature alone. However, for ergonomic reasons a very restricted
478+
secondary inference algorithm called “lifetime elision” applies in function
479+
signatures. It infers only based on the signature components themselves and not
480+
based on the body of the function, only infers lifetime paramters, and does
481+
this with only three easily memorizable and unambiguous rules. This makes
482+
lifetime elision a shorthand for writing an item signature, while not hiding
483+
away the actual types involved as full local inference would if applied to it.
479484

480485
When talking about lifetime elision, we use the term *input lifetime* and
481486
*output lifetime*. An *input lifetime* is a lifetime associated with a parameter

branches/tmp/src/doc/trpl/testing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ pub fn add_two(a: i32) -> i32 {
231231
}
232232
233233
#[cfg(test)]
234-
mod tests {
234+
mod test {
235235
use super::add_two;
236236
237237
#[test]
@@ -241,7 +241,7 @@ mod tests {
241241
}
242242
```
243243

244-
There's a few changes here. The first is the introduction of a `mod tests` with
244+
There's a few changes here. The first is the introduction of a `mod test` with
245245
a `cfg` attribute. The module allows us to group all of our tests together, and
246246
to also define helper functions if needed, that don't become a part of the rest
247247
of our crate. The `cfg` attribute only compiles our test code if we're
@@ -260,7 +260,7 @@ pub fn add_two(a: i32) -> i32 {
260260
}
261261
262262
#[cfg(test)]
263-
mod tests {
263+
mod test {
264264
use super::*;
265265
266266
#[test]

branches/tmp/src/liballoc/heap.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ mod imp {
189189
use core::option::Option;
190190
use core::option::Option::None;
191191
use core::ptr::{null_mut, null};
192-
use core::num::Int;
193192
use libc::{c_char, c_int, c_void, size_t};
194193
use super::MIN_ALIGN;
195194

@@ -301,7 +300,7 @@ mod imp {
301300
libc::realloc(ptr as *mut libc::c_void, size as libc::size_t) as *mut u8
302301
} else {
303302
let new_ptr = allocate(size, align);
304-
ptr::copy(new_ptr, ptr, cmp::min(size, old_size));
303+
ptr::copy(ptr, new_ptr, cmp::min(size, old_size));
305304
deallocate(ptr, old_size, align);
306305
new_ptr
307306
}

branches/tmp/src/libcollections/bit.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ use core::hash;
9191
use core::iter::RandomAccessIterator;
9292
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat, Cloned};
9393
use core::iter::{self, FromIterator, IntoIterator};
94-
use core::num::Int;
9594
use core::ops::Index;
9695
use core::slice;
9796
use core::{u8, u32, usize};

branches/tmp/src/libcollections/btree/node.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,13 +1133,13 @@ impl<K, V> Node<K, V> {
11331133
#[inline]
11341134
unsafe fn insert_kv(&mut self, index: usize, key: K, val: V) -> &mut V {
11351135
ptr::copy(
1136-
self.keys_mut().as_mut_ptr().offset(index as isize + 1),
11371136
self.keys().as_ptr().offset(index as isize),
1137+
self.keys_mut().as_mut_ptr().offset(index as isize + 1),
11381138
self.len() - index
11391139
);
11401140
ptr::copy(
1141-
self.vals_mut().as_mut_ptr().offset(index as isize + 1),
11421141
self.vals().as_ptr().offset(index as isize),
1142+
self.vals_mut().as_mut_ptr().offset(index as isize + 1),
11431143
self.len() - index
11441144
);
11451145

@@ -1155,8 +1155,8 @@ impl<K, V> Node<K, V> {
11551155
#[inline]
11561156
unsafe fn insert_edge(&mut self, index: usize, edge: Node<K, V>) {
11571157
ptr::copy(
1158-
self.edges_mut().as_mut_ptr().offset(index as isize + 1),
11591158
self.edges().as_ptr().offset(index as isize),
1159+
self.edges_mut().as_mut_ptr().offset(index as isize + 1),
11601160
self.len() - index
11611161
);
11621162
ptr::write(self.edges_mut().get_unchecked_mut(index), edge);
@@ -1188,13 +1188,13 @@ impl<K, V> Node<K, V> {
11881188
let val = ptr::read(self.vals().get_unchecked(index));
11891189

11901190
ptr::copy(
1191-
self.keys_mut().as_mut_ptr().offset(index as isize),
11921191
self.keys().as_ptr().offset(index as isize + 1),
1192+
self.keys_mut().as_mut_ptr().offset(index as isize),
11931193
self.len() - index - 1
11941194
);
11951195
ptr::copy(
1196-
self.vals_mut().as_mut_ptr().offset(index as isize),
11971196
self.vals().as_ptr().offset(index as isize + 1),
1197+
self.vals_mut().as_mut_ptr().offset(index as isize),
11981198
self.len() - index - 1
11991199
);
12001200

@@ -1209,8 +1209,8 @@ impl<K, V> Node<K, V> {
12091209
let edge = ptr::read(self.edges().get_unchecked(index));
12101210

12111211
ptr::copy(
1212-
self.edges_mut().as_mut_ptr().offset(index as isize),
12131212
self.edges().as_ptr().offset(index as isize + 1),
1213+
self.edges_mut().as_mut_ptr().offset(index as isize),
12141214
// index can be == len+1, so do the +1 first to avoid underflow.
12151215
(self.len() + 1) - index
12161216
);
@@ -1237,19 +1237,19 @@ impl<K, V> Node<K, V> {
12371237
right._len = self.len() / 2;
12381238
let right_offset = self.len() - right.len();
12391239
ptr::copy_nonoverlapping(
1240-
right.keys_mut().as_mut_ptr(),
12411240
self.keys().as_ptr().offset(right_offset as isize),
1241+
right.keys_mut().as_mut_ptr(),
12421242
right.len()
12431243
);
12441244
ptr::copy_nonoverlapping(
1245-
right.vals_mut().as_mut_ptr(),
12461245
self.vals().as_ptr().offset(right_offset as isize),
1246+
right.vals_mut().as_mut_ptr(),
12471247
right.len()
12481248
);
12491249
if !self.is_leaf() {
12501250
ptr::copy_nonoverlapping(
1251-
right.edges_mut().as_mut_ptr(),
12521251
self.edges().as_ptr().offset(right_offset as isize),
1252+
right.edges_mut().as_mut_ptr(),
12531253
right.len() + 1
12541254
);
12551255
}
@@ -1278,19 +1278,19 @@ impl<K, V> Node<K, V> {
12781278
ptr::write(self.vals_mut().get_unchecked_mut(old_len), val);
12791279

12801280
ptr::copy_nonoverlapping(
1281-
self.keys_mut().as_mut_ptr().offset(old_len as isize + 1),
12821281
right.keys().as_ptr(),
1282+
self.keys_mut().as_mut_ptr().offset(old_len as isize + 1),
12831283
right.len()
12841284
);
12851285
ptr::copy_nonoverlapping(
1286-
self.vals_mut().as_mut_ptr().offset(old_len as isize + 1),
12871286
right.vals().as_ptr(),
1287+
self.vals_mut().as_mut_ptr().offset(old_len as isize + 1),
12881288
right.len()
12891289
);
12901290
if !self.is_leaf() {
12911291
ptr::copy_nonoverlapping(
1292-
self.edges_mut().as_mut_ptr().offset(old_len as isize + 1),
12931292
right.edges().as_ptr(),
1293+
self.edges_mut().as_mut_ptr().offset(old_len as isize + 1),
12941294
right.len() + 1
12951295
);
12961296
}

branches/tmp/src/libcollections/enum_set.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use core::prelude::*;
1717
use core::marker;
1818
use core::fmt;
19-
use core::num::Int;
2019
use core::iter::{FromIterator, IntoIterator};
2120
use core::ops::{Sub, BitOr, BitAnd, BitXor};
2221

branches/tmp/src/libcollections/slice.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ use core::iter::MultiplicativeIterator;
8989
use core::marker::Sized;
9090
use core::mem::size_of;
9191
use core::mem;
92+
#[cfg(stage0)]
9293
use core::num::wrapping::WrappingOps;
9394
use core::ops::FnMut;
9495
use core::option::Option::{self, Some, None};
@@ -1320,10 +1321,10 @@ fn insertion_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> O
13201321

13211322
if i != j {
13221323
let tmp = ptr::read(read_ptr);
1323-
ptr::copy(buf_v.offset(j + 1),
1324-
&*buf_v.offset(j),
1324+
ptr::copy(&*buf_v.offset(j),
1325+
buf_v.offset(j + 1),
13251326
(i - j) as usize);
1326-
ptr::copy_nonoverlapping(buf_v.offset(j), &tmp, 1);
1327+
ptr::copy_nonoverlapping(&tmp, buf_v.offset(j), 1);
13271328
mem::forget(tmp);
13281329
}
13291330
}
@@ -1396,10 +1397,10 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
13961397
// j + 1 could be `len` (for the last `i`), but in
13971398
// that case, `i == j` so we don't copy. The
13981399
// `.offset(j)` is always in bounds.
1399-
ptr::copy(buf_dat.offset(j + 1),
1400-
&*buf_dat.offset(j),
1400+
ptr::copy(&*buf_dat.offset(j),
1401+
buf_dat.offset(j + 1),
14011402
i - j as usize);
1402-
ptr::copy_nonoverlapping(buf_dat.offset(j), read_ptr, 1);
1403+
ptr::copy_nonoverlapping(read_ptr, buf_dat.offset(j), 1);
14031404
}
14041405
}
14051406
}
@@ -1447,11 +1448,11 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
14471448
if left == right_start {
14481449
// the number remaining in this run.
14491450
let elems = (right_end as usize - right as usize) / mem::size_of::<T>();
1450-
ptr::copy_nonoverlapping(out, &*right, elems);
1451+
ptr::copy_nonoverlapping(&*right, out, elems);
14511452
break;
14521453
} else if right == right_end {
14531454
let elems = (right_start as usize - left as usize) / mem::size_of::<T>();
1454-
ptr::copy_nonoverlapping(out, &*left, elems);
1455+
ptr::copy_nonoverlapping(&*left, out, elems);
14551456
break;
14561457
}
14571458

@@ -1465,7 +1466,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
14651466
} else {
14661467
step(&mut left)
14671468
};
1468-
ptr::copy_nonoverlapping(out, &*to_copy, 1);
1469+
ptr::copy_nonoverlapping(&*to_copy, out, 1);
14691470
step(&mut out);
14701471
}
14711472
}
@@ -1479,7 +1480,7 @@ fn merge_sort<T, F>(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order
14791480
// write the result to `v` in one go, so that there are never two copies
14801481
// of the same object in `v`.
14811482
unsafe {
1482-
ptr::copy_nonoverlapping(v.as_mut_ptr(), &*buf_dat, len);
1483+
ptr::copy_nonoverlapping(&*buf_dat, v.as_mut_ptr(), len);
14831484
}
14841485

14851486
// increment the pointer, returning the old pointer.

branches/tmp/src/libcollections/str.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818
//! (see below). It is not possible to move out of borrowed strings because they
1919
//! are owned elsewhere.
2020
//!
21-
//! Basic operations are implemented directly by the compiler, but more advanced
22-
//! operations are defined as methods on the `str` type.
23-
//!
2421
//! # Examples
2522
//!
2623
//! Here's some code that uses a `&str`:

0 commit comments

Comments
 (0)