Skip to content

Commit c63f2c2

Browse files
committed
---
yaml --- r: 227827 b: refs/heads/try c: 165a281 h: refs/heads/master i: 227825: f4e2178 227823: 879475c v: v3
1 parent d5f7cb1 commit c63f2c2

File tree

16 files changed

+594
-129
lines changed

16 files changed

+594
-129
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: aca2057ed5fb7af3f8905b2bc01f72fa001c35c8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: b213c947f80582857681a8b8ed4033627997e7e5
4+
refs/heads/try: 165a2817a413fd08eb7feeae145554d219f20552
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/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/try/src/doc/trpl/ffi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ and invokes callbacks from there.
309309
In these cases access to Rust data structures inside the callbacks is
310310
especially unsafe and proper synchronization mechanisms must be used.
311311
Besides classical synchronization mechanisms like mutexes, one possibility in
312-
Rust is to use channels (in `std::comm`) to forward data from the C thread
313-
that invoked the callback into a Rust thread.
312+
Rust is to use channels (in `std::sync::mpsc`) to forward data from the C
313+
thread that invoked the callback into a Rust thread.
314314
315315
If an asynchronous callback targets a special object in the Rust address space
316316
it is also absolutely necessary that no more callbacks are performed by the

branches/try/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/try/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/try/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/try/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/try/src/liblibc/lib.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3600,11 +3600,6 @@ pub mod consts {
36003600
pub const SHUT_RD: c_int = 0;
36013601
pub const SHUT_WR: c_int = 1;
36023602
pub const SHUT_RDWR: c_int = 2;
3603-
3604-
pub const LOCK_SH: c_int = 1;
3605-
pub const LOCK_EX: c_int = 2;
3606-
pub const LOCK_NB: c_int = 4;
3607-
pub const LOCK_UN: c_int = 8;
36083603
}
36093604
#[cfg(any(target_arch = "mips",
36103605
target_arch = "mipsel"))]
@@ -3689,11 +3684,6 @@ pub mod consts {
36893684
pub const SHUT_RD: c_int = 0;
36903685
pub const SHUT_WR: c_int = 1;
36913686
pub const SHUT_RDWR: c_int = 2;
3692-
3693-
pub const LOCK_SH: c_int = 1;
3694-
pub const LOCK_EX: c_int = 2;
3695-
pub const LOCK_NB: c_int = 4;
3696-
pub const LOCK_UN: c_int = 8;
36973687
}
36983688
#[cfg(any(target_arch = "x86",
36993689
target_arch = "x86_64",
@@ -4237,11 +4227,6 @@ pub mod consts {
42374227
pub const SHUT_RD: c_int = 0;
42384228
pub const SHUT_WR: c_int = 1;
42394229
pub const SHUT_RDWR: c_int = 2;
4240-
4241-
pub const LOCK_SH: c_int = 1;
4242-
pub const LOCK_EX: c_int = 2;
4243-
pub const LOCK_NB: c_int = 4;
4244-
pub const LOCK_UN: c_int = 8;
42454230
}
42464231
pub mod extra {
42474232
use types::os::arch::c95::c_int;
@@ -4666,11 +4651,6 @@ pub mod consts {
46664651
pub const SHUT_RD: c_int = 0;
46674652
pub const SHUT_WR: c_int = 1;
46684653
pub const SHUT_RDWR: c_int = 2;
4669-
4670-
pub const LOCK_SH: c_int = 1;
4671-
pub const LOCK_EX: c_int = 2;
4672-
pub const LOCK_NB: c_int = 4;
4673-
pub const LOCK_UN: c_int = 8;
46744654
}
46754655
pub mod extra {
46764656
use types::os::arch::c95::c_int;
@@ -5112,11 +5092,6 @@ pub mod consts {
51125092
pub const SHUT_RD: c_int = 0;
51135093
pub const SHUT_WR: c_int = 1;
51145094
pub const SHUT_RDWR: c_int = 2;
5115-
5116-
pub const LOCK_SH: c_int = 1;
5117-
pub const LOCK_EX: c_int = 2;
5118-
pub const LOCK_NB: c_int = 4;
5119-
pub const LOCK_UN: c_int = 8;
51205095
}
51215096
pub mod extra {
51225097
use types::os::arch::c95::c_int;
@@ -6146,7 +6121,6 @@ pub mod funcs {
61466121
-> c_int;
61476122
pub fn realpath(pathname: *const c_char, resolved: *mut c_char)
61486123
-> *mut c_char;
6149-
pub fn flock(fd: c_int, operation: c_int) -> c_int;
61506124
}
61516125
}
61526126

@@ -6163,7 +6137,6 @@ pub mod funcs {
61636137
-> c_int;
61646138
pub fn mincore(addr: *mut c_void, len: size_t, vec: *mut c_uchar)
61656139
-> c_int;
6166-
pub fn flock(fd: c_int, operation: c_int) -> c_int;
61676140
}
61686141
}
61696142

branches/try/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-
moved_lp.ty,
737+
expr_ty,
738738
suggestion));
739739
self.tcx.sess.fileline_help(expr_span, help);
740740
}

branches/try/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)