Skip to content

Commit dcb75cd

Browse files
committed
---
yaml --- r: 218575 b: refs/heads/auto c: 50d305e h: refs/heads/master i: 218573: a02e6f9 218571: 674075e 218567: 54b21f4 218559: 854ec4c v: v3
1 parent 29098c2 commit dcb75cd

File tree

34 files changed

+796
-185
lines changed

34 files changed

+796
-185
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
88
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
99
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1010
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
11-
refs/heads/auto: 7a90865db5b9bbf4e94580a886e3ab187d91c83c
11+
refs/heads/auto: 50d305e498c29c022c5bca2726d22e9f09b0a437
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1
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/auto/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/auto/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

@@ -134,10 +132,6 @@ impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
134132
}
135133
}
136134

137-
/*
138-
Section: Iterators
139-
*/
140-
141135
// Helper functions used for Unicode normalization
142136
fn canonical_sort(comb: &mut [(char, u8)]) {
143137
let len = comb.len();
@@ -382,10 +376,6 @@ impl<'a> Iterator for Utf16Units<'a> {
382376
fn size_hint(&self) -> (usize, Option<usize>) { self.encoder.size_hint() }
383377
}
384378

385-
/*
386-
Section: Misc
387-
*/
388-
389379
// Return the initial codepoint accumulator for the first byte.
390380
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
391381
// for width 3, and 3 bits for width 4
@@ -414,15 +404,6 @@ impl ToOwned for str {
414404
}
415405
}
416406

417-
/*
418-
Section: CowString
419-
*/
420-
421-
/*
422-
Section: Trait implementations
423-
*/
424-
425-
426407
/// Any string that can be represented as a slice.
427408
#[lang = "str"]
428409
#[cfg(not(test))]
@@ -1924,4 +1905,14 @@ impl str {
19241905
pub fn escape_unicode(&self) -> String {
19251906
self.chars().flat_map(|c| c.escape_unicode()).collect()
19261907
}
1908+
1909+
/// Converts the `Box<str>` into a `String` without copying or allocating.
1910+
#[unstable(feature = "box_str",
1911+
reason = "recently added, matches RFC")]
1912+
pub fn into_string(self: Box<str>) -> String {
1913+
unsafe {
1914+
let slice = mem::transmute::<Box<str>, Box<[u8]>>(self);
1915+
String::from_utf8_unchecked(slice.into_vec())
1916+
}
1917+
}
19271918
}

branches/auto/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/auto/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/auto/src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
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)]

branches/auto/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};

branches/auto/src/libcollectionstest/string.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,13 @@ fn test_extend_ref() {
374374
assert_eq!(&a, "foobar");
375375
}
376376

377+
#[test]
378+
fn test_into_boxed_slice() {
379+
let xs = String::from("hello my name is bob");
380+
let ys = xs.into_boxed_slice();
381+
assert_eq!(&*ys, "hello my name is bob");
382+
}
383+
377384
#[bench]
378385
fn bench_with_capacity(b: &mut Bencher) {
379386
b.iter(|| {

branches/auto/src/libcore/fmt/builders.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,12 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> {
175175
fn is_pretty(&self) -> bool {
176176
self.fmt.flags() & (1 << (FlagV1::Alternate as usize)) != 0
177177
}
178+
179+
/// Returns the wrapped `Formatter`.
180+
#[unstable(feature = "debug_builder_formatter", reason = "recently added")]
181+
pub fn formatter(&mut self) -> &mut fmt::Formatter<'b> {
182+
&mut self.fmt
183+
}
178184
}
179185

180186
struct DebugInner<'a, 'b: 'a> {

branches/auto/src/libcore/fmt/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,20 +1488,19 @@ macro_rules! tuple {
14881488
impl<$($name:Debug),*> Debug for ($($name,)*) {
14891489
#[allow(non_snake_case, unused_assignments)]
14901490
fn fmt(&self, f: &mut Formatter) -> Result {
1491-
try!(write!(f, "("));
1491+
let mut builder = f.debug_tuple("");
14921492
let ($(ref $name,)*) = *self;
14931493
let mut n = 0;
14941494
$(
1495-
if n > 0 {
1496-
try!(write!(f, ", "));
1497-
}
1498-
try!(write!(f, "{:?}", *$name));
1495+
builder.field($name);
14991496
n += 1;
15001497
)*
1498+
15011499
if n == 1 {
1502-
try!(write!(f, ","));
1500+
try!(write!(builder.formatter(), ","));
15031501
}
1504-
write!(f, ")")
1502+
1503+
builder.finish()
15051504
}
15061505
}
15071506
peel! { $($name,)* }

branches/auto/src/libcore/num/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ macro_rules! uint_impl {
11261126
acc
11271127
}
11281128

1129-
/// Returns `true` iff `self == 2^k` for some `k`.
1129+
/// Returns `true` if and only if `self == 2^k` for some `k`.
11301130
#[stable(feature = "rust1", since = "1.0.0")]
11311131
#[inline]
11321132
pub fn is_power_of_two(self) -> bool {

branches/auto/src/libcore/option.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
//! // The division was valid
4747
//! Some(x) => println!("Result: {}", x),
4848
//! // The division was invalid
49-
//! None => println!("Cannot divide by 0")
49+
//! None => println!("Cannot divide by 0"),
5050
//! }
5151
//! ```
5252
//!
@@ -75,7 +75,7 @@
7575
//! fn check_optional(optional: &Option<Box<i32>>) {
7676
//! match *optional {
7777
//! Some(ref p) => println!("have value {}", p),
78-
//! None => println!("have no value")
78+
//! None => println!("have no value"),
7979
//! }
8080
//! }
8181
//! ```
@@ -95,13 +95,13 @@
9595
//! // Take a reference to the contained string
9696
//! match msg {
9797
//! Some(ref m) => println!("{}", *m),
98-
//! None => ()
98+
//! None => (),
9999
//! }
100100
//!
101101
//! // Remove the contained string, destroying the Option
102102
//! let unwrapped_msg = match msg {
103103
//! Some(m) => m,
104-
//! None => "default message"
104+
//! None => "default message",
105105
//! };
106106
//! ```
107107
//!
@@ -137,7 +137,7 @@
137137
//!
138138
//! match name_of_biggest_animal {
139139
//! Some(name) => println!("the biggest animal is {}", name),
140-
//! None => println!("there are no animals :(")
140+
//! None => println!("there are no animals :("),
141141
//! }
142142
//! ```
143143
@@ -198,7 +198,7 @@ impl<T> Option<T> {
198198
pub fn is_some(&self) -> bool {
199199
match *self {
200200
Some(_) => true,
201-
None => false
201+
None => false,
202202
}
203203
}
204204

@@ -244,7 +244,7 @@ impl<T> Option<T> {
244244
pub fn as_ref<'r>(&'r self) -> Option<&'r T> {
245245
match *self {
246246
Some(ref x) => Some(x),
247-
None => None
247+
None => None,
248248
}
249249
}
250250

@@ -265,7 +265,7 @@ impl<T> Option<T> {
265265
pub fn as_mut<'r>(&'r mut self) -> Option<&'r mut T> {
266266
match *self {
267267
Some(ref mut x) => Some(x),
268-
None => None
268+
None => None,
269269
}
270270
}
271271

@@ -376,7 +376,7 @@ impl<T> Option<T> {
376376
pub fn unwrap_or(self, def: T) -> T {
377377
match self {
378378
Some(x) => x,
379-
None => def
379+
None => def,
380380
}
381381
}
382382

@@ -394,7 +394,7 @@ impl<T> Option<T> {
394394
pub fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
395395
match self {
396396
Some(x) => x,
397-
None => f()
397+
None => f(),
398398
}
399399
}
400400

@@ -420,7 +420,7 @@ impl<T> Option<T> {
420420
pub fn map<U, F: FnOnce(T) -> U>(self, f: F) -> Option<U> {
421421
match self {
422422
Some(x) => Some(f(x)),
423-
None => None
423+
None => None,
424424
}
425425
}
426426

@@ -464,7 +464,7 @@ impl<T> Option<T> {
464464
pub fn map_or_else<U, D: FnOnce() -> U, F: FnOnce(T) -> U>(self, default: D, f: F) -> U {
465465
match self {
466466
Some(t) => f(t),
467-
None => default()
467+
None => default(),
468468
}
469469
}
470470

@@ -637,7 +637,7 @@ impl<T> Option<T> {
637637
pub fn or(self, optb: Option<T>) -> Option<T> {
638638
match self {
639639
Some(_) => self,
640-
None => optb
640+
None => optb,
641641
}
642642
}
643643

@@ -659,7 +659,7 @@ impl<T> Option<T> {
659659
pub fn or_else<F: FnOnce() -> Option<T>>(self, f: F) -> Option<T> {
660660
match self {
661661
Some(_) => self,
662-
None => f()
662+
None => f(),
663663
}
664664
}
665665

@@ -736,7 +736,7 @@ impl<T: Default> Option<T> {
736736
pub fn unwrap_or_default(self) -> T {
737737
match self {
738738
Some(x) => x,
739-
None => Default::default()
739+
None => Default::default(),
740740
}
741741
}
742742
}

0 commit comments

Comments
 (0)