Skip to content

Commit ee9d352

Browse files
committed
---
yaml --- r: 234994 b: refs/heads/stable c: 27975c4 h: refs/heads/master v: v3
1 parent 8346b17 commit ee9d352

File tree

8 files changed

+71
-37
lines changed

8 files changed

+71
-37
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: fb5dd398f677213e8f0943638c9205172a634efe
32+
refs/heads/stable: 27975c49a643d0b2f8cbcd7854931c4c9a8c5dbf
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
% The (old) Rust Pointer Guide
1+
% The Rust Pointer Guide
22

3-
This content has moved into
4-
[the Rust Programming Language book](book/pointers.html).
3+
This content has been removed, with no direct replacement. Rust only
4+
has two built-in pointer types now,
5+
[references](book/references-and-borrowing.html) and [raw
6+
pointers](book/raw-pointers.html). Older Rusts had many more pointer
7+
types, they’re gone now.

branches/stable/src/doc/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ series of small examples.
2020

2121
[rbe]: http://rustbyexample.com/
2222

23+
# The Standard Library
24+
25+
We have [API documentation for the entire standard
26+
library](std/index.html). There's a list of crates on the left with more
27+
specific sections, or you can use the search bar at the top to search for
28+
something if you know its name.
29+
2330
# Community & Getting Help
2431

2532
If you need help with something, or just want to talk about Rust with others,
@@ -75,13 +82,6 @@ There are questions that are asked quite often, so we've made FAQs for them:
7582
* [Project FAQ](complement-project-faq.html)
7683
* [How to submit a bug report](https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports)
7784

78-
# The Standard Library
79-
80-
We have [API documentation for the entire standard
81-
library](std/index.html). There's a list of crates on the left with more
82-
specific sections, or you can use the search bar at the top to search for
83-
something if you know its name.
84-
8585
# The Error Index
8686

8787
If you encounter an error while compiling your code you may be able to look it

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.

branches/stable/src/librustc_lint/builtin.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,8 +1973,13 @@ impl LintPass for UnconditionalRecursion {
19731973
fn_id: ast::NodeId,
19741974
_: ast::Ident,
19751975
id: ast::NodeId) -> bool {
1976-
tcx.def_map.borrow().get(&id)
1977-
.map_or(false, |def| def.def_id() == local_def(fn_id))
1976+
match tcx.map.get(id) {
1977+
ast_map::NodeExpr(&ast::Expr { node: ast::ExprCall(ref callee, _), .. }) => {
1978+
tcx.def_map.borrow().get(&callee.id)
1979+
.map_or(false, |def| def.def_id() == local_def(fn_id))
1980+
}
1981+
_ => false
1982+
}
19781983
}
19791984

19801985
// check if the method call `id` refers to method `method_id`
@@ -2002,6 +2007,15 @@ impl LintPass for UnconditionalRecursion {
20022007
// method instead.
20032008
ty::MethodTypeParam(
20042009
ty::MethodParam { ref trait_ref, method_num, impl_def_id: None, }) => {
2010+
2011+
let on_self = m.substs.self_ty().map_or(false, |t| t.is_self());
2012+
if !on_self {
2013+
// we can only be recurring in a default
2014+
// method if we're being called literally
2015+
// on the `Self` type.
2016+
return false
2017+
}
2018+
20052019
tcx.trait_item(trait_ref.def_id, method_num).def_id()
20062020
}
20072021

branches/stable/src/test/compile-fail/lint-unconditional-recursion.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,15 @@ impl Baz {
6363
}
6464
}
6565

66+
fn all_fine() {
67+
let _f = all_fine;
68+
}
69+
70+
// issue 26333
71+
trait Bar {
72+
fn method<T: Bar>(&self, x: &T) {
73+
x.method(x)
74+
}
75+
}
76+
6677
fn main() {}

0 commit comments

Comments
 (0)