Skip to content

Commit 974f77a

Browse files
committed
---
yaml --- r: 225392 b: refs/heads/stable c: c2a5d31 h: refs/heads/master v: v3
1 parent a389df6 commit 974f77a

Some content is hidden

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

50 files changed

+869
-308
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ refs/heads/tmp: e5d90d98402475b6e154ce216f9efcb80da1a747
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: 1fe32ca12c51afcd761d9962f51a74ff0d07a591
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: adac861db28b79f52455b1fd3121cd1964d0aceb
32+
refs/heads/stable: c2a5d31f30712aa6e18b9b35d124e4d8a4c33ca4
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b

branches/stable/CONTRIBUTING.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ feature. We use the 'fork and pull' model described there.
8484
Please make pull requests against the `master` branch.
8585

8686
All pull requests are reviewed by another person. We have a bot,
87-
@rust-highfive, that will automatically assign a random person to review your request.
87+
@rust-highfive, that will automatically assign a random person to review your
88+
request.
8889

8990
If you want to request that a specific person reviews your pull request,
9091
you can add an `r?` to the message. For example, Steve usually reviews
@@ -124,6 +125,10 @@ To save @bors some work, and to get small changes through more quickly, when
124125
the other rollup-eligible patches too, and they'll get tested and merged at
125126
the same time.
126127

128+
To find documentation-related issues, sort by the [A-docs label][adocs].
129+
130+
[adocs]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AA-docs
131+
127132
## Issue Triage
128133

129134
Sometimes, an issue will stay open, even though the bug has been fixed. And
@@ -132,8 +137,40 @@ meantime.
132137

133138
It can be helpful to go through older bug reports and make sure that they are
134139
still valid. Load up an older issue, double check that it's still true, and
135-
leave a comment letting us know if it is or is not. The [least recently updated sort][lru] is good for finding issues like this.
140+
leave a comment letting us know if it is or is not. The [least recently
141+
updated sort][lru] is good for finding issues like this.
142+
143+
Contributors with sufficient permissions on the Rust repo can help by adding
144+
labels to triage issues:
145+
146+
* Yellow, **A**-prefixed labels state which **area** of the project an issue
147+
relates to.
148+
149+
* Magenta, **B**-prefixed labels identify bugs which **belong** elsewhere.
150+
151+
* Green, **E**-prefixed labels explain the level of **experience** necessary
152+
to fix the issue.
153+
154+
* Red, **I**-prefixed labels indicate the **importance** of the issue. The
155+
[I-nominated][inom] label indicates that an issue has been nominated for
156+
prioritizing at the next triage meeting.
157+
158+
* Orange, **P**-prefixed labels indicate a bug's **priority**. These labels
159+
are only assigned during triage meetings, and replace the [I-nominated][inom]
160+
label.
161+
162+
* Blue, **T**-prefixed bugs denote which **team** the issue belongs to.
163+
164+
* Dark blue, **beta-** labels track changes which need to be backported into
165+
the beta branches.
166+
167+
* The purple **metabug** label marks lists of bugs collected by other
168+
categories.
169+
170+
If you're looking for somewhere to start, check out the [E-easy][eeasy] tag.
136171

172+
[inom]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AI-nominated
173+
[eeasy]: https://github.com/rust-lang/rust/issues?q=is%3Aopen+is%3Aissue+label%3AE-easy
137174
[lru]: https://github.com/rust-lang/rust/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc
138175

139176
## Out-of-tree Contributions

branches/stable/src/doc/reference.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3255,8 +3255,8 @@ User-defined types have limited capabilities.
32553255
The primitive types are the following:
32563256

32573257
* The boolean type `bool` with values `true` and `false`.
3258-
* The machine types.
3259-
* The machine-dependent integer and floating-point types.
3258+
* The machine types (integer and floating-point).
3259+
* The machine-dependent integer types.
32603260

32613261
#### Machine types
32623262

branches/stable/src/doc/trpl/conditional-compilation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ These can nest arbitrarily:
3434
As for how to enable or disable these switches, if you’re using Cargo,
3535
they get set in the [`[features]` section][features] of your `Cargo.toml`:
3636

37-
[features]: http://doc.crates.io/manifest.html#the-[features]-section
37+
[features]: http://doc.crates.io/manifest.html#the-%5Bfeatures%5D-section
3838

3939
```toml
4040
[features]

branches/stable/src/doc/trpl/glossary.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ In the example above `x` and `y` have arity 2. `z` has arity 3.
1919

2020
When a compiler is compiling your program, it does a number of different
2121
things. One of the things that it does is turn the text of your program into an
22-
‘abstract syntax tree’, or‘AST’. This tree is a representation of the
22+
‘abstract syntax tree’, or ‘AST’. This tree is a representation of the
2323
structure of your program. For example, `2 + 3` can be turned into a tree:
2424

2525
```text

branches/stable/src/doc/trpl/method-syntax.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Functions are great, but if you want to call a bunch of them on some data, it
44
can be awkward. Consider this code:
55

66
```rust,ignore
7-
baz(bar(foo)));
7+
baz(bar(foo));
88
```
99

1010
We would read this left-to right, and so we see ‘baz bar foo’. But this isn’t the

branches/stable/src/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ fn bar<T, K>(x: T, y: K) where T: Clone, K: Clone + Debug {
285285

286286
fn main() {
287287
foo("Hello", "world");
288-
bar("Hello", "workd");
288+
bar("Hello", "world");
289289
}
290290
```
291291

branches/stable/src/libcollections/vec.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,14 +440,18 @@ impl<T> Vec<T> {
440440
}
441441

442442
/// Extracts a slice containing the entire vector.
443+
///
444+
/// Equivalent to `&s[..]`.
443445
#[inline]
444446
#[unstable(feature = "convert",
445447
reason = "waiting on RFC revision")]
446448
pub fn as_slice(&self) -> &[T] {
447449
self
448450
}
449451

450-
/// Deprecated: use `&mut s[..]` instead.
452+
/// Extracts a mutable slice of the entire vector.
453+
///
454+
/// Equivalent to `&mut s[..]`.
451455
#[inline]
452456
#[unstable(feature = "convert",
453457
reason = "waiting on RFC revision")]

branches/stable/src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#![feature(collections)]
1515
#![feature(collections_drain)]
1616
#![feature(core)]
17+
#![feature(const_fn)]
1718
#![feature(hash)]
1819
#![feature(rand)]
1920
#![feature(rustc_private)]

branches/stable/src/libcore/cell.rs

Lines changed: 160 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@
143143
#![stable(feature = "rust1", since = "1.0.0")]
144144

145145
use clone::Clone;
146-
use cmp::PartialEq;
146+
use cmp::{PartialEq, Eq};
147147
use default::Default;
148148
use marker::{Copy, Send, Sync, Sized};
149-
use ops::{Deref, DerefMut, Drop};
149+
use ops::{Deref, DerefMut, Drop, FnOnce};
150150
use option::Option;
151151
use option::Option::{None, Some};
152152

@@ -263,6 +263,9 @@ impl<T:PartialEq + Copy> PartialEq for Cell<T> {
263263
}
264264
}
265265

266+
#[stable(feature = "cell_eq", since = "1.2.0")]
267+
impl<T:Eq + Copy> Eq for Cell<T> {}
268+
266269
/// A mutable memory location with dynamically checked borrow rules
267270
///
268271
/// See the [module-level documentation](index.html) for more.
@@ -273,7 +276,7 @@ pub struct RefCell<T: ?Sized> {
273276
}
274277

275278
/// An enumeration of values returned from the `state` method on a `RefCell<T>`.
276-
#[derive(Copy, Clone, PartialEq, Debug)]
279+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
277280
#[unstable(feature = "std_misc")]
278281
pub enum BorrowState {
279282
/// The cell is currently being read, there is at least one active `borrow`.
@@ -479,6 +482,9 @@ impl<T: ?Sized + PartialEq> PartialEq for RefCell<T> {
479482
}
480483
}
481484

485+
#[stable(feature = "cell_eq", since = "1.2.0")]
486+
impl<T: ?Sized + Eq> Eq for RefCell<T> {}
487+
482488
struct BorrowRef<'b> {
483489
_borrow: &'b Cell<BorrowFlag>,
484490
}
@@ -545,13 +551,161 @@ impl<'b, T: ?Sized> Deref for Ref<'b, T> {
545551
///
546552
/// A `Clone` implementation would interfere with the widespread
547553
/// use of `r.borrow().clone()` to clone the contents of a `RefCell`.
554+
#[deprecated(since = "1.2.0", reason = "moved to a `Ref::clone` associated function")]
548555
#[unstable(feature = "core",
549556
reason = "likely to be moved to a method, pending language changes")]
550557
#[inline]
551558
pub fn clone_ref<'b, T:Clone>(orig: &Ref<'b, T>) -> Ref<'b, T> {
552-
Ref {
553-
_value: orig._value,
554-
_borrow: orig._borrow.clone(),
559+
Ref::clone(orig)
560+
}
561+
562+
impl<'b, T: ?Sized> Ref<'b, T> {
563+
/// Copies a `Ref`.
564+
///
565+
/// The `RefCell` is already immutably borrowed, so this cannot fail.
566+
///
567+
/// This is an associated function that needs to be used as `Ref::clone(...)`.
568+
/// A `Clone` implementation or a method would interfere with the widespread
569+
/// use of `r.borrow().clone()` to clone the contents of a `RefCell`.
570+
#[unstable(feature = "cell_extras",
571+
reason = "likely to be moved to a method, pending language changes")]
572+
#[inline]
573+
pub fn clone(orig: &Ref<'b, T>) -> Ref<'b, T> {
574+
Ref {
575+
_value: orig._value,
576+
_borrow: orig._borrow.clone(),
577+
}
578+
}
579+
580+
/// Make a new `Ref` for a component of the borrowed data.
581+
///
582+
/// The `RefCell` is already immutably borrowed, so this cannot fail.
583+
///
584+
/// This is an associated function that needs to be used as `Ref::map(...)`.
585+
/// A method would interfere with methods of the same name on the contents of a `RefCell`
586+
/// used through `Deref`.
587+
///
588+
/// # Example
589+
///
590+
/// ```
591+
/// # #![feature(cell_extras)]
592+
/// use std::cell::{RefCell, Ref};
593+
///
594+
/// let c = RefCell::new((5, 'b'));
595+
/// let b1: Ref<(u32, char)> = c.borrow();
596+
/// let b2: Ref<u32> = Ref::map(b1, |t| &t.0);
597+
/// assert_eq!(*b2, 5)
598+
/// ```
599+
#[unstable(feature = "cell_extras", reason = "recently added")]
600+
#[inline]
601+
pub fn map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Ref<'b, U>
602+
where F: FnOnce(&T) -> &U
603+
{
604+
Ref {
605+
_value: f(orig._value),
606+
_borrow: orig._borrow,
607+
}
608+
}
609+
610+
/// Make a new `Ref` for a optional component of the borrowed data, e.g. an enum variant.
611+
///
612+
/// The `RefCell` is already immutably borrowed, so this cannot fail.
613+
///
614+
/// This is an associated function that needs to be used as `Ref::filter_map(...)`.
615+
/// A method would interfere with methods of the same name on the contents of a `RefCell`
616+
/// used through `Deref`.
617+
///
618+
/// # Example
619+
///
620+
/// ```
621+
/// # #![feature(cell_extras)]
622+
/// use std::cell::{RefCell, Ref};
623+
///
624+
/// let c = RefCell::new(Ok(5));
625+
/// let b1: Ref<Result<u32, ()>> = c.borrow();
626+
/// let b2: Ref<u32> = Ref::filter_map(b1, |o| o.as_ref().ok()).unwrap();
627+
/// assert_eq!(*b2, 5)
628+
/// ```
629+
#[unstable(feature = "cell_extras", reason = "recently added")]
630+
#[inline]
631+
pub fn filter_map<U: ?Sized, F>(orig: Ref<'b, T>, f: F) -> Option<Ref<'b, U>>
632+
where F: FnOnce(&T) -> Option<&U>
633+
{
634+
f(orig._value).map(move |new| Ref {
635+
_value: new,
636+
_borrow: orig._borrow,
637+
})
638+
}
639+
}
640+
641+
impl<'b, T: ?Sized> RefMut<'b, T> {
642+
/// Make a new `RefMut` for a component of the borrowed data, e.g. an enum variant.
643+
///
644+
/// The `RefCell` is already mutably borrowed, so this cannot fail.
645+
///
646+
/// This is an associated function that needs to be used as `RefMut::map(...)`.
647+
/// A method would interfere with methods of the same name on the contents of a `RefCell`
648+
/// used through `Deref`.
649+
///
650+
/// # Example
651+
///
652+
/// ```
653+
/// # #![feature(cell_extras)]
654+
/// use std::cell::{RefCell, RefMut};
655+
///
656+
/// let c = RefCell::new((5, 'b'));
657+
/// {
658+
/// let b1: RefMut<(u32, char)> = c.borrow_mut();
659+
/// let mut b2: RefMut<u32> = RefMut::map(b1, |t| &mut t.0);
660+
/// assert_eq!(*b2, 5);
661+
/// *b2 = 42;
662+
/// }
663+
/// assert_eq!(*c.borrow(), (42, 'b'));
664+
/// ```
665+
#[unstable(feature = "cell_extras", reason = "recently added")]
666+
#[inline]
667+
pub fn map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> RefMut<'b, U>
668+
where F: FnOnce(&mut T) -> &mut U
669+
{
670+
RefMut {
671+
_value: f(orig._value),
672+
_borrow: orig._borrow,
673+
}
674+
}
675+
676+
/// Make a new `RefMut` for a optional component of the borrowed data, e.g. an enum variant.
677+
///
678+
/// The `RefCell` is already mutably borrowed, so this cannot fail.
679+
///
680+
/// This is an associated function that needs to be used as `RefMut::filter_map(...)`.
681+
/// A method would interfere with methods of the same name on the contents of a `RefCell`
682+
/// used through `Deref`.
683+
///
684+
/// # Example
685+
///
686+
/// ```
687+
/// # #![feature(cell_extras)]
688+
/// use std::cell::{RefCell, RefMut};
689+
///
690+
/// let c = RefCell::new(Ok(5));
691+
/// {
692+
/// let b1: RefMut<Result<u32, ()>> = c.borrow_mut();
693+
/// let mut b2: RefMut<u32> = RefMut::filter_map(b1, |o| o.as_mut().ok()).unwrap();
694+
/// assert_eq!(*b2, 5);
695+
/// *b2 = 42;
696+
/// }
697+
/// assert_eq!(*c.borrow(), Ok(42));
698+
/// ```
699+
#[unstable(feature = "cell_extras", reason = "recently added")]
700+
#[inline]
701+
pub fn filter_map<U: ?Sized, F>(orig: RefMut<'b, T>, f: F) -> Option<RefMut<'b, U>>
702+
where F: FnOnce(&mut T) -> Option<&mut U>
703+
{
704+
let RefMut { _value, _borrow } = orig;
705+
f(_value).map(move |new| RefMut {
706+
_value: new,
707+
_borrow: _borrow,
708+
})
555709
}
556710
}
557711

0 commit comments

Comments
 (0)