Skip to content

Commit 40613c2

Browse files
author
Ariel Ben-Yehuda
committed
---
yaml --- r: 223406 b: refs/heads/beta c: a1110bc h: refs/heads/master v: v3
1 parent cb6b22a commit 40613c2

File tree

10 files changed

+76
-90
lines changed

10 files changed

+76
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: faa04a8b9c326bb71b1d21e962dd96912ce234c6
26+
refs/heads/beta: a1110bc3a33e1fd4e08e7532bb9cd28a0216016e
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
% The Rust Pointer Guide
1+
% The (old) Rust Pointer Guide
22

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.
3+
This content has moved into
4+
[the Rust Programming Language book](book/pointers.html).

branches/beta/src/doc/index.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ 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-
3023
# Community & Getting Help
3124

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

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/beta/src/doc/trpl/references-and-borrowing.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,7 @@ 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
340-
refers to. This is because resources within the same scope are freed in the
341-
opposite order they were declared:
339+
The same problem occurs when the reference is declared _before_ the variable it refers to:
342340

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

branches/beta/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 `current` value.
275+
/// Stores a value into the bool if the current value is the same as the expected value.
276276
///
277-
/// The return value is always the previous value. If it is equal to `current`, then the value
278-
/// was updated.
277+
/// The return value is always the previous value. If it is equal to `old`, then the value was
278+
/// updated.
279279
///
280-
/// `compare_and_swap` also takes an `Ordering` argument which describes the memory ordering of
281-
/// this operation.
280+
/// `swap` also takes an `Ordering` argument which describes the memory ordering of this
281+
/// 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, current: bool, new: bool, order: Ordering) -> bool {
299-
let current = if current { UINT_TRUE } else { 0 };
298+
pub fn compare_and_swap(&self, old: bool, new: bool, order: Ordering) -> bool {
299+
let old = if old { UINT_TRUE } else { 0 };
300300
let new = if new { UINT_TRUE } else { 0 };
301301

302-
unsafe { atomic_compare_and_swap(self.v.get(), current, new, order) > 0 }
302+
unsafe { atomic_compare_and_swap(self.v.get(), old, 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 `current` value.
518+
/// Stores a value into the isize if the current value is the same as the expected value.
519519
///
520-
/// The return value is always the previous value. If it is equal to `current`, then the value
521-
/// was updated.
520+
/// The return value is always the previous value. If it is equal to `old`, then the value was
521+
/// 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, current: isize, new: isize, order: Ordering) -> isize {
542-
unsafe { atomic_compare_and_swap(self.v.get(), current, new, order) }
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) }
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 `current` value.
712+
/// Stores a value into the usize if the current value is the same as the expected value.
713713
///
714-
/// The return value is always the previous value. If it is equal to `current`, then the value
715-
/// was updated.
714+
/// The return value is always the previous value. If it is equal to `old`, then the value was
715+
/// 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, current: usize, new: usize, order: Ordering) -> usize {
736-
unsafe { atomic_compare_and_swap(self.v.get(), current, new, order) }
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) }
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 `current` value.
913+
/// Stores a value into the pointer if the current value is the same as the expected value.
914914
///
915-
/// The return value is always the previous value. If it is equal to `current`, then the value
916-
/// was updated.
915+
/// The return value is always the previous value. If it is equal to `old`, then the value was
916+
/// 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, current: *mut T, new: *mut T, order: Ordering) -> *mut T {
936+
pub fn compare_and_swap(&self, old: *mut T, new: *mut T, order: Ordering) -> *mut T {
937937
unsafe {
938-
atomic_compare_and_swap(self.p.get() as *mut usize, current as usize,
938+
atomic_compare_and_swap(self.p.get() as *mut usize, old as usize,
939939
new as usize, order) as *mut T
940940
}
941941
}

branches/beta/src/librand/lib.rs

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

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

branches/beta/src/librustc_lint/builtin.rs

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,13 +1973,8 @@ impl LintPass for UnconditionalRecursion {
19731973
fn_id: ast::NodeId,
19741974
_: ast::Ident,
19751975
id: ast::NodeId) -> bool {
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-
}
1976+
tcx.def_map.borrow().get(&id)
1977+
.map_or(false, |def| def.def_id() == local_def(fn_id))
19831978
}
19841979

19851980
// check if the method call `id` refers to method `method_id`
@@ -2007,15 +2002,6 @@ impl LintPass for UnconditionalRecursion {
20072002
// method instead.
20082003
ty::MethodTypeParam(
20092004
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-
20192005
tcx.trait_item(trait_ref.def_id, method_num).def_id()
20202006
}
20212007

branches/beta/src/librustc_typeck/collect.rs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,6 +1860,29 @@ fn ty_generics<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
18601860
result
18611861
}
18621862

1863+
fn convert_default_type_parameter<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
1864+
path: &P<ast::Ty>,
1865+
space: ParamSpace,
1866+
index: u32)
1867+
-> Ty<'tcx>
1868+
{
1869+
let ty = ast_ty_to_ty(&ccx.icx(&()), &ExplicitRscope, &path);
1870+
1871+
for leaf_ty in ty.walk() {
1872+
if let ty::TyParam(p) = leaf_ty.sty {
1873+
if p.space == space && p.idx >= index {
1874+
span_err!(ccx.tcx.sess, path.span, E0128,
1875+
"type parameters with a default cannot use \
1876+
forward declared identifiers");
1877+
1878+
return ccx.tcx.types.err
1879+
}
1880+
}
1881+
}
1882+
1883+
ty
1884+
}
1885+
18631886
fn get_or_create_type_parameter_def<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
18641887
ast_generics: &ast::Generics,
18651888
space: ParamSpace,
@@ -1874,25 +1897,9 @@ fn get_or_create_type_parameter_def<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>,
18741897
None => { }
18751898
}
18761899

1877-
let default = match param.default {
1878-
None => None,
1879-
Some(ref path) => {
1880-
let ty = ast_ty_to_ty(&ccx.icx(&()), &ExplicitRscope, &**path);
1881-
let cur_idx = index;
1882-
1883-
for leaf_ty in ty.walk() {
1884-
if let ty::TyParam(p) = leaf_ty.sty {
1885-
if p.idx > cur_idx {
1886-
span_err!(tcx.sess, path.span, E0128,
1887-
"type parameters with a default cannot use \
1888-
forward declared identifiers");
1889-
}
1890-
}
1891-
}
1892-
1893-
Some(ty)
1894-
}
1895-
};
1900+
let default = param.default.as_ref().map(
1901+
|def| convert_default_type_parameter(ccx, def, space, index)
1902+
);
18961903

18971904
let object_lifetime_default =
18981905
compute_object_lifetime_default(ccx, param.id,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
pub struct Foo<Bar=Bar>; //~ ERROR E0128
12+
pub struct Baz(Foo);
13+
fn main() {}

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

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,4 @@ 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-
7766
fn main() {}

0 commit comments

Comments
 (0)