Skip to content

Commit b8121cb

Browse files
committed
---
yaml --- r: 233753 b: refs/heads/beta c: 17b6fcd h: refs/heads/master i: 233751: 4c3cdfb v: v3
1 parent 978d819 commit b8121cb

File tree

48 files changed

+827
-552
lines changed

Some content is hidden

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

48 files changed

+827
-552
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: 2367cafe9d3f34fe38fa062b4d9f26bd1190a74e
26+
refs/heads/beta: 17b6fcd4589f678700c71bc88daabb5ba2d80bf0
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/mk/main.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ LLVM_VERSION_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --version)
294294
LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
295295
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
296296
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
297-
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
297+
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L native="$$(LLVM_LIBDIR_$(1))"
298298
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
299299
ifeq ($$(findstring freebsd,$(1)),freebsd)
300300
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),

branches/beta/src/doc/trpl/crates-and-modules.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ $ ls target/debug
115115
build deps examples libphrases-a7448e02a0468eaa.rlib native
116116
```
117117

118-
`libphrase-hash.rlib` is the compiled crate. Before we see how to use this
118+
`libphrases-hash.rlib` is the compiled crate. Before we see how to use this
119119
crate from another crate, let’s break it up into multiple files.
120120

121121
# Multiple file crates

branches/beta/src/liballoc/arc.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ use boxed::Box;
7373

7474
use core::sync::atomic;
7575
use core::sync::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
76+
use core::borrow;
7677
use core::fmt;
7778
use core::cmp::Ordering;
7879
use core::mem::{align_of_val, size_of_val};
@@ -1109,3 +1110,7 @@ mod tests {
11091110
assert!(y.upgrade().is_none());
11101111
}
11111112
}
1113+
1114+
impl<T: ?Sized> borrow::Borrow<T> for Arc<T> {
1115+
fn borrow(&self) -> &T { &**self }
1116+
}

branches/beta/src/liballoc/boxed.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ use heap;
5757
use raw_vec::RawVec;
5858

5959
use core::any::Any;
60+
use core::borrow;
6061
use core::cmp::Ordering;
6162
use core::fmt;
6263
use core::hash::{self, Hash};
@@ -562,3 +563,10 @@ impl<T: Clone> Clone for Box<[T]> {
562563
}
563564
}
564565

566+
impl<T: ?Sized> borrow::Borrow<T> for Box<T> {
567+
fn borrow(&self) -> &T { &**self }
568+
}
569+
570+
impl<T: ?Sized> borrow::BorrowMut<T> for Box<T> {
571+
fn borrow_mut(&mut self) -> &mut T { &mut **self }
572+
}

branches/beta/src/liballoc/rc.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ use boxed::Box;
158158
#[cfg(test)]
159159
use std::boxed::Box;
160160

161+
use core::borrow;
161162
use core::cell::Cell;
162163
use core::cmp::Ordering;
163164
use core::fmt;
@@ -1091,3 +1092,7 @@ mod tests {
10911092
assert_eq!(foo, foo.clone());
10921093
}
10931094
}
1095+
1096+
impl<T: ?Sized> borrow::Borrow<T> for Rc<T> {
1097+
fn borrow(&self) -> &T { &**self }
1098+
}

branches/beta/src/libcollections/borrow.rs

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -21,119 +21,10 @@ use core::ops::Deref;
2121
use core::option::Option;
2222

2323
use fmt;
24-
use alloc::{boxed, rc, arc};
2524

2625
use self::Cow::*;
2726

28-
/// A trait for borrowing data.
29-
///
30-
/// In general, there may be several ways to "borrow" a piece of data. The
31-
/// typical ways of borrowing a type `T` are `&T` (a shared borrow) and `&mut T`
32-
/// (a mutable borrow). But types like `Vec<T>` provide additional kinds of
33-
/// borrows: the borrowed slices `&[T]` and `&mut [T]`.
34-
///
35-
/// When writing generic code, it is often desirable to abstract over all ways
36-
/// of borrowing data from a given type. That is the role of the `Borrow`
37-
/// trait: if `T: Borrow<U>`, then `&U` can be borrowed from `&T`. A given
38-
/// type can be borrowed as multiple different types. In particular, `Vec<T>:
39-
/// Borrow<Vec<T>>` and `Vec<T>: Borrow<[T]>`.
40-
///
41-
/// If you are implementing `Borrow` and both `Self` and `Borrowed` implement
42-
/// `Hash`, `Eq`, and/or `Ord`, they must produce the same result.
43-
///
44-
/// `Borrow` is very similar to, but different than, `AsRef`. See
45-
/// [the book][book] for more.
46-
///
47-
/// [book]: ../../book/borrow-and-asref.html
48-
#[stable(feature = "rust1", since = "1.0.0")]
49-
pub trait Borrow<Borrowed: ?Sized> {
50-
/// Immutably borrows from an owned value.
51-
///
52-
/// # Examples
53-
///
54-
/// ```
55-
/// use std::borrow::Borrow;
56-
///
57-
/// fn check<T: Borrow<str>>(s: T) {
58-
/// assert_eq!("Hello", s.borrow());
59-
/// }
60-
///
61-
/// let s = "Hello".to_string();
62-
///
63-
/// check(s);
64-
///
65-
/// let s = "Hello";
66-
///
67-
/// check(s);
68-
/// ```
69-
#[stable(feature = "rust1", since = "1.0.0")]
70-
fn borrow(&self) -> &Borrowed;
71-
}
72-
73-
/// A trait for mutably borrowing data.
74-
///
75-
/// Similar to `Borrow`, but for mutable borrows.
76-
#[stable(feature = "rust1", since = "1.0.0")]
77-
pub trait BorrowMut<Borrowed: ?Sized> : Borrow<Borrowed> {
78-
/// Mutably borrows from an owned value.
79-
///
80-
/// # Examples
81-
///
82-
/// ```
83-
/// use std::borrow::BorrowMut;
84-
///
85-
/// fn check<T: BorrowMut<[i32]>>(mut v: T) {
86-
/// assert_eq!(&mut [1, 2, 3], v.borrow_mut());
87-
/// }
88-
///
89-
/// let v = vec![1, 2, 3];
90-
///
91-
/// check(v);
92-
/// ```
93-
#[stable(feature = "rust1", since = "1.0.0")]
94-
fn borrow_mut(&mut self) -> &mut Borrowed;
95-
}
96-
97-
#[stable(feature = "rust1", since = "1.0.0")]
98-
impl<T: ?Sized> Borrow<T> for T {
99-
fn borrow(&self) -> &T { self }
100-
}
101-
102-
#[stable(feature = "rust1", since = "1.0.0")]
103-
impl<T: ?Sized> BorrowMut<T> for T {
104-
fn borrow_mut(&mut self) -> &mut T { self }
105-
}
106-
107-
#[stable(feature = "rust1", since = "1.0.0")]
108-
impl<'a, T: ?Sized> Borrow<T> for &'a T {
109-
fn borrow(&self) -> &T { &**self }
110-
}
111-
112-
#[stable(feature = "rust1", since = "1.0.0")]
113-
impl<'a, T: ?Sized> Borrow<T> for &'a mut T {
114-
fn borrow(&self) -> &T { &**self }
115-
}
116-
117-
#[stable(feature = "rust1", since = "1.0.0")]
118-
impl<'a, T: ?Sized> BorrowMut<T> for &'a mut T {
119-
fn borrow_mut(&mut self) -> &mut T { &mut **self }
120-
}
121-
122-
impl<T: ?Sized> Borrow<T> for boxed::Box<T> {
123-
fn borrow(&self) -> &T { &**self }
124-
}
125-
126-
impl<T: ?Sized> BorrowMut<T> for boxed::Box<T> {
127-
fn borrow_mut(&mut self) -> &mut T { &mut **self }
128-
}
129-
130-
impl<T: ?Sized> Borrow<T> for rc::Rc<T> {
131-
fn borrow(&self) -> &T { &**self }
132-
}
133-
134-
impl<T: ?Sized> Borrow<T> for arc::Arc<T> {
135-
fn borrow(&self) -> &T { &**self }
136-
}
27+
pub use core::borrow::{Borrow, BorrowMut};
13728

13829
#[stable(feature = "rust1", since = "1.0.0")]
13930
impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B> where B: ToOwned, <B as ToOwned>::Owned: 'a {

branches/beta/src/libcollections/btree/map.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use core::fmt::Debug;
2222
use core::hash::{Hash, Hasher};
2323
use core::iter::{Map, FromIterator};
2424
use core::ops::Index;
25-
use core::{iter, fmt, mem, usize};
25+
use core::{fmt, mem, usize};
2626
use Bound::{self, Included, Excluded, Unbounded};
2727

2828
use borrow::Borrow;
@@ -915,15 +915,15 @@ impl<K: Eq, V: Eq> Eq for BTreeMap<K, V> {}
915915
impl<K: PartialOrd, V: PartialOrd> PartialOrd for BTreeMap<K, V> {
916916
#[inline]
917917
fn partial_cmp(&self, other: &BTreeMap<K, V>) -> Option<Ordering> {
918-
iter::order::partial_cmp(self.iter(), other.iter())
918+
self.iter().partial_cmp(other.iter())
919919
}
920920
}
921921

922922
#[stable(feature = "rust1", since = "1.0.0")]
923923
impl<K: Ord, V: Ord> Ord for BTreeMap<K, V> {
924924
#[inline]
925925
fn cmp(&self, other: &BTreeMap<K, V>) -> Ordering {
926-
iter::order::cmp(self.iter(), other.iter())
926+
self.iter().cmp(other.iter())
927927
}
928928
}
929929

branches/beta/src/libcollections/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
#![feature(unicode)]
5757
#![feature(unique)]
5858
#![feature(unsafe_no_drop_flag, filling_drop)]
59+
#![feature(decode_utf16)]
5960
#![feature(utf8_error)]
6061
#![cfg_attr(test, feature(rand, test))]
6162

branches/beta/src/libcollections/linked_list.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ use alloc::boxed::Box;
2525
use core::cmp::Ordering;
2626
use core::fmt;
2727
use core::hash::{Hasher, Hash};
28-
use core::iter::{self, FromIterator};
28+
use core::iter::FromIterator;
2929
use core::mem;
3030
use core::ptr;
3131

@@ -917,12 +917,12 @@ impl<'a, T: 'a + Copy> Extend<&'a T> for LinkedList<T> {
917917
impl<A: PartialEq> PartialEq for LinkedList<A> {
918918
fn eq(&self, other: &LinkedList<A>) -> bool {
919919
self.len() == other.len() &&
920-
iter::order::eq(self.iter(), other.iter())
920+
self.iter().eq(other.iter())
921921
}
922922

923923
fn ne(&self, other: &LinkedList<A>) -> bool {
924924
self.len() != other.len() ||
925-
iter::order::ne(self.iter(), other.iter())
925+
self.iter().ne(other.iter())
926926
}
927927
}
928928

@@ -932,15 +932,15 @@ impl<A: Eq> Eq for LinkedList<A> {}
932932
#[stable(feature = "rust1", since = "1.0.0")]
933933
impl<A: PartialOrd> PartialOrd for LinkedList<A> {
934934
fn partial_cmp(&self, other: &LinkedList<A>) -> Option<Ordering> {
935-
iter::order::partial_cmp(self.iter(), other.iter())
935+
self.iter().partial_cmp(other.iter())
936936
}
937937
}
938938

939939
#[stable(feature = "rust1", since = "1.0.0")]
940940
impl<A: Ord> Ord for LinkedList<A> {
941941
#[inline]
942942
fn cmp(&self, other: &LinkedList<A>) -> Ordering {
943-
iter::order::cmp(self.iter(), other.iter())
943+
self.iter().cmp(other.iter())
944944
}
945945
}
946946

branches/beta/src/libcollections/string.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use core::ops::{self, Deref, Add, Index};
2020
use core::ptr;
2121
use core::slice;
2222
use core::str::pattern::Pattern;
23+
use rustc_unicode::char::{decode_utf16, REPLACEMENT_CHARACTER};
2324
use rustc_unicode::str as unicode_str;
24-
use rustc_unicode::str::Utf16Item;
2525

2626
use borrow::{Cow, IntoCow};
2727
use range::RangeArgument;
@@ -267,14 +267,7 @@ impl String {
267267
/// ```
268268
#[stable(feature = "rust1", since = "1.0.0")]
269269
pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
270-
let mut s = String::with_capacity(v.len());
271-
for c in unicode_str::utf16_items(v) {
272-
match c {
273-
Utf16Item::ScalarValue(c) => s.push(c),
274-
Utf16Item::LoneSurrogate(_) => return Err(FromUtf16Error(())),
275-
}
276-
}
277-
Ok(s)
270+
decode_utf16(v.iter().cloned()).collect::<Result<_, _>>().map_err(|_| FromUtf16Error(()))
278271
}
279272

280273
/// Decode a UTF-16 encoded vector `v` into a string, replacing
@@ -294,7 +287,7 @@ impl String {
294287
#[inline]
295288
#[stable(feature = "rust1", since = "1.0.0")]
296289
pub fn from_utf16_lossy(v: &[u16]) -> String {
297-
unicode_str::utf16_items(v).map(|c| c.to_char_lossy()).collect()
290+
decode_utf16(v.iter().cloned()).map(|r| r.unwrap_or(REPLACEMENT_CHARACTER)).collect()
298291
}
299292

300293
/// Creates a new `String` from a length, capacity, and pointer.

branches/beta/src/libcollections/vec_deque.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
use core::cmp::Ordering;
2222
use core::fmt;
23-
use core::iter::{self, repeat, FromIterator};
23+
use core::iter::{repeat, FromIterator};
2424
use core::ops::{Index, IndexMut};
2525
use core::ptr;
2626
use core::slice;
@@ -1676,15 +1676,15 @@ impl<A: Eq> Eq for VecDeque<A> {}
16761676
#[stable(feature = "rust1", since = "1.0.0")]
16771677
impl<A: PartialOrd> PartialOrd for VecDeque<A> {
16781678
fn partial_cmp(&self, other: &VecDeque<A>) -> Option<Ordering> {
1679-
iter::order::partial_cmp(self.iter(), other.iter())
1679+
self.iter().partial_cmp(other.iter())
16801680
}
16811681
}
16821682

16831683
#[stable(feature = "rust1", since = "1.0.0")]
16841684
impl<A: Ord> Ord for VecDeque<A> {
16851685
#[inline]
16861686
fn cmp(&self, other: &VecDeque<A>) -> Ordering {
1687-
iter::order::cmp(self.iter(), other.iter())
1687+
self.iter().cmp(other.iter())
16881688
}
16891689
}
16901690

0 commit comments

Comments
 (0)