Skip to content

Commit e339927

Browse files
author
Nick Hamann
committed
---
yaml --- r: 219582 b: refs/heads/snap-stage3 c: 0cc26b2 h: refs/heads/master v: v3
1 parent fb54c43 commit e339927

File tree

11 files changed

+598
-35
lines changed

11 files changed

+598
-35
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
refs/heads/master: c044791d80ea0dc5c4b57b6030a67b69f8510239
3-
refs/heads/snap-stage3: 688b62382c3eeeb0086eb4ada8ad25b08883960e
3+
refs/heads/snap-stage3: 0cc26b205855118491c2825fd79ba30e09ac2755
44
refs/heads/try: b53c0f93eedcdedd4fd89bccc5a3a09d1c5cd23e
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/snap-stage3/configure

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -899,18 +899,6 @@ then
899899
fi
900900
fi
901901

902-
# If the clang isn't already enabled, check for GCC, and if it is missing, turn
903-
# on clang as a backup.
904-
if [ -z "$CFG_ENABLE_CLANG" ]
905-
then
906-
CFG_GCC_VERSION=$("$CFG_GCC" --version 2>&1)
907-
if [ $? -ne 0 ]
908-
then
909-
step_msg "GCC not installed, will try using Clang"
910-
CFG_ENABLE_CLANG=1
911-
fi
912-
fi
913-
914902
# Okay, at this point, we have made up our minds about whether we are
915903
# going to force CFG_ENABLE_CLANG or not; save the setting if so.
916904
if [ ! -z "$CFG_ENABLE_CLANG" ]

branches/snap-stage3/src/etc/unicode.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,13 @@ def emit_conversions_module(f, to_upper, to_lower, to_title):
372372
}
373373
}
374374
375+
pub fn to_title(c: char) -> [char; 3] {
376+
match bsearch_case_table(c, to_titlecase_table) {
377+
None => [c, '\\0', '\\0'],
378+
Some(index) => to_titlecase_table[index].1
379+
}
380+
}
381+
375382
fn bsearch_case_table(c: char, table: &'static [(char, [char; 3])]) -> Option<usize> {
376383
match table.binary_search_by(|&(key, _)| {
377384
if c == key { Equal }
@@ -393,6 +400,9 @@ def emit_conversions_module(f, to_upper, to_lower, to_title):
393400
emit_table(f, "to_uppercase_table",
394401
sorted(to_upper.iteritems(), key=operator.itemgetter(0)),
395402
is_pub=False, t_type = t_type, pfun=pfun)
403+
emit_table(f, "to_titlecase_table",
404+
sorted(to_title.iteritems(), key=operator.itemgetter(0)),
405+
is_pub=False, t_type = t_type, pfun=pfun)
396406
f.write("}\n\n")
397407

398408
def emit_grapheme_module(f, grapheme_table, grapheme_cats):

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,7 +1482,7 @@ impl<T> FromIterator<T> for Vec<T> {
14821482
None => return Vec::new(),
14831483
Some(element) => {
14841484
let (lower, _) = iterator.size_hint();
1485-
let mut vector = Vec::with_capacity(lower.saturating_add(1));
1485+
let mut vector = Vec::with_capacity(1 + lower);
14861486
unsafe {
14871487
ptr::write(vector.get_unchecked_mut(0), element);
14881488
vector.set_len(1);
@@ -1570,11 +1570,10 @@ impl<T> Vec<T> {
15701570
let len = self.len();
15711571
if len == self.capacity() {
15721572
let (lower, _) = iterator.size_hint();
1573-
self.reserve(lower.saturating_add(1));
1573+
self.reserve(lower + 1);
15741574
}
15751575
unsafe {
15761576
ptr::write(self.get_unchecked_mut(len), element);
1577-
// NB can't overflow since we would have had to alloc the address space
15781577
self.set_len(len + 1);
15791578
}
15801579
}

branches/snap-stage3/src/libcollectionstest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![feature(append)]
12+
#![feature(bit_vec_append_split_off)]
1213
#![feature(bitset)]
1314
#![feature(bitvec)]
1415
#![feature(box_syntax)]

branches/snap-stage3/src/libcoretest/char.rs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,29 @@ fn test_to_uppercase() {
102102
assert_eq!(upper('ᾀ'), ['Ἀ', 'Ι']);
103103
}
104104

105+
#[test]
106+
fn test_to_titlecase() {
107+
fn title(c: char) -> Vec<char> {
108+
c.to_titlecase().collect()
109+
}
110+
assert_eq!(title('a'), ['A']);
111+
assert_eq!(title('ö'), ['Ö']);
112+
assert_eq!(title('ß'), ['S', 's']); // not ẞ: Latin capital letter sharp s
113+
assert_eq!(title('ü'), ['Ü']);
114+
assert_eq!(title('💩'), ['💩']);
115+
116+
assert_eq!(title('σ'), ['Σ']);
117+
assert_eq!(title('τ'), ['Τ']);
118+
assert_eq!(title('ι'), ['Ι']);
119+
assert_eq!(title('γ'), ['Γ']);
120+
assert_eq!(title('μ'), ['Μ']);
121+
assert_eq!(title('α'), ['Α']);
122+
assert_eq!(title('ς'), ['Σ']);
123+
assert_eq!(title('DŽ'), ['Dž']);
124+
assert_eq!(title('fi'), ['F', 'i']);
125+
assert_eq!(title('ᾀ'), ['ᾈ']);
126+
}
127+
105128
#[test]
106129
fn test_is_control() {
107130
assert!('\u{0}'.is_control());

branches/snap-stage3/src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
734734
has type `{}`, which is {}",
735735
ol,
736736
moved_lp_msg,
737-
expr_ty,
737+
moved_lp.ty,
738738
suggestion));
739739
self.tcx.sess.fileline_help(expr_span, help);
740740
}

branches/snap-stage3/src/librustc_unicode/char.rs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ impl Iterator for ToUppercase {
6767
fn next(&mut self) -> Option<char> { self.0.next() }
6868
}
6969

70+
/// An iterator over the titlecase mapping of a given character, returned from
71+
/// the [`to_titlecase` method](../primitive.char.html#method.to_titlecase) on
72+
/// characters.
73+
#[unstable(feature = "unicode", reason = "recently added")]
74+
pub struct ToTitlecase(CaseMappingIter);
75+
76+
#[stable(feature = "unicode_case_mapping", since = "1.2.0")]
77+
impl Iterator for ToTitlecase {
78+
type Item = char;
79+
fn next(&mut self) -> Option<char> { self.0.next() }
80+
}
81+
7082

7183
enum CaseMappingIter {
7284
Three(char, char, char),
@@ -465,6 +477,27 @@ impl char {
465477
ToLowercase(CaseMappingIter::new(conversions::to_lower(self)))
466478
}
467479

480+
/// Converts a character to its titlecase equivalent.
481+
///
482+
/// This performs complex unconditional mappings with no tailoring.
483+
/// See `to_uppercase()` for references and more information.
484+
///
485+
/// This differs from `to_uppercase()` since Unicode contains
486+
/// digraphs and ligature characters.
487+
/// For example, U+01F3 “dz” and U+FB01 “fi”
488+
/// map to U+01F1 “DZ” and U+0046 U+0069 “Fi”, respectively.
489+
///
490+
/// # Return value
491+
///
492+
/// Returns an iterator which yields the characters corresponding to the
493+
/// titlecase equivalent of the character. If no conversion is possible then
494+
/// an iterator with just the input character is returned.
495+
#[unstable(feature = "unicode", reason = "recently added")]
496+
#[inline]
497+
pub fn to_titlecase(self) -> ToTitlecase {
498+
ToTitlecase(CaseMappingIter::new(conversions::to_title(self)))
499+
}
500+
468501
/// Converts a character to its uppercase equivalent.
469502
///
470503
/// This performs complex unconditional mappings with no tailoring:

0 commit comments

Comments
 (0)