Skip to content

Commit 4571ea3

Browse files
committed
---
yaml --- r: 157247 b: refs/heads/master c: 065caf3 h: refs/heads/master i: 157245: 7b1fb39 157243: 699d502 157239: 2bcda8c 157231: 2cbebbf 157215: f1dbaa2 157183: 648ccd8 v: v3
1 parent 5cbbbdc commit 4571ea3

File tree

259 files changed

+1172
-1441
lines changed

Some content is hidden

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

259 files changed

+1172
-1441
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: eef7e970172df38358cf25c386a4ec79a7b61b0b
2+
refs/heads/master: 065caf34f5ff29e04605f95d9c5d511af219439a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d44ea720fa9dfe062ef06d0eb49a58d4e7e92344
55
refs/heads/try: 6ecdf1fa83d7cdbf44a0091132e9c6580be72275

trunk/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.get_mut(i) = true;
1016+
found_flags[i] = true;
10171017
was_expected = true;
10181018
break;
10191019
}

trunk/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_fail`.
50+
useful; to do so, you will need to set a breakpoint on `rust_panic`.
5151

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

trunk/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-
sqrt(x_d * x_d + y_d * y_d)
59+
(x_d * x_d + y_d * y_d).sqrt()
6060
}
6161
~~~
6262

trunk/src/doc/reference.md

Lines changed: 5 additions & 2 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
1156+
* Mutating an immutable value/reference without `UnsafeCell`
11571157
* Reads of [undef](http://llvm.org/docs/LangRef.html#undefined-values)
11581158
(uninitialized) memory
11591159
* Breaking the [pointer aliasing
@@ -1166,11 +1166,14 @@ 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 pointers in non-raw pointers, or slices
1169+
* Dangling/null references or boxes
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.
11741177

11751178
##### Behaviour not considered unsafe
11761179

trunk/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 build on crate `test`, which is also used when you compile crates with
224+
uses is built 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

trunk/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::LBrace,
62+
"LBRACE" => token::OpenDelim(token::Brace),
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::LParen,
70+
"LPAREN" => token::OpenDelim(token::Paren),
7171
"ANDAND" => token::AndAnd,
7272
"AT" => token::At,
73-
"LBRACKET" => token::LBracket,
73+
"LBRACKET" => token::OpenDelim(token::Bracket),
7474
"LIT_STR_RAW" => token::LitStrRaw(Name(0), 0),
75-
"RPAREN" => token::RParen,
75+
"RPAREN" => token::CloseDelim(token::Paren),
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::RBracket,
86+
"RBRACKET" => token::CloseDelim(token::Bracket),
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::RBrace,
94+
"RBRACE" => token::CloseDelim(token::Brace),
9595
"BINOP" => token::BinOp(token::Plus),
9696
"POUND" => token::Pound,
9797
"OROR" => token::OrOr,

trunk/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_doc)]
32+
#![allow(missing_docs)]
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) -> &T {
211+
fn alloc_copy<T>(&self, op: || -> T) -> &mut 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 &*ptr;
217+
return &mut *ptr;
218218
}
219219
}
220220

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

264264
#[inline]
265-
fn alloc_noncopy<T>(&self, op: || -> T) -> &T {
265+
fn alloc_noncopy<T>(&self, op: || -> T) -> &mut 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 &*ptr;
282+
return &mut *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) -> &T {
289+
pub fn alloc<T>(&self, op: || -> T) -> &mut 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) -> &T {
461+
pub fn alloc(&self, object: T) -> &mut T {
462462
if self.ptr == self.end {
463463
self.grow()
464464
}
465465

466-
let ptr: &T = unsafe {
466+
let ptr: &mut 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));

trunk/src/libcollections/bitv.rs

Lines changed: 11 additions & 10 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.get_mut(largest_used_word) &= (1 << used_bits) - 1;
246+
bitv.storage[largest_used_word] &= (1 << used_bits) - 1;
247247
}
248248

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

304305
/// Sets all bits to 1.
@@ -617,7 +618,7 @@ impl Bitv {
617618
self.storage.truncate(word_len);
618619
if len % u32::BITS > 0 {
619620
let mask = (1 << len % u32::BITS) - 1;
620-
*self.storage.get_mut(word_len - 1) &= mask;
621+
self.storage[word_len - 1] &= mask;
621622
}
622623
}
623624
}
@@ -681,15 +682,15 @@ impl Bitv {
681682
let overhang = self.nbits % u32::BITS; // # of already-used bits
682683
let mask = !((1 << overhang) - 1); // e.g. 5 unused bits => 111110....0
683684
if value {
684-
*self.storage.get_mut(old_last_word) |= mask;
685+
self.storage[old_last_word] |= mask;
685686
} else {
686-
*self.storage.get_mut(old_last_word) &= !mask;
687+
self.storage[old_last_word] &= !mask;
687688
}
688689
}
689690
// Fill in words after the old tail word
690691
let stop_idx = cmp::min(self.storage.len(), new_nwords);
691692
for idx in range(old_last_word + 1, stop_idx) {
692-
*self.storage.get_mut(idx) = full_value;
693+
self.storage[idx] = full_value;
693694
}
694695
// Allocate new words, if needed
695696
if new_nwords > self.storage.len() {
@@ -700,7 +701,7 @@ impl Bitv {
700701
if value {
701702
let tail_word = new_nwords - 1;
702703
let used_bits = new_nbits % u32::BITS;
703-
*self.storage.get_mut(tail_word) &= (1 << used_bits) - 1;
704+
self.storage[tail_word] &= (1 << used_bits) - 1;
704705
}
705706
}
706707
// Adjust internal bit count
@@ -728,7 +729,7 @@ impl Bitv {
728729
let ret = self.get(self.nbits - 1);
729730
// If we are unusing a whole word, make sure it is zeroed out
730731
if self.nbits % u32::BITS == 1 {
731-
*self.storage.get_mut(self.nbits / u32::BITS) = 0;
732+
self.storage[self.nbits / u32::BITS] = 0;
732733
}
733734
self.nbits -= 1;
734735
ret
@@ -1184,7 +1185,7 @@ impl BitvSet {
11841185
for (i, w) in other_words {
11851186
let old = self_bitv.storage[i];
11861187
let new = f(old, w);
1187-
*self_bitv.storage.get_mut(i) = new;
1188+
self_bitv.storage[i] = new;
11881189
}
11891190
}
11901191

trunk/src/libcollections/btree/map.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,12 @@ 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+
693699
/// Genericises over how to get the correct type of iterator from the correct type
694700
/// of Node ownership.
695701
trait Traverse<N> {

trunk/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.get_mut(start) = 0u;
74+
//! dist[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.get_mut(next.position) = next.cost;
99+
//! dist[next.position] = next.cost;
100100
//! }
101101
//! }
102102
//! }
@@ -151,7 +151,7 @@
151151
//! }
152152
//! ```
153153
154-
#![allow(missing_doc)]
154+
#![allow(missing_docs)]
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, self.data.get_mut(0));
333+
swap(&mut item, &mut self.data[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, self.data.get_mut(0));
381+
swap(&mut item, &mut self.data[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, self.data.get_mut(0));
405+
swap(&mut item, &mut self.data[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(self.data.get_mut(pos), zeroed());
465+
let new = replace(&mut self.data[pos], zeroed());
466466

467467
while pos > start {
468468
let parent = (pos - 1) >> 1;
469469
if new > self.data[parent] {
470-
let x = replace(self.data.get_mut(parent), zeroed());
471-
ptr::write(self.data.get_mut(pos), x);
470+
let x = replace(&mut self.data[parent], zeroed());
471+
ptr::write(&mut self.data[pos], x);
472472
pos = parent;
473473
continue
474474
}
475475
break
476476
}
477-
ptr::write(self.data.get_mut(pos), new);
477+
ptr::write(&mut self.data[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(self.data.get_mut(pos), zeroed());
484+
let new = replace(&mut self.data[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(self.data.get_mut(child), zeroed());
493-
ptr::write(self.data.get_mut(pos), x);
492+
let x = replace(&mut self.data[child], zeroed());
493+
ptr::write(&mut self.data[pos], x);
494494
pos = child;
495495
child = 2 * pos + 1;
496496
}
497497

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

0 commit comments

Comments
 (0)