Skip to content

Commit 0052ba3

Browse files
committed
---
yaml --- r: 235379 b: refs/heads/stable c: 05d8767 h: refs/heads/master i: 235377: dd449a7 235375: 58905d4 v: v3
1 parent 35c99e9 commit 0052ba3

Some content is hidden

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

95 files changed

+1222
-574
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: ed472c8e0dc0e26e48fd875e2cf08042546c2706
32+
refs/heads/stable: 05d8767289351a6111c77a5dfa8ba35468f721f6
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# i686-unknown-freebsd configuration
2+
CC_i686-unknown-freebsd=$(CC)
3+
CXX_i686-unknown-freebsd=$(CXX)
4+
CPP_i686-unknown-freebsd=$(CPP)
5+
AR_i686-unknown-freebsd=$(AR)
6+
CFG_LIB_NAME_i686-unknown-freebsd=lib$(1).so
7+
CFG_STATIC_LIB_NAME_i686-unknown-freebsd=lib$(1).a
8+
CFG_LIB_GLOB_i686-unknown-freebsd=lib$(1)-*.so
9+
CFG_LIB_DSYM_GLOB_i686-unknown-freebsd=$(1)-*.dylib.dSYM
10+
CFG_JEMALLOC_CFLAGS_i686-unknown-freebsd := -m32 -arch i386 -I/usr/local/include $(CFLAGS)
11+
CFG_GCCISH_CFLAGS_i686-unknown-freebsd := -Wall -Werror -g -fPIC -m32 -arch i386 -I/usr/local/include $(CFLAGS)
12+
CFG_GCCISH_LINK_FLAGS_i686-unknown-freebsd := -m32 -shared -fPIC -g -pthread -lrt
13+
CFG_GCCISH_DEF_FLAG_i686-unknown-freebsd := -Wl,--export-dynamic,--dynamic-list=
14+
CFG_LLC_FLAGS_i686-unknown-freebsd :=
15+
CFG_INSTALL_NAME_i686-unknown-freebsd =
16+
CFG_EXE_SUFFIX_i686-unknown-freebsd :=
17+
CFG_WINDOWSY_i686-unknown-freebsd :=
18+
CFG_UNIXY_i686-unknown-freebsd := 1
19+
CFG_LDPATH_i686-unknown-freebsd :=
20+
CFG_RUN_i686-unknown-freebsd=$(2)
21+
CFG_RUN_TARG_i686-unknown-freebsd=$(call CFG_RUN_i686-unknown-freebsd,,$(2))
22+
CFG_GNU_TRIPLE_i686-unknown-freebsd := i686-unknown-freebsd

branches/stable/src/compiletest/compiletest.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#![feature(libc)]
1616
#![feature(path_ext)]
1717
#![feature(rustc_private)]
18-
#![feature(slice_extras)]
18+
#![feature(slice_splits)]
1919
#![feature(str_char)]
2020
#![feature(test)]
2121
#![feature(vec_push_all)]
@@ -90,9 +90,7 @@ pub fn parse_config(args: Vec<String> ) -> Config {
9090
optopt("", "lldb-python-dir", "directory containing LLDB's python module", "PATH"),
9191
optflag("h", "help", "show this message"));
9292

93-
assert!(!args.is_empty());
94-
let argv0 = args[0].clone();
95-
let args_ = args.tail();
93+
let (argv0, args_) = args.split_first().unwrap();
9694
if args[1] == "-h" || args[1] == "--help" {
9795
let message = format!("Usage: {} [OPTIONS] [TESTNAME...]", argv0);
9896
println!("{}", getopts::usage(&message, &groups));

branches/stable/src/liballoc/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use core::raw::{TraitObject};
7171
/// The following two examples are equivalent:
7272
///
7373
/// ```
74-
/// # #![feature(box_heap)]
74+
/// #![feature(box_heap)]
7575
/// #![feature(box_syntax)]
7676
/// use std::boxed::HEAP;
7777
///
@@ -162,7 +162,7 @@ impl<T : ?Sized> Box<T> {
162162
///
163163
/// # Examples
164164
/// ```
165-
/// # #![feature(box_raw)]
165+
/// #![feature(box_raw)]
166166
/// use std::boxed;
167167
///
168168
/// let seventeen = Box::new(17u32);

branches/stable/src/libcollections/slice.rs

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,34 +282,65 @@ impl<T> [T] {
282282

283283
/// Returns all but the first element of a slice.
284284
#[unstable(feature = "slice_extras", reason = "likely to be renamed")]
285+
#[deprecated(since = "1.3.0", reason = "superseded by split_first")]
285286
#[inline]
286287
pub fn tail(&self) -> &[T] {
287288
core_slice::SliceExt::tail(self)
288289
}
289290

291+
/// Returns the first and all the rest of the elements of a slice.
292+
#[unstable(feature = "slice_splits", reason = "new API")]
293+
#[inline]
294+
pub fn split_first(&self) -> Option<(&T, &[T])> {
295+
core_slice::SliceExt::split_first(self)
296+
}
297+
290298
/// Returns all but the first element of a mutable slice
291-
#[unstable(feature = "slice_extras",
292-
reason = "likely to be renamed or removed")]
299+
#[unstable(feature = "slice_extras", reason = "likely to be renamed or removed")]
300+
#[deprecated(since = "1.3.0", reason = "superseded by split_first_mut")]
293301
#[inline]
294302
pub fn tail_mut(&mut self) -> &mut [T] {
295303
core_slice::SliceExt::tail_mut(self)
296304
}
297305

306+
/// Returns the first and all the rest of the elements of a slice.
307+
#[unstable(feature = "slice_splits", reason = "new API")]
308+
#[inline]
309+
pub fn split_first_mut(&mut self) -> Option<(&mut T, &mut [T])> {
310+
core_slice::SliceExt::split_first_mut(self)
311+
}
312+
298313
/// Returns all but the last element of a slice.
299314
#[unstable(feature = "slice_extras", reason = "likely to be renamed")]
315+
#[deprecated(since = "1.3.0", reason = "superseded by split_last")]
300316
#[inline]
301317
pub fn init(&self) -> &[T] {
302318
core_slice::SliceExt::init(self)
303319
}
304320

321+
/// Returns the last and all the rest of the elements of a slice.
322+
#[unstable(feature = "slice_splits", reason = "new API")]
323+
#[inline]
324+
pub fn split_last(&self) -> Option<(&T, &[T])> {
325+
core_slice::SliceExt::split_last(self)
326+
327+
}
328+
305329
/// Returns all but the last element of a mutable slice
306-
#[unstable(feature = "slice_extras",
307-
reason = "likely to be renamed or removed")]
330+
#[unstable(feature = "slice_extras", reason = "likely to be renamed or removed")]
331+
#[deprecated(since = "1.3.0", reason = "superseded by split_last_mut")]
308332
#[inline]
309333
pub fn init_mut(&mut self) -> &mut [T] {
310334
core_slice::SliceExt::init_mut(self)
311335
}
312336

337+
/// Returns the last and all the rest of the elements of a slice.
338+
#[unstable(feature = "slice_splits", since = "1.3.0")]
339+
#[inline]
340+
pub fn split_last_mut(&mut self) -> Option<(&mut T, &mut [T])> {
341+
core_slice::SliceExt::split_last_mut(self)
342+
}
343+
313344
/// Returns the last element of a slice, or `None` if it is empty.
314345
///
315346
/// # Examples

branches/stable/src/libcollections/str.rs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ use core::result::Result;
6161
use core::str as core_str;
6262
use core::str::pattern::Pattern;
6363
use core::str::pattern::{Searcher, ReverseSearcher, DoubleEndedSearcher};
64+
use core::mem;
6465
use rustc_unicode::str::{UnicodeStr, Utf16Encoder};
6566

6667
use vec_deque::VecDeque;
@@ -69,6 +70,7 @@ use string::String;
6970
use rustc_unicode;
7071
use vec::Vec;
7172
use slice::SliceConcatExt;
73+
use boxed::Box;
7274

7375
pub use core::str::{FromStr, Utf8Error};
7476
pub use core::str::{Lines, LinesAny, CharRange};
@@ -82,10 +84,6 @@ pub use core::str::{from_utf8_unchecked, ParseBoolError};
8284
pub use rustc_unicode::str::{SplitWhitespace, Words, Graphemes, GraphemeIndices};
8385
pub use core::str::pattern;
8486

85-
/*
86-
Section: Creating a string
87-
*/
88-
8987
impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
9088
type Output = String;
9189

@@ -138,10 +136,6 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
138136
}
139137
}
140138

141-
/*
142-
Section: Iterators
143-
*/
144-
145139
// Helper functions used for Unicode normalization
146140
fn canonical_sort(comb: &mut [(char, u8)]) {
147141
let len = comb.len();
@@ -386,10 +380,6 @@ impl<'a> Iterator for Utf16Units<'a> {
386380
fn size_hint(&self) -> (usize, Option<usize>) { self.encoder.size_hint() }
387381
}
388382

389-
/*
390-
Section: Misc
391-
*/
392-
393383
// Return the initial codepoint accumulator for the first byte.
394384
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
395385
// for width 3, and 3 bits for width 4
@@ -418,15 +408,6 @@ impl ToOwned for str {
418408
}
419409
}
420410

421-
/*
422-
Section: CowString
423-
*/
424-
425-
/*
426-
Section: Trait implementations
427-
*/
428-
429-
430411
/// Any string that can be represented as a slice.
431412
#[lang = "str"]
432413
#[cfg(not(test))]
@@ -1928,4 +1909,14 @@ impl str {
19281909
pub fn escape_unicode(&self) -> String {
19291910
self.chars().flat_map(|c| c.escape_unicode()).collect()
19301911
}
1912+
1913+
/// Converts the `Box<str>` into a `String` without copying or allocating.
1914+
#[unstable(feature = "box_str",
1915+
reason = "recently added, matches RFC")]
1916+
pub fn into_string(self: Box<str>) -> String {
1917+
unsafe {
1918+
let slice = mem::transmute::<Box<str>, Box<[u8]>>(self);
1919+
String::from_utf8_unchecked(slice.into_vec())
1920+
}
1921+
}
19311922
}

branches/stable/src/libcollections/string.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ use borrow::{Cow, IntoCow};
2929
use range::RangeArgument;
3030
use str::{self, FromStr, Utf8Error, Chars};
3131
use vec::{DerefVec, Vec, as_vec};
32+
use boxed::Box;
3233

3334
/// A growable string stored as a UTF-8 encoded buffer.
3435
#[derive(Clone, PartialOrd, Eq, Ord)]
@@ -741,6 +742,16 @@ impl String {
741742
string: self_ptr,
742743
}
743744
}
745+
746+
/// Converts the string into `Box<str>`.
747+
///
748+
/// Note that this will drop any excess capacity.
749+
#[unstable(feature = "box_str",
750+
reason = "recently added, matches RFC")]
751+
pub fn into_boxed_slice(self) -> Box<str> {
752+
let slice = self.vec.into_boxed_slice();
753+
unsafe { mem::transmute::<Box<[u8]>, Box<str>>(slice) }
754+
}
744755
}
745756

746757
impl FromUtf8Error {

branches/stable/src/libcollections/vec_deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<T> VecDeque<T> {
108108
ptr::write(self.ptr.offset(off as isize), t);
109109
}
110110

111-
/// Returns true iff the buffer is at capacity
111+
/// Returns true if and only if the buffer is at capacity
112112
#[inline]
113113
fn is_full(&self) -> bool { self.cap - self.len() == 1 }
114114

branches/stable/src/libcollectionstest/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,26 @@
3636
#![feature(rustc_private)]
3737
#![feature(slice_bytes)]
3838
#![feature(slice_chars)]
39-
#![feature(slice_extras)]
39+
#![feature(slice_splits)]
4040
#![feature(slice_position_elem)]
4141
#![feature(split_off)]
4242
#![feature(step_by)]
4343
#![feature(str_char)]
4444
#![feature(str_escape)]
4545
#![feature(str_match_indices)]
4646
#![feature(str_utf16)]
47+
#![feature(box_str)]
4748
#![feature(subslice_offset)]
4849
#![feature(test)]
4950
#![feature(unboxed_closures)]
5051
#![feature(unicode)]
5152
#![feature(vec_deque_retain)]
5253
#![feature(vec_from_raw_buf)]
5354
#![feature(vec_push_all)]
54-
#![feature(vec_split_off)]
5555
#![feature(vecmap)]
5656

57+
#![allow(deprecated)]
58+
5759
#[macro_use] extern crate log;
5860

5961
extern crate collections;

branches/stable/src/libcollectionstest/slice.rs

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -119,71 +119,48 @@ fn test_first_mut() {
119119
}
120120

121121
#[test]
122-
fn test_tail() {
122+
fn test_split_first() {
123123
let mut a = vec![11];
124124
let b: &[i32] = &[];
125-
assert_eq!(a.tail(), b);
125+
assert!(b.split_first().is_none());
126+
assert_eq!(a.split_first(), Some((&11, b)));
126127
a = vec![11, 12];
127128
let b: &[i32] = &[12];
128-
assert_eq!(a.tail(), b);
129+
assert_eq!(a.split_first(), Some((&11, b)));
129130
}
130131

131132
#[test]
132-
fn test_tail_mut() {
133+
fn test_split_first_mut() {
133134
let mut a = vec![11];
134135
let b: &mut [i32] = &mut [];
135-
assert!(a.tail_mut() == b);
136+
assert!(b.split_first_mut().is_none());
137+
assert!(a.split_first_mut() == Some((&mut 11, b)));
136138
a = vec![11, 12];
137139
let b: &mut [_] = &mut [12];
138-
assert!(a.tail_mut() == b);
140+
assert!(a.split_first_mut() == Some((&mut 11, b)));
139141
}
140142

141143
#[test]
142-
#[should_panic]
143-
fn test_tail_empty() {
144-
let a = Vec::<i32>::new();
145-
a.tail();
146-
}
147-
148-
#[test]
149-
#[should_panic]
150-
fn test_tail_mut_empty() {
151-
let mut a = Vec::<i32>::new();
152-
a.tail_mut();
153-
}
154-
155-
#[test]
156-
fn test_init() {
144+
fn test_split_last() {
157145
let mut a = vec![11];
158146
let b: &[i32] = &[];
159-
assert_eq!(a.init(), b);
147+
assert!(b.split_last().is_none());
148+
assert_eq!(a.split_last(), Some((&11, b)));
160149
a = vec![11, 12];
161150
let b: &[_] = &[11];
162-
assert_eq!(a.init(), b);
151+
assert_eq!(a.split_last(), Some((&12, b)));
163152
}
164153

165154
#[test]
166-
fn test_init_mut() {
155+
fn test_split_last_mut() {
167156
let mut a = vec![11];
168157
let b: &mut [i32] = &mut [];
169-
assert!(a.init_mut() == b);
158+
assert!(b.split_last_mut().is_none());
159+
assert!(a.split_last_mut() == Some((&mut 11, b)));
160+
170161
a = vec![11, 12];
171162
let b: &mut [_] = &mut [11];
172-
assert!(a.init_mut() == b);
173-
}
174-
175-
#[test]
176-
#[should_panic]
177-
fn test_init_empty() {
178-
let a = Vec::<i32>::new();
179-
a.init();
180-
}
181-
182-
#[test]
183-
#[should_panic]
184-
fn test_init_mut_empty() {
185-
let mut a = Vec::<i32>::new();
186-
a.init_mut();
163+
assert!(a.split_last_mut() == Some((&mut 12, b)));
187164
}
188165

189166
#[test]

branches/stable/src/libcollectionstest/str.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,6 +1746,14 @@ fn to_uppercase() {
17461746
assert_eq!("aéDžßfiᾀ".to_uppercase(), "AÉDŽSSFIἈΙ");
17471747
}
17481748

1749+
#[test]
1750+
fn test_into_string() {
1751+
// The only way to acquire a Box<str> in the first place is through a String, so just
1752+
// test that we can round-trip between Box<str> and String.
1753+
let string = String::from("Some text goes here");
1754+
assert_eq!(string.clone().into_boxed_slice().into_string(), string);
1755+
}
1756+
17491757
mod pattern {
17501758
use std::str::pattern::Pattern;
17511759
use std::str::pattern::{Searcher, ReverseSearcher};

0 commit comments

Comments
 (0)