Skip to content

Commit 797aba3

Browse files
committed
---
yaml --- r: 234985 b: refs/heads/stable c: 9a26e49 h: refs/heads/master i: 234983: cf18654 v: v3
1 parent 91dde7a commit 797aba3

File tree

4 files changed

+31
-25
lines changed

4 files changed

+31
-25
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: 8d6b5689fb9bb6ea7c5d38e50525b4d02e2b37c3
32+
refs/heads/stable: 9a26e49459b4069650dd23e5ba35acd5eb868f2e
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/trpl/references-and-borrowing.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ In other words, `y` is only valid for the scope where `x` exists. As soon as
336336
the borrow ‘doesn’t live long enough’ because it’s not valid for the right
337337
amount of time.
338338

339-
The same problem occurs when the reference is declared _before_ the variable it refers to:
339+
The same problem occurs when the reference is declared _before_ the variable it
340+
refers to. This is because resources within the same scope are freed in the
341+
opposite order they were declared:
340342

341343
```rust,ignore
342344
let y: &i32;
@@ -369,3 +371,6 @@ statement 1 at 3:14
369371
println!("{}", y);
370372
}
371373
```
374+
375+
In the above example, `y` is declared before `x`, meaning that `y` lives longer
376+
than `x`, which is not allowed.

branches/stable/src/libcore/atomic.rs

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ impl AtomicBool {
272272
unsafe { atomic_swap(self.v.get(), val, order) > 0 }
273273
}
274274

275-
/// Stores a value into the bool if the current value is the same as the expected value.
275+
/// Stores a value into the `bool` if the current value is the same as the `current` value.
276276
///
277-
/// The return value is always the previous value. If it is equal to `old`, then the value was
278-
/// updated.
277+
/// The return value is always the previous value. If it is equal to `current`, then the value
278+
/// was updated.
279279
///
280-
/// `swap` also takes an `Ordering` argument which describes the memory ordering of this
281-
/// operation.
280+
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
281+
/// this operation.
282282
///
283283
/// # Examples
284284
///
@@ -295,11 +295,11 @@ impl AtomicBool {
295295
/// ```
296296
#[inline]
297297
#[stable(feature = "rust1", since = "1.0.0")]
298-
pub fn compare_and_swap(&self, old: bool, new: bool, order: Ordering) -> bool {
299-
let old = if old { UINT_TRUE } else { 0 };
298+
pub fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool {
299+
let current = if current { UINT_TRUE } else { 0 };
300300
let new = if new { UINT_TRUE } else { 0 };
301301

302-
unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) > 0 }
302+
unsafe { atomic_compare_and_swap(self.v.get(), current, new, order) > 0 }
303303
}
304304

305305
/// Logical "and" with a boolean value.
@@ -515,10 +515,10 @@ impl AtomicIsize {
515515
unsafe { atomic_swap(self.v.get(), val, order) }
516516
}
517517

518-
/// Stores a value into the isize if the current value is the same as the expected value.
518+
/// Stores a value into the `isize` if the current value is the same as the `current` value.
519519
///
520-
/// The return value is always the previous value. If it is equal to `old`, then the value was
521-
/// updated.
520+
/// The return value is always the previous value. If it is equal to `current`, then the value
521+
/// was updated.
522522
///
523523
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
524524
/// this operation.
@@ -538,8 +538,8 @@ impl AtomicIsize {
538538
/// ```
539539
#[inline]
540540
#[stable(feature = "rust1", since = "1.0.0")]
541-
pub fn compare_and_swap(&self, old: isize, new: isize, order: Ordering) -> isize {
542-
unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) }
541+
pub fn compare_and_swap(&self, current: isize, new: isize, order: Ordering) -> isize {
542+
unsafe { atomic_compare_and_swap(self.v.get(), current, new, order) }
543543
}
544544

545545
/// Add an isize to the current value, returning the previous value.
@@ -709,10 +709,10 @@ impl AtomicUsize {
709709
unsafe { atomic_swap(self.v.get(), val, order) }
710710
}
711711

712-
/// Stores a value into the usize if the current value is the same as the expected value.
712+
/// Stores a value into the `usize` if the current value is the same as the `current` value.
713713
///
714-
/// The return value is always the previous value. If it is equal to `old`, then the value was
715-
/// updated.
714+
/// The return value is always the previous value. If it is equal to `current`, then the value
715+
/// was updated.
716716
///
717717
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
718718
/// this operation.
@@ -732,8 +732,8 @@ impl AtomicUsize {
732732
/// ```
733733
#[inline]
734734
#[stable(feature = "rust1", since = "1.0.0")]
735-
pub fn compare_and_swap(&self, old: usize, new: usize, order: Ordering) -> usize {
736-
unsafe { atomic_compare_and_swap(self.v.get(), old, new, order) }
735+
pub fn compare_and_swap(&self, current: usize, new: usize, order: Ordering) -> usize {
736+
unsafe { atomic_compare_and_swap(self.v.get(), current, new, order) }
737737
}
738738

739739
/// Add to the current usize, returning the previous value.
@@ -910,10 +910,10 @@ impl<T> AtomicPtr<T> {
910910
unsafe { atomic_swap(self.p.get() as *mut usize, ptr as usize, order) as *mut T }
911911
}
912912

913-
/// Stores a value into the pointer if the current value is the same as the expected value.
913+
/// Stores a value into the pointer if the current value is the same as the `current` value.
914914
///
915-
/// The return value is always the previous value. If it is equal to `old`, then the value was
916-
/// updated.
915+
/// The return value is always the previous value. If it is equal to `current`, then the value
916+
/// was updated.
917917
///
918918
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
919919
/// this operation.
@@ -933,9 +933,9 @@ impl<T> AtomicPtr<T> {
933933
/// ```
934934
#[inline]
935935
#[stable(feature = "rust1", since = "1.0.0")]
936-
pub fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T {
936+
pub fn compare_and_swap(&self, current: *mut T, new: *mut T, order: Ordering) -> *mut T {
937937
unsafe {
938-
atomic_compare_and_swap(self.p.get() as *mut usize, old as usize,
938+
atomic_compare_and_swap(self.p.get() as *mut usize, current as usize,
939939
new as usize, order) as *mut T
940940
}
941941
}

branches/stable/src/librand/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ pub mod reseeding;
6666
mod rand_impls;
6767

6868
/// A type that can be randomly generated using an `Rng`.
69+
#[doc(hidden)]
6970
pub trait Rand : Sized {
7071
/// Generates a random instance of this type using the specified source of
7172
/// randomness.

0 commit comments

Comments
 (0)