Skip to content

Commit 2f247d5

Browse files
author
Jorge Aparicio
committed
---
yaml --- r: 157687 b: refs/heads/snap-stage3 c: eef7e97 h: refs/heads/master i: 157685: 511bdb7 157683: 8554942 157679: 84cf7c2 v: v3
1 parent 94c8781 commit 2f247d5

File tree

260 files changed

+1476
-1190
lines changed

Some content is hidden

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

260 files changed

+1476
-1190
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 065caf34f5ff29e04605f95d9c5d511af219439a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 221fc1e3cdcc208e1bb7debcc2de27d47c847747
4+
refs/heads/snap-stage3: eef7e970172df38358cf25c386a4ec79a7b61b0b
55
refs/heads/try: 0ee4d8b0b112c608646fa75463ab4dc59132efd9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/compiletest/runtest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1013,7 +1013,7 @@ fn check_expected_errors(expected_errors: Vec<errors::ExpectedError> ,
10131013
if prefix_matches(line, prefixes[i].as_slice()) &&
10141014
line.contains(ee.kind.as_slice()) &&
10151015
line.contains(ee.msg.as_slice()) {
1016-
found_flags[i] = true;
1016+
*found_flags.get_mut(i) = true;
10171017
was_expected = true;
10181018
break;
10191019
}

branches/snap-stage3/src/doc/complement-bugreport.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ release: 0.12.0
4747
```
4848

4949
Finally, if you can run the offending command under gdb, pasting a stack trace can be
50-
useful; to do so, you will need to set a breakpoint on `rust_panic`.
50+
useful; to do so, you will need to set a breakpoint on `rust_fail`.
5151

5252
# I submitted a bug, but nobody has commented on it!
5353

branches/snap-stage3/src/doc/guide-lifetimes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ a reference.
5656
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
5757
let x_d = p1.x - p2.x;
5858
let y_d = p1.y - p2.y;
59-
(x_d * x_d + y_d * y_d).sqrt()
59+
sqrt(x_d * x_d + y_d * y_d)
6060
}
6161
~~~
6262

branches/snap-stage3/src/doc/reference.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,7 +1153,7 @@ exposing an API making it possible for it to occur in safe code.
11531153

11541154
* Data races
11551155
* Dereferencing a null/dangling raw pointer
1156-
* Mutating an immutable value/reference without `UnsafeCell`
1156+
* Mutating an immutable value/reference
11571157
* Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values)
11581158
(uninitialized) memory
11591159
* Breaking the [pointer aliasing
@@ -1166,14 +1166,11 @@ exposing an API making it possible for it to occur in safe code.
11661166
* Using `std::ptr::copy_nonoverlapping_memory` (`memcpy32`/`memcpy64`
11671167
instrinsics) on overlapping buffers
11681168
* Invalid values in primitive types, even in private fields/locals:
1169-
* Dangling/null references or boxes
1169+
* Dangling/null pointers in non-raw pointers, or slices
11701170
* A value other than `false` (0) or `true` (1) in a `bool`
11711171
* A discriminant in an `enum` not included in the type definition
11721172
* A value in a `char` which is a surrogate or above `char::MAX`
11731173
* non-UTF-8 byte sequences in a `str`
1174-
* Unwinding into Rust from foreign code or unwinding from Rust into foreign
1175-
code. Rust's failure system is not compatible with exception handling in
1176-
other languages. Unwinding must be caught and handled at FFI boundaries.
11771174

11781175
##### Behaviour not considered unsafe
11791176

branches/snap-stage3/src/doc/rustdoc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ testing this code, the `fib` function will be included (so it can compile).
221221

222222
Running tests often requires some special configuration to filter tests, find
223223
libraries, or try running ignored examples. The testing framework that rustdoc
224-
uses is built on crate `test`, which is also used when you compile crates with
224+
uses is build on crate `test`, which is also used when you compile crates with
225225
rustc's `--test` flag. Extra arguments can be passed to rustdoc's test harness
226226
with the `--test-args` flag.
227227

branches/snap-stage3/src/grammar/verify.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ fn parse_token_list(file: &str) -> HashMap<String, Token> {
5959
"FLOAT_SUFFIX" => id(),
6060
"INT_SUFFIX" => id(),
6161
"SHL" => token::BinOp(token::Shl),
62-
"LBRACE" => token::OpenDelim(token::Brace),
62+
"LBRACE" => token::LBrace,
6363
"RARROW" => token::Rarrow,
6464
"LIT_STR" => token::LitStr(Name(0)),
6565
"DOTDOT" => token::DotDot,
6666
"MOD_SEP" => token::ModSep,
6767
"DOTDOTDOT" => token::DotDotDot,
6868
"NOT" => token::Not,
6969
"AND" => token::BinOp(token::And),
70-
"LPAREN" => token::OpenDelim(token::Paren),
70+
"LPAREN" => token::LParen,
7171
"ANDAND" => token::AndAnd,
7272
"AT" => token::At,
73-
"LBRACKET" => token::OpenDelim(token::Bracket),
73+
"LBRACKET" => token::LBracket,
7474
"LIT_STR_RAW" => token::LitStrRaw(Name(0), 0),
75-
"RPAREN" => token::CloseDelim(token::Paren),
75+
"RPAREN" => token::RParen,
7676
"SLASH" => token::BinOp(token::Slash),
7777
"COMMA" => token::Comma,
7878
"LIFETIME" => token::Lifetime(ast::Ident { name: Name(0), ctxt: 0 }),
@@ -83,15 +83,15 @@ fn parse_token_list(file: &str) -> HashMap<String, Token> {
8383
"LIT_CHAR" => token::LitChar(Name(0)),
8484
"LIT_BYTE" => token::LitByte(Name(0)),
8585
"EQ" => token::Eq,
86-
"RBRACKET" => token::CloseDelim(token::Bracket),
86+
"RBRACKET" => token::RBracket,
8787
"COMMENT" => token::Comment,
8888
"DOC_COMMENT" => token::DocComment(Name(0)),
8989
"DOT" => token::Dot,
9090
"EQEQ" => token::EqEq,
9191
"NE" => token::Ne,
9292
"GE" => token::Ge,
9393
"PERCENT" => token::BinOp(token::Percent),
94-
"RBRACE" => token::CloseDelim(token::Brace),
94+
"RBRACE" => token::RBrace,
9595
"BINOP" => token::BinOp(token::Plus),
9696
"POUND" => token::Pound,
9797
"OROR" => token::OrOr,

branches/snap-stage3/src/liballoc/boxed.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
1616
use core::default::Default;
1717
use core::fmt;
1818
use core::intrinsics;
19+
use core::kinds::Sized;
1920
use core::mem;
2021
use core::option::Option;
2122
use core::raw::TraitObject;
@@ -120,7 +121,7 @@ impl BoxAny for Box<Any+'static> {
120121
}
121122
}
122123

123-
impl<T: fmt::Show> fmt::Show for Box<T> {
124+
impl<Sized? T: fmt::Show> fmt::Show for Box<T> {
124125
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
125126
(**self).fmt(f)
126127
}

branches/snap-stage3/src/libarena/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
html_root_url = "http://doc.rust-lang.org/nightly/")]
3030

3131
#![feature(unsafe_destructor)]
32-
#![allow(missing_docs)]
32+
#![allow(missing_doc)]
3333

3434
use std::cell::{Cell, RefCell};
3535
use std::cmp;
@@ -208,13 +208,13 @@ impl Arena {
208208
}
209209

210210
#[inline]
211-
fn alloc_copy<T>(&self, op: || -> T) -> &mut T {
211+
fn alloc_copy<T>(&self, op: || -> T) -> &T {
212212
unsafe {
213213
let ptr = self.alloc_copy_inner(mem::size_of::<T>(),
214214
mem::min_align_of::<T>());
215215
let ptr = ptr as *mut T;
216216
ptr::write(&mut (*ptr), op());
217-
return &mut *ptr;
217+
return &*ptr;
218218
}
219219
}
220220

@@ -262,7 +262,7 @@ impl Arena {
262262
}
263263

264264
#[inline]
265-
fn alloc_noncopy<T>(&self, op: || -> T) -> &mut T {
265+
fn alloc_noncopy<T>(&self, op: || -> T) -> &T {
266266
unsafe {
267267
let tydesc = get_tydesc::<T>();
268268
let (ty_ptr, ptr) =
@@ -279,14 +279,14 @@ impl Arena {
279279
// the object is there.
280280
*ty_ptr = bitpack_tydesc_ptr(tydesc, true);
281281

282-
return &mut *ptr;
282+
return &*ptr;
283283
}
284284
}
285285

286286
/// Allocates a new item in the arena, using `op` to initialize the value,
287287
/// and returns a reference to it.
288288
#[inline]
289-
pub fn alloc<T>(&self, op: || -> T) -> &mut T {
289+
pub fn alloc<T>(&self, op: || -> T) -> &T {
290290
unsafe {
291291
if intrinsics::needs_drop::<T>() {
292292
self.alloc_noncopy(op)
@@ -458,12 +458,12 @@ impl<T> TypedArena<T> {
458458

459459
/// Allocates an object in the `TypedArena`, returning a reference to it.
460460
#[inline]
461-
pub fn alloc(&self, object: T) -> &mut T {
461+
pub fn alloc(&self, object: T) -> &T {
462462
if self.ptr == self.end {
463463
self.grow()
464464
}
465465

466-
let ptr: &mut T = unsafe {
466+
let ptr: &T = unsafe {
467467
let ptr: &mut T = mem::transmute(self.ptr);
468468
ptr::write(ptr, object);
469469
self.ptr.set(self.ptr.get().offset(1));

branches/snap-stage3/src/libcollections/bitv.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl Bitv {
243243
let used_bits = bitv.nbits % u32::BITS;
244244
if init && used_bits != 0 {
245245
let largest_used_word = (bitv.nbits + u32::BITS - 1) / u32::BITS - 1;
246-
bitv.storage[largest_used_word] &= (1 << used_bits) - 1;
246+
*bitv.storage.get_mut(largest_used_word) &= (1 << used_bits) - 1;
247247
}
248248

249249
bitv
@@ -297,9 +297,8 @@ impl Bitv {
297297
let w = i / u32::BITS;
298298
let b = i % u32::BITS;
299299
let flag = 1 << b;
300-
let val = if x { self.storage[w] | flag }
301-
else { self.storage[w] & !flag };
302-
self.storage[w] = val;
300+
*self.storage.get_mut(w) = if x { self.storage[w] | flag }
301+
else { self.storage[w] & !flag };
303302
}
304303

305304
/// Sets all bits to 1.
@@ -618,7 +617,7 @@ impl Bitv {
618617
self.storage.truncate(word_len);
619618
if len % u32::BITS > 0 {
620619
let mask = (1 << len % u32::BITS) - 1;
621-
self.storage[word_len - 1] &= mask;
620+
*self.storage.get_mut(word_len - 1) &= mask;
622621
}
623622
}
624623
}
@@ -682,15 +681,15 @@ impl Bitv {
682681
let overhang = self.nbits % u32::BITS; // # of already-used bits
683682
let mask = !((1 << overhang) - 1); // e.g. 5 unused bits => 111110....0
684683
if value {
685-
self.storage[old_last_word] |= mask;
684+
*self.storage.get_mut(old_last_word) |= mask;
686685
} else {
687-
self.storage[old_last_word] &= !mask;
686+
*self.storage.get_mut(old_last_word) &= !mask;
688687
}
689688
}
690689
// Fill in words after the old tail word
691690
let stop_idx = cmp::min(self.storage.len(), new_nwords);
692691
for idx in range(old_last_word + 1, stop_idx) {
693-
self.storage[idx] = full_value;
692+
*self.storage.get_mut(idx) = full_value;
694693
}
695694
// Allocate new words, if needed
696695
if new_nwords > self.storage.len() {
@@ -701,7 +700,7 @@ impl Bitv {
701700
if value {
702701
let tail_word = new_nwords - 1;
703702
let used_bits = new_nbits % u32::BITS;
704-
self.storage[tail_word] &= (1 << used_bits) - 1;
703+
*self.storage.get_mut(tail_word) &= (1 << used_bits) - 1;
705704
}
706705
}
707706
// Adjust internal bit count
@@ -729,7 +728,7 @@ impl Bitv {
729728
let ret = self.get(self.nbits - 1);
730729
// If we are unusing a whole word, make sure it is zeroed out
731730
if self.nbits % u32::BITS == 1 {
732-
self.storage[self.nbits / u32::BITS] = 0;
731+
*self.storage.get_mut(self.nbits / u32::BITS) = 0;
733732
}
734733
self.nbits -= 1;
735734
ret
@@ -1185,7 +1184,7 @@ impl BitvSet {
11851184
for (i, w) in other_words {
11861185
let old = self_bitv.storage[i];
11871186
let new = f(old, w);
1188-
self_bitv.storage[i] = new;
1187+
*self_bitv.storage.get_mut(i) = new;
11891188
}
11901189
}
11911190

branches/snap-stage3/src/libcollections/btree/map.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -690,12 +690,6 @@ impl<K: Ord, V> Index<K, V> for BTreeMap<K, V> {
690690
}
691691
}
692692

693-
impl<K: Ord, V> IndexMut<K, V> for BTreeMap<K, V> {
694-
fn index_mut(&mut self, key: &K) -> &mut V {
695-
self.find_mut(key).expect("no entry found for key")
696-
}
697-
}
698-
699693
/// Genericises over how to get the correct type of iterator from the correct type
700694
/// of Node ownership.
701695
trait Traverse<N> {

branches/snap-stage3/src/libcollections/priority_queue.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
//! let mut pq = PriorityQueue::new();
7272
//!
7373
//! // We're at `start`, with a zero cost
74-
//! dist[start] = 0u;
74+
//! *dist.get_mut(start) = 0u;
7575
//! pq.push(State { cost: 0u, position: start });
7676
//!
7777
//! // Examine the frontier with lower cost nodes first (min-heap)
@@ -96,7 +96,7 @@
9696
//! if next.cost < dist[next.position] {
9797
//! pq.push(next);
9898
//! // Relaxation, we have now found a better way
99-
//! dist[next.position] = next.cost;
99+
//! *dist.get_mut(next.position) = next.cost;
100100
//! }
101101
//! }
102102
//! }
@@ -151,7 +151,7 @@
151151
//! }
152152
//! ```
153153
154-
#![allow(missing_docs)]
154+
#![allow(missing_doc)]
155155

156156
use core::prelude::*;
157157

@@ -330,7 +330,7 @@ impl<T: Ord> PriorityQueue<T> {
330330
None => { None }
331331
Some(mut item) => {
332332
if !self.is_empty() {
333-
swap(&mut item, &mut self.data[0]);
333+
swap(&mut item, self.data.get_mut(0));
334334
self.siftdown(0);
335335
}
336336
Some(item)
@@ -378,7 +378,7 @@ impl<T: Ord> PriorityQueue<T> {
378378
/// ```
379379
pub fn push_pop(&mut self, mut item: T) -> T {
380380
if !self.is_empty() && *self.top().unwrap() > item {
381-
swap(&mut item, &mut self.data[0]);
381+
swap(&mut item, self.data.get_mut(0));
382382
self.siftdown(0);
383383
}
384384
item
@@ -402,7 +402,7 @@ impl<T: Ord> PriorityQueue<T> {
402402
/// ```
403403
pub fn replace(&mut self, mut item: T) -> Option<T> {
404404
if !self.is_empty() {
405-
swap(&mut item, &mut self.data[0]);
405+
swap(&mut item, self.data.get_mut(0));
406406
self.siftdown(0);
407407
Some(item)
408408
} else {
@@ -462,40 +462,40 @@ impl<T: Ord> PriorityQueue<T> {
462462
// compared to using swaps, which involves twice as many moves.
463463
fn siftup(&mut self, start: uint, mut pos: uint) {
464464
unsafe {
465-
let new = replace(&mut self.data[pos], zeroed());
465+
let new = replace(self.data.get_mut(pos), zeroed());
466466

467467
while pos > start {
468468
let parent = (pos - 1) >> 1;
469469
if new > self.data[parent] {
470-
let x = replace(&mut self.data[parent], zeroed());
471-
ptr::write(&mut self.data[pos], x);
470+
let x = replace(self.data.get_mut(parent), zeroed());
471+
ptr::write(self.data.get_mut(pos), x);
472472
pos = parent;
473473
continue
474474
}
475475
break
476476
}
477-
ptr::write(&mut self.data[pos], new);
477+
ptr::write(self.data.get_mut(pos), new);
478478
}
479479
}
480480

481481
fn siftdown_range(&mut self, mut pos: uint, end: uint) {
482482
unsafe {
483483
let start = pos;
484-
let new = replace(&mut self.data[pos], zeroed());
484+
let new = replace(self.data.get_mut(pos), zeroed());
485485

486486
let mut child = 2 * pos + 1;
487487
while child < end {
488488
let right = child + 1;
489489
if right < end && !(self.data[child] > self.data[right]) {
490490
child = right;
491491
}
492-
let x = replace(&mut self.data[child], zeroed());
493-
ptr::write(&mut self.data[pos], x);
492+
let x = replace(self.data.get_mut(child), zeroed());
493+
ptr::write(self.data.get_mut(pos), x);
494494
pos = child;
495495
child = 2 * pos + 1;
496496
}
497497

498-
ptr::write(&mut self.data[pos], new);
498+
ptr::write(self.data.get_mut(pos), new);
499499
self.siftup(start, pos);
500500
}
501501
}

0 commit comments

Comments
 (0)