Skip to content

Commit 414d104

Browse files
authored
Merge pull request #17 from rust-lang/master
sync with rust-lang/rust master branch
2 parents 109e16e + 6187684 commit 414d104

File tree

198 files changed

+2720
-1573
lines changed

Some content is hidden

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

198 files changed

+2720
-1573
lines changed

Cargo.lock

+15-6
Original file line numberDiff line numberDiff line change
@@ -1011,6 +1011,7 @@ dependencies = [
10111011
name = "fmt_macros"
10121012
version = "0.0.0"
10131013
dependencies = [
1014+
"rustc_lexer",
10141015
"syntax_pos",
10151016
]
10161017

@@ -2324,9 +2325,9 @@ checksum = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
23242325

23252326
[[package]]
23262327
name = "polonius-engine"
2327-
version = "0.9.0"
2328+
version = "0.10.0"
23282329
source = "registry+https://github.com/rust-lang/crates.io-index"
2329-
checksum = "f6b8a5defa2aef9ba4999aaa745fbc01c622ecea35964a306adc3e44be4f3b5b"
2330+
checksum = "50fa9dbfd0d3d60594da338cfe6f94028433eecae4b11b7e83fd99759227bbfe"
23302331
dependencies = [
23312332
"datafrog",
23322333
"log",
@@ -2372,7 +2373,7 @@ version = "0.4.30"
23722373
source = "registry+https://github.com/rust-lang/crates.io-index"
23732374
checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759"
23742375
dependencies = [
2375-
"unicode-xid",
2376+
"unicode-xid 0.1.0",
23762377
]
23772378

23782379
[[package]]
@@ -3290,7 +3291,7 @@ dependencies = [
32903291
name = "rustc_lexer"
32913292
version = "0.1.0"
32923293
dependencies = [
3293-
"unicode-xid",
3294+
"unicode-xid 0.2.0",
32943295
]
32953296

32963297
[[package]]
@@ -3368,6 +3369,7 @@ dependencies = [
33683369
"rustc_apfloat",
33693370
"rustc_data_structures",
33703371
"rustc_errors",
3372+
"rustc_lexer",
33713373
"rustc_target",
33723374
"serialize",
33733375
"smallvec",
@@ -3976,7 +3978,7 @@ checksum = "641e117d55514d6d918490e47102f7e08d096fdde360247e4a10f7a91a8478d3"
39763978
dependencies = [
39773979
"proc-macro2",
39783980
"quote",
3979-
"unicode-xid",
3981+
"unicode-xid 0.1.0",
39803982
]
39813983

39823984
[[package]]
@@ -3988,7 +3990,7 @@ dependencies = [
39883990
"proc-macro2",
39893991
"quote",
39903992
"syn",
3991-
"unicode-xid",
3993+
"unicode-xid 0.1.0",
39923994
]
39933995

39943996
[[package]]
@@ -4017,6 +4019,7 @@ dependencies = [
40174019
"log",
40184020
"rustc_data_structures",
40194021
"rustc_errors",
4022+
"rustc_lexer",
40204023
"rustc_target",
40214024
"smallvec",
40224025
"syntax",
@@ -4532,6 +4535,12 @@ version = "0.1.0"
45324535
source = "registry+https://github.com/rust-lang/crates.io-index"
45334536
checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
45344537

4538+
[[package]]
4539+
name = "unicode-xid"
4540+
version = "0.2.0"
4541+
source = "registry+https://github.com/rust-lang/crates.io-index"
4542+
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
4543+
45354544
[[package]]
45364545
name = "unicode_categories"
45374546
version = "0.1.1"

src/doc/embedded-book

src/doc/reference

src/doc/rust-by-example

src/doc/rustc/src/linker-plugin-lto.md

+1
Original file line numberDiff line numberDiff line change
@@ -105,5 +105,6 @@ The following table shows known good combinations of toolchain versions.
105105
| Rust 1.34 |||
106106
| Rust 1.35 |||
107107
| Rust 1.36 |||
108+
| Rust 1.37 |||
108109

109110
Note that the compatibility policy for this feature might change in the future.

src/doc/unstable-book/src/language-features/plugin.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ extern crate rustc;
5757
extern crate rustc_driver;
5858
5959
use syntax::parse::token::{self, Token};
60-
use syntax::tokenstream::TokenTree;
60+
use syntax::tokenstream::{TokenTree, TokenStream};
6161
use syntax::ext::base::{ExtCtxt, MacResult, DummyResult, MacEager};
6262
use syntax_pos::Span;
6363
use rustc_driver::plugin::Registry;
6464
65-
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
65+
fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: TokenStream)
6666
-> Box<dyn MacResult + 'static> {
6767
6868
static NUMERALS: &'static [(&'static str, usize)] = &[
@@ -78,7 +78,7 @@ fn expand_rn(cx: &mut ExtCtxt, sp: Span, args: &[TokenTree])
7878
return DummyResult::any(sp);
7979
}
8080
81-
let text = match args[0] {
81+
let text = match args.into_trees().next().unwrap() {
8282
TokenTree::Token(Token { kind: token::Ident(s, _), .. }) => s.to_string(),
8383
_ => {
8484
cx.span_err(sp, "argument should be a single identifier");

src/libcore/char/methods.rs

-23
Original file line numberDiff line numberDiff line change
@@ -547,29 +547,6 @@ impl char {
547547
}
548548
}
549549

550-
/// Returns `true` if this `char` satisfies the `XID_Start` Unicode property, and false
551-
/// otherwise.
552-
///
553-
/// `XID_Start` is a Unicode Derived Property specified in
554-
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
555-
/// mostly similar to `ID_Start` but modified for closure under `NFKx`.
556-
#[unstable(feature = "unicode_internals", issue = "0")]
557-
pub fn is_xid_start(self) -> bool {
558-
derived_property::XID_Start(self)
559-
}
560-
561-
/// Returns `true` if this `char` satisfies the `XID_Continue` Unicode property, and false
562-
/// otherwise.
563-
///
564-
/// `XID_Continue` is a Unicode Derived Property specified in
565-
/// [UAX #31](http://unicode.org/reports/tr31/#NFKC_Modifications),
566-
/// mostly similar to `ID_Continue` but modified for closure under NFKx.
567-
#[unstable(feature = "unicode_internals", issue = "0")]
568-
#[inline]
569-
pub fn is_xid_continue(self) -> bool {
570-
derived_property::XID_Continue(self)
571-
}
572-
573550
/// Returns `true` if this `char` is lowercase.
574551
///
575552
/// 'Lowercase' is defined according to the terms of the Unicode Derived Core

src/libcore/cmp.rs

+14-6
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,22 @@
99
//! * [`Ord`] and [`PartialOrd`] are traits that allow you to define total and
1010
//! partial orderings between values, respectively. Implementing them overloads
1111
//! the `<`, `<=`, `>`, and `>=` operators.
12-
//! * [`Ordering`][cmp::Ordering] is an enum returned by the
13-
//! main functions of [`Ord`] and [`PartialOrd`], and describes an ordering.
14-
//! * [`Reverse`][cmp::Reverse] is a struct that allows you to easily reverse
15-
//! an ordering.
16-
//! * [`max`][cmp::max] and [`min`][cmp::min] are functions that build off of
17-
//! [`Ord`] and allow you to find the maximum or minimum of two values.
12+
//! * [`Ordering`] is an enum returned by the main functions of [`Ord`] and
13+
//! [`PartialOrd`], and describes an ordering.
14+
//! * [`Reverse`] is a struct that allows you to easily reverse an ordering.
15+
//! * [`max`] and [`min`] are functions that build off of [`Ord`] and allow you
16+
//! to find the maximum or minimum of two values.
1817
//!
1918
//! For more details, see the respective documentation of each item in the list.
19+
//!
20+
//! [`Eq`]: trait.Eq.html
21+
//! [`PartialEq`]: trait.PartialEq.html
22+
//! [`Ord`]: trait.Ord.html
23+
//! [`PartialOrd`]: trait.PartialOrd.html
24+
//! [`Ordering`]: enum.Ordering.html
25+
//! [`Reverse`]: struct.Reverse.html
26+
//! [`max`]: fn.max.html
27+
//! [`min`]: fn.min.html
2028
2129
#![stable(feature = "rust1", since = "1.0.0")]
2230

src/libcore/iter/adapters/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ impl<I> Iterator for Rev<I> where I: DoubleEndedIterator {
6666
{
6767
self.iter.rfind(predicate)
6868
}
69-
70-
#[inline]
71-
fn rposition<P>(&mut self, predicate: P) -> Option<usize> where
72-
P: FnMut(Self::Item) -> bool
73-
{
74-
self.iter.position(predicate)
75-
}
7669
}
7770

7871
#[stable(feature = "rust1", since = "1.0.0")]

src/libcore/pin.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ impl<P: Deref<Target: Unpin>> Pin<P> {
462462
/// can ignore the pinning invariants when unwrapping it.
463463
///
464464
/// [`Unpin`]: ../../std/marker/trait.Unpin.html
465-
#[unstable(feature = "pin_into_inner", issue = "60245")]
465+
#[stable(feature = "pin_into_inner", since = "1.39.0")]
466466
#[inline(always)]
467467
pub fn into_inner(pin: Pin<P>) -> P {
468468
pin.pointer
@@ -569,7 +569,7 @@ impl<P: Deref> Pin<P> {
569569
///
570570
/// [`Unpin`]: ../../std/marker/trait.Unpin.html
571571
/// [`Pin::into_inner`]: #method.into_inner
572-
#[unstable(feature = "pin_into_inner", issue = "60245")]
572+
#[stable(feature = "pin_into_inner", since = "1.39.0")]
573573
#[inline(always)]
574574
pub unsafe fn into_inner_unchecked(pin: Pin<P>) -> P {
575575
pin.pointer

src/libcore/result.rs

+81
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,87 @@ impl<T, E> Result<T, E> {
820820
}
821821
}
822822

823+
impl<T: Copy, E> Result<&T, E> {
824+
/// Maps a `Result<&T, E>` to a `Result<T, E>` by copying the contents of the
825+
/// `Ok` part.
826+
///
827+
/// # Examples
828+
///
829+
/// ```
830+
/// #![feature(result_copied)]
831+
/// let val = 12;
832+
/// let x: Result<&i32, i32> = Ok(&val);
833+
/// assert_eq!(x, Ok(&12));
834+
/// let copied = x.copied();
835+
/// assert_eq!(copied, Ok(12));
836+
/// ```
837+
#[unstable(feature = "result_copied", reason = "newly added", issue = "63168")]
838+
pub fn copied(self) -> Result<T, E> {
839+
self.map(|&t| t)
840+
}
841+
}
842+
843+
impl<T: Copy, E> Result<&mut T, E> {
844+
/// Maps a `Result<&mut T, E>` to a `Result<T, E>` by copying the contents of the
845+
/// `Ok` part.
846+
///
847+
/// # Examples
848+
///
849+
/// ```
850+
/// #![feature(result_copied)]
851+
/// let mut val = 12;
852+
/// let x: Result<&mut i32, i32> = Ok(&mut val);
853+
/// assert_eq!(x, Ok(&mut 12));
854+
/// let copied = x.copied();
855+
/// assert_eq!(copied, Ok(12));
856+
/// ```
857+
#[unstable(feature = "result_copied", reason = "newly added", issue = "63168")]
858+
pub fn copied(self) -> Result<T, E> {
859+
self.map(|&mut t| t)
860+
}
861+
}
862+
863+
impl<T: Clone, E> Result<&T, E> {
864+
/// Maps a `Result<&T, E>` to a `Result<T, E>` by cloning the contents of the
865+
/// `Ok` part.
866+
///
867+
/// # Examples
868+
///
869+
/// ```
870+
/// #![feature(result_cloned)]
871+
/// let val = 12;
872+
/// let x: Result<&i32, i32> = Ok(&val);
873+
/// assert_eq!(x, Ok(&12));
874+
/// let cloned = x.cloned();
875+
/// assert_eq!(cloned, Ok(12));
876+
/// ```
877+
#[unstable(feature = "result_cloned", reason = "newly added", issue = "63168")]
878+
pub fn cloned(self) -> Result<T, E> {
879+
self.map(|t| t.clone())
880+
}
881+
}
882+
883+
impl<T: Clone, E> Result<&mut T, E> {
884+
/// Maps a `Result<&mut T, E>` to a `Result<T, E>` by cloning the contents of the
885+
/// `Ok` part.
886+
///
887+
/// # Examples
888+
///
889+
/// ```
890+
/// #![feature(result_cloned)]
891+
/// let mut val = 12;
892+
/// let x: Result<&mut i32, i32> = Ok(&mut val);
893+
/// assert_eq!(x, Ok(&mut 12));
894+
/// let cloned = x.cloned();
895+
/// assert_eq!(cloned, Ok(12));
896+
/// ```
897+
#[unstable(feature = "result_cloned", reason = "newly added", issue = "63168")]
898+
pub fn cloned(self) -> Result<T, E> {
899+
self.map(|t| t.clone())
900+
}
901+
}
902+
903+
823904
impl<T, E: fmt::Debug> Result<T, E> {
824905
/// Unwraps a result, yielding the content of an [`Ok`].
825906
///

src/libcore/tests/iter.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,12 @@ fn test_rposition() {
16881688
assert!(v.iter().rposition(g).is_none());
16891689
}
16901690

1691+
#[test]
1692+
fn test_rev_rposition() {
1693+
let v = [0, 0, 1, 1];
1694+
assert_eq!(v.iter().rev().rposition(|&x| x == 1), Some(1));
1695+
}
1696+
16911697
#[test]
16921698
#[should_panic]
16931699
fn test_rposition_panic() {

src/libcore/unicode/mod.rs

-5
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,3 @@ pub mod derived_property {
1313
pub mod conversions {
1414
pub use crate::unicode::tables::conversions::{to_lower, to_upper};
1515
}
16-
17-
// For use in libsyntax
18-
pub mod property {
19-
pub use crate::unicode::tables::property::Pattern_White_Space;
20-
}

0 commit comments

Comments
 (0)