Skip to content

Commit fb3b21d

Browse files
committed
---
yaml --- r: 235607 b: refs/heads/stable c: 225ad17 h: refs/heads/master i: 235605: d4dfd2f 235603: 7b42e35 235599: 98cba9e v: v3
1 parent 1c8eb47 commit fb3b21d

Some content is hidden

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

79 files changed

+363
-1322
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: ed49bad0ccb0e9ee7e5ebea69d72a98bed08f77f
32+
refs/heads/stable: 225ad1752039f6c48189e8e30d4824de691761da
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/libcollections/borrow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'a, B: ?Sized> Clone for Cow<'a, B> where B: ToOwned {
215215
impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
216216
/// Acquires a mutable reference to the owned form of the data.
217217
///
218-
/// Clones the data if it is not already owned.
218+
/// Copies the data if it is not already owned.
219219
///
220220
/// # Examples
221221
///
@@ -241,7 +241,7 @@ impl<'a, B: ?Sized> Cow<'a, B> where B: ToOwned {
241241

242242
/// Extracts the owned data.
243243
///
244-
/// Clones the data if it is not already owned.
244+
/// Copies the data if it is not already owned.
245245
///
246246
/// # Examples
247247
///

branches/stable/src/libcollections/vec_deque.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ impl<T> VecDeque<T> {
108108

109109
/// Writes an element into the buffer, moving it.
110110
#[inline]
111-
unsafe fn buffer_write(&mut self, off: usize, value: T) {
112-
ptr::write(self.ptr().offset(off as isize), value);
111+
unsafe fn buffer_write(&mut self, off: usize, t: T) {
112+
ptr::write(self.ptr().offset(off as isize), t);
113113
}
114114

115115
/// Returns true if and only if the buffer is at capacity
@@ -234,9 +234,9 @@ impl<T> VecDeque<T> {
234234
/// assert_eq!(buf.get(1).unwrap(), &4);
235235
/// ```
236236
#[stable(feature = "rust1", since = "1.0.0")]
237-
pub fn get(&self, index: usize) -> Option<&T> {
238-
if index < self.len() {
239-
let idx = self.wrap_add(self.tail, index);
237+
pub fn get(&self, i: usize) -> Option<&T> {
238+
if i < self.len() {
239+
let idx = self.wrap_add(self.tail, i);
240240
unsafe { Some(&*self.ptr().offset(idx as isize)) }
241241
} else {
242242
None
@@ -261,9 +261,9 @@ impl<T> VecDeque<T> {
261261
/// assert_eq!(buf[1], 7);
262262
/// ```
263263
#[stable(feature = "rust1", since = "1.0.0")]
264-
pub fn get_mut(&mut self, index: usize) -> Option<&mut T> {
265-
if index < self.len() {
266-
let idx = self.wrap_add(self.tail, index);
264+
pub fn get_mut(&mut self, i: usize) -> Option<&mut T> {
265+
if i < self.len() {
266+
let idx = self.wrap_add(self.tail, i);
267267
unsafe { Some(&mut *self.ptr().offset(idx as isize)) }
268268
} else {
269269
None
@@ -768,7 +768,7 @@ impl<T> VecDeque<T> {
768768
/// assert_eq!(d.front(), Some(&2));
769769
/// ```
770770
#[stable(feature = "rust1", since = "1.0.0")]
771-
pub fn push_front(&mut self, value: T) {
771+
pub fn push_front(&mut self, t: T) {
772772
if self.is_full() {
773773
let old_cap = self.cap();
774774
self.buf.double();
@@ -778,7 +778,7 @@ impl<T> VecDeque<T> {
778778

779779
self.tail = self.wrap_sub(self.tail, 1);
780780
let tail = self.tail;
781-
unsafe { self.buffer_write(tail, value); }
781+
unsafe { self.buffer_write(tail, t); }
782782
}
783783

784784
/// Appends an element to the back of a buffer
@@ -794,7 +794,7 @@ impl<T> VecDeque<T> {
794794
/// assert_eq!(3, *buf.back().unwrap());
795795
/// ```
796796
#[stable(feature = "rust1", since = "1.0.0")]
797-
pub fn push_back(&mut self, value: T) {
797+
pub fn push_back(&mut self, t: T) {
798798
if self.is_full() {
799799
let old_cap = self.cap();
800800
self.buf.double();
@@ -804,7 +804,7 @@ impl<T> VecDeque<T> {
804804

805805
let head = self.head;
806806
self.head = self.wrap_add(self.head, 1);
807-
unsafe { self.buffer_write(head, value) }
807+
unsafe { self.buffer_write(head, t) }
808808
}
809809

810810
/// Removes the last element from a buffer and returns it, or `None` if
@@ -905,13 +905,13 @@ impl<T> VecDeque<T> {
905905
self.pop_front()
906906
}
907907

908-
/// Inserts an element at `index` within the `VecDeque`. Whichever
908+
/// Inserts an element at position `i` within the `VecDeque`. Whichever
909909
/// end is closer to the insertion point will be moved to make room,
910910
/// and all the affected elements will be moved to new positions.
911911
///
912912
/// # Panics
913913
///
914-
/// Panics if `index` is greater than `VecDeque`'s length
914+
/// Panics if `i` is greater than `VecDeque`'s length
915915
///
916916
/// # Examples
917917
/// ```
@@ -924,8 +924,8 @@ impl<T> VecDeque<T> {
924924
/// buf.insert(1, 11);
925925
/// assert_eq!(Some(&11), buf.get(1));
926926
/// ```
927-
pub fn insert(&mut self, index: usize, value: T) {
928-
assert!(index <= self.len(), "index out of bounds");
927+
pub fn insert(&mut self, i: usize, t: T) {
928+
assert!(i <= self.len(), "index out of bounds");
929929
if self.is_full() {
930930
let old_cap = self.cap();
931931
self.buf.double();
@@ -955,15 +955,15 @@ impl<T> VecDeque<T> {
955955
// A - The element that should be after the insertion point
956956
// M - Indicates element was moved
957957

958-
let idx = self.wrap_add(self.tail, index);
958+
let idx = self.wrap_add(self.tail, i);
959959

960-
let distance_to_tail = index;
961-
let distance_to_head = self.len() - index;
960+
let distance_to_tail = i;
961+
let distance_to_head = self.len() - i;
962962

963963
let contiguous = self.is_contiguous();
964964

965965
match (contiguous, distance_to_tail <= distance_to_head, idx >= self.tail) {
966-
(true, true, _) if index == 0 => {
966+
(true, true, _) if i == 0 => {
967967
// push_front
968968
//
969969
// T
@@ -999,8 +999,8 @@ impl<T> VecDeque<T> {
999999
let new_tail = self.wrap_sub(self.tail, 1);
10001000

10011001
self.copy(new_tail, self.tail, 1);
1002-
// Already moved the tail, so we only copy `index - 1` elements.
1003-
self.copy(self.tail, self.tail + 1, index - 1);
1002+
// Already moved the tail, so we only copy `i - 1` elements.
1003+
self.copy(self.tail, self.tail + 1, i - 1);
10041004

10051005
self.tail = new_tail;
10061006
},
@@ -1027,7 +1027,7 @@ impl<T> VecDeque<T> {
10271027
// [o o o o o o . . . . o o I A o o]
10281028
// M M
10291029

1030-
self.copy(self.tail - 1, self.tail, index);
1030+
self.copy(self.tail - 1, self.tail, i);
10311031
self.tail -= 1;
10321032
},
10331033
(false, false, true) => unsafe {
@@ -1107,16 +1107,16 @@ impl<T> VecDeque<T> {
11071107
}
11081108

11091109
// tail might've been changed so we need to recalculate
1110-
let new_idx = self.wrap_add(self.tail, index);
1110+
let new_idx = self.wrap_add(self.tail, i);
11111111
unsafe {
1112-
self.buffer_write(new_idx, value);
1112+
self.buffer_write(new_idx, t);
11131113
}
11141114
}
11151115

1116-
/// Removes and returns the element at `index` from the `VecDeque`.
1116+
/// Removes and returns the element at position `i` from the `VecDeque`.
11171117
/// Whichever end is closer to the removal point will be moved to make
11181118
/// room, and all the affected elements will be moved to new positions.
1119-
/// Returns `None` if `index` is out of bounds.
1119+
/// Returns `None` if `i` is out of bounds.
11201120
///
11211121
/// # Examples
11221122
/// ```
@@ -1131,8 +1131,8 @@ impl<T> VecDeque<T> {
11311131
/// assert_eq!(Some(&15), buf.get(2));
11321132
/// ```
11331133
#[stable(feature = "rust1", since = "1.0.0")]
1134-
pub fn remove(&mut self, index: usize) -> Option<T> {
1135-
if self.is_empty() || self.len() <= index {
1134+
pub fn remove(&mut self, i: usize) -> Option<T> {
1135+
if self.is_empty() || self.len() <= i {
11361136
return None;
11371137
}
11381138

@@ -1154,14 +1154,14 @@ impl<T> VecDeque<T> {
11541154
// R - Indicates element that is being removed
11551155
// M - Indicates element was moved
11561156

1157-
let idx = self.wrap_add(self.tail, index);
1157+
let idx = self.wrap_add(self.tail, i);
11581158

11591159
let elem = unsafe {
11601160
Some(self.buffer_read(idx))
11611161
};
11621162

1163-
let distance_to_tail = index;
1164-
let distance_to_head = self.len() - index;
1163+
let distance_to_tail = i;
1164+
let distance_to_head = self.len() - i;
11651165

11661166
let contiguous = self.is_contiguous();
11671167

@@ -1176,7 +1176,7 @@ impl<T> VecDeque<T> {
11761176
// [. . . . o o o o o o . . . . . .]
11771177
// M M
11781178

1179-
self.copy(self.tail + 1, self.tail, index);
1179+
self.copy(self.tail + 1, self.tail, i);
11801180
self.tail += 1;
11811181
},
11821182
(true, false, _) => unsafe {
@@ -1202,7 +1202,7 @@ impl<T> VecDeque<T> {
12021202
// [o o o o o o . . . . . . o o o o]
12031203
// M M
12041204

1205-
self.copy(self.tail + 1, self.tail, index);
1205+
self.copy(self.tail + 1, self.tail, i);
12061206
self.tail = self.wrap_add(self.tail, 1);
12071207
},
12081208
(false, false, false) => unsafe {
@@ -1700,16 +1700,16 @@ impl<A> Index<usize> for VecDeque<A> {
17001700
type Output = A;
17011701

17021702
#[inline]
1703-
fn index(&self, index: usize) -> &A {
1704-
self.get(index).expect("Out of bounds access")
1703+
fn index(&self, i: usize) -> &A {
1704+
self.get(i).expect("Out of bounds access")
17051705
}
17061706
}
17071707

17081708
#[stable(feature = "rust1", since = "1.0.0")]
17091709
impl<A> IndexMut<usize> for VecDeque<A> {
17101710
#[inline]
1711-
fn index_mut(&mut self, index: usize) -> &mut A {
1712-
self.get_mut(index).expect("Out of bounds access")
1711+
fn index_mut(&mut self, i: usize) -> &mut A {
1712+
self.get_mut(i).expect("Out of bounds access")
17131713
}
17141714
}
17151715

branches/stable/src/libcore/atomic.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ use intrinsics;
7878
use cell::UnsafeCell;
7979

8080
use default::Default;
81+
use fmt;
8182

8283
/// A boolean type which can be safely shared between threads.
8384
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1089,3 +1090,23 @@ pub fn fence(order: Ordering) {
10891090
}
10901091
}
10911092
}
1093+
1094+
macro_rules! impl_Debug {
1095+
($($t:ident)*) => ($(
1096+
#[stable(feature = "atomic_debug", since = "1.3.0")]
1097+
impl fmt::Debug for $t {
1098+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1099+
f.debug_tuple(stringify!($t)).field(&self.load(Ordering::SeqCst)).finish()
1100+
}
1101+
}
1102+
)*);
1103+
}
1104+
1105+
impl_Debug!{ AtomicUsize AtomicIsize AtomicBool }
1106+
1107+
#[stable(feature = "atomic_debug", since = "1.3.0")]
1108+
impl<T> fmt::Debug for AtomicPtr<T> {
1109+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1110+
f.debug_tuple("AtomicPtr").field(&self.load(Ordering::SeqCst)).finish()
1111+
}
1112+
}

branches/stable/src/libcore/cell.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@
3636
//! would otherwise be disallowed though, there are occasions when interior mutability might be
3737
//! appropriate, or even *must* be used, e.g.
3838
//!
39-
//! * Introducing mutability 'inside' of something immutable
39+
//! * Introducing inherited mutability roots to shared types.
4040
//! * Implementation details of logically-immutable methods.
4141
//! * Mutating implementations of `Clone`.
4242
//!
43-
//! ## Introducing mutability 'inside' of something immutable
43+
//! ## Introducing inherited mutability roots to shared types
4444
//!
45-
//! Many shared smart pointer types, including `Rc<T>` and `Arc<T>`, provide containers that can be
45+
//! Shared smart pointer types, including `Rc<T>` and `Arc<T>`, provide containers that can be
4646
//! cloned and shared between multiple parties. Because the contained values may be
47-
//! multiply-aliased, they can only be borrowed with `&`, not `&mut`. Without cells it would be
48-
//! impossible to mutate data inside of these smart pointers at all.
47+
//! multiply-aliased, they can only be borrowed as shared references, not mutable references.
48+
//! Without cells it would be impossible to mutate data inside of shared boxes at all!
4949
//!
5050
//! It's very common then to put a `RefCell<T>` inside shared pointer types to reintroduce
5151
//! mutability:
@@ -65,8 +65,8 @@
6565
//! ```
6666
//!
6767
//! Note that this example uses `Rc<T>` and not `Arc<T>`. `RefCell<T>`s are for single-threaded
68-
//! scenarios. Consider using `RwLock<T>` or `Mutex<T>` if you need shared mutability in a
69-
//! multi-threaded situation.
68+
//! scenarios. Consider using `Mutex<T>` if you need shared mutability in a multi-threaded
69+
//! situation.
7070
//!
7171
//! ## Implementation details of logically-immutable methods
7272
//!

0 commit comments

Comments
 (0)