Skip to content

Commit 3b7f927

Browse files
committed
---
yaml --- r: 272602 b: refs/heads/auto c: bcbc9e5 h: refs/heads/master
1 parent b8d573b commit 3b7f927

File tree

67 files changed

+346
-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.

67 files changed

+346
-552
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: 933000613b7774727dd7f1bfe766e2bee71c5747
11+
refs/heads/auto: bcbc9e5346941011f36f71f66c808675b263a589
1212
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1313
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336
1414
refs/tags/0.2: 1754d02027f2924bed83b0160ee340c7f41d5ea1

branches/auto/src/compiletest/compiletest.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#![feature(box_syntax)]
1414
#![feature(libc)]
1515
#![feature(rustc_private)]
16+
#![feature(str_char)]
1617
#![feature(test)]
1718
#![feature(question_mark)]
1819

@@ -411,26 +412,16 @@ fn extract_gdb_version(full_version_line: Option<String>) -> Option<String> {
411412

412413
// used to be a regex "(^|[^0-9])([0-9]\.[0-9]+)"
413414
for (pos, c) in full_version_line.char_indices() {
414-
if !c.is_digit(10) {
415-
continue
416-
}
417-
if pos + 2 >= full_version_line.len() {
418-
continue
419-
}
420-
if full_version_line[pos + 1..].chars().next().unwrap() != '.' {
421-
continue
422-
}
423-
if !full_version_line[pos + 2..].chars().next().unwrap().is_digit(10) {
424-
continue
425-
}
426-
if pos > 0 && full_version_line[..pos].chars().next_back()
427-
.unwrap().is_digit(10) {
415+
if !c.is_digit(10) { continue }
416+
if pos + 2 >= full_version_line.len() { continue }
417+
if full_version_line.char_at(pos + 1) != '.' { continue }
418+
if !full_version_line.char_at(pos + 2).is_digit(10) { continue }
419+
if pos > 0 && full_version_line.char_at_reverse(pos).is_digit(10) {
428420
continue
429421
}
430422
let mut end = pos + 3;
431423
while end < full_version_line.len() &&
432-
full_version_line[end..].chars().next()
433-
.unwrap().is_digit(10) {
424+
full_version_line.char_at(end).is_digit(10) {
434425
end += 1;
435426
}
436427
return Some(full_version_line[pos..end].to_owned());
@@ -462,13 +453,13 @@ fn extract_lldb_version(full_version_line: Option<String>) -> Option<String> {
462453
for (pos, l) in full_version_line.char_indices() {
463454
if l != 'l' && l != 'L' { continue }
464455
if pos + 5 >= full_version_line.len() { continue }
465-
let l = full_version_line[pos + 1..].chars().next().unwrap();
456+
let l = full_version_line.char_at(pos + 1);
466457
if l != 'l' && l != 'L' { continue }
467-
let d = full_version_line[pos + 2..].chars().next().unwrap();
458+
let d = full_version_line.char_at(pos + 2);
468459
if d != 'd' && d != 'D' { continue }
469-
let b = full_version_line[pos + 3..].chars().next().unwrap();
460+
let b = full_version_line.char_at(pos + 3);
470461
if b != 'b' && b != 'B' { continue }
471-
let dash = full_version_line[pos + 4..].chars().next().unwrap();
462+
let dash = full_version_line.char_at(pos + 4);
472463
if dash != '-' { continue }
473464

474465
let vers = full_version_line[pos + 5..].chars().take_while(|c| {

branches/auto/src/compiletest/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
115115
tag: &str)
116116
-> Option<(WhichLine, ExpectedError)> {
117117
let start = match line.find(tag) { Some(i) => i, None => return None };
118-
let (follow, adjusts) = if line[start + tag.len()..].chars().next().unwrap() == '|' {
118+
let (follow, adjusts) = if line.char_at(start + tag.len()) == '|' {
119119
(true, 0)
120120
} else {
121121
(false, line[start + tag.len()..].chars().take_while(|c| *c == '^').count())

branches/auto/src/compiletest/runtest.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
11771177
if *idx >= haystack.len() {
11781178
return false;
11791179
}
1180-
let ch = haystack[*idx..].chars().next().unwrap();
1180+
let ch = haystack.char_at(*idx);
11811181
if ch != needle {
11821182
return false;
11831183
}
@@ -1188,7 +1188,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut usize) -> bool {
11881188
fn scan_integer(haystack: &str, idx: &mut usize) -> bool {
11891189
let mut i = *idx;
11901190
while i < haystack.len() {
1191-
let ch = haystack[i..].chars().next().unwrap();
1191+
let ch = haystack.char_at(i);
11921192
if ch < '0' || '9' < ch {
11931193
break;
11941194
}
@@ -1208,7 +1208,7 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut usize) -> bool {
12081208
if haystack_i >= haystack.len() {
12091209
return false;
12101210
}
1211-
let ch = haystack[haystack_i..].chars().next().unwrap();
1211+
let ch = haystack.char_at(haystack_i);
12121212
haystack_i += ch.len_utf8();
12131213
if !scan_char(needle, ch, &mut needle_i) {
12141214
return false;

branches/auto/src/libcollections/btree/set.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ impl<T: Ord> BTreeSet<T> {
379379
/// The value may be any borrowed form of the set's value type,
380380
/// but the ordering on the borrowed form *must* match the
381381
/// ordering on the value type.
382-
#[stable(feature = "set_recovery", since = "1.9.0")]
382+
#[unstable(feature = "set_recovery", issue = "28050")]
383383
pub fn get<Q: ?Sized>(&self, value: &Q) -> Option<&T>
384384
where T: Borrow<Q>,
385385
Q: Ord
@@ -502,7 +502,7 @@ impl<T: Ord> BTreeSet<T> {
502502

503503
/// Adds a value to the set, replacing the existing value, if any, that is equal to the given
504504
/// one. Returns the replaced value.
505-
#[stable(feature = "set_recovery", since = "1.9.0")]
505+
#[unstable(feature = "set_recovery", issue = "28050")]
506506
pub fn replace(&mut self, value: T) -> Option<T> {
507507
Recover::replace(&mut self.map, value)
508508
}
@@ -538,7 +538,7 @@ impl<T: Ord> BTreeSet<T> {
538538
/// The value may be any borrowed form of the set's value type,
539539
/// but the ordering on the borrowed form *must* match the
540540
/// ordering on the value type.
541-
#[stable(feature = "set_recovery", since = "1.9.0")]
541+
#[unstable(feature = "set_recovery", issue = "28050")]
542542
pub fn take<Q: ?Sized>(&mut self, value: &Q) -> Option<T>
543543
where T: Borrow<Q>,
544544
Q: Ord

branches/auto/src/libcollections/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,15 @@
2727
test(no_crate_inject, attr(allow(unused_variables), deny(warnings))))]
2828

2929
#![cfg_attr(test, allow(deprecated))] // rand
30+
#![cfg_attr(not(test), feature(copy_from_slice))] // impl [T]
3031
#![cfg_attr(not(stage0), deny(warnings))]
3132

3233
#![feature(alloc)]
3334
#![feature(allow_internal_unstable)]
3435
#![feature(box_patterns)]
3536
#![feature(box_syntax)]
3637
#![feature(core_intrinsics)]
38+
#![feature(decode_utf16)]
3739
#![feature(dropck_parametricity)]
3840
#![feature(fmt_internals)]
3941
#![feature(heap_api)]

branches/auto/src/libcollections/slice.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,13 +845,14 @@ impl<T> [T] {
845845
/// # Example
846846
///
847847
/// ```rust
848+
/// #![feature(copy_from_slice)]
848849
/// let mut dst = [0, 0, 0];
849850
/// let src = [1, 2, 3];
850851
///
851852
/// dst.copy_from_slice(&src);
852853
/// assert_eq!(src, dst);
853854
/// ```
854-
#[stable(feature = "copy_from_slice", since = "1.9.0")]
855+
#[unstable(feature = "copy_from_slice", issue = "31755")]
855856
pub fn copy_from_slice(&mut self, src: &[T]) where T: Copy {
856857
core_slice::SliceExt::copy_from_slice(self, src)
857858
}

branches/auto/src/libcollections/str.rs

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ impl str {
228228
/// # Examples
229229
///
230230
/// ```
231+
/// #![feature(str_char)]
232+
///
231233
/// let s = "Löwe 老虎 Léopard";
232234
/// assert!(s.is_char_boundary(0));
233235
/// // start of `老`
@@ -240,7 +242,12 @@ impl str {
240242
/// // third byte of `老`
241243
/// assert!(!s.is_char_boundary(8));
242244
/// ```
243-
#[stable(feature = "is_char_boundary", since = "1.9.0")]
245+
#[unstable(feature = "str_char",
246+
reason = "it is unclear whether this method pulls its weight \
247+
with the existence of the char_indices iterator or \
248+
this method may want to be replaced with checked \
249+
slicing",
250+
issue = "27754")]
244251
#[inline]
245252
pub fn is_char_boundary(&self, index: usize) -> bool {
246253
core_str::StrExt::is_char_boundary(self, index)
@@ -367,7 +374,6 @@ impl str {
367374
///
368375
/// ```
369376
/// #![feature(str_char)]
370-
/// #![allow(deprecated)]
371377
///
372378
/// use std::str::CharRange;
373379
///
@@ -402,9 +408,6 @@ impl str {
402408
removed altogether",
403409
issue = "27754")]
404410
#[inline]
405-
#[rustc_deprecated(reason = "use slicing plus chars() plus len_utf8",
406-
since = "1.9.0")]
407-
#[allow(deprecated)]
408411
pub fn char_range_at(&self, start: usize) -> CharRange {
409412
core_str::StrExt::char_range_at(self, start)
410413
}
@@ -429,7 +432,6 @@ impl str {
429432
///
430433
/// ```
431434
/// #![feature(str_char)]
432-
/// #![allow(deprecated)]
433435
///
434436
/// use std::str::CharRange;
435437
///
@@ -464,9 +466,6 @@ impl str {
464466
eventually removed altogether",
465467
issue = "27754")]
466468
#[inline]
467-
#[rustc_deprecated(reason = "use slicing plus chars().rev() plus len_utf8",
468-
since = "1.9.0")]
469-
#[allow(deprecated)]
470469
pub fn char_range_at_reverse(&self, start: usize) -> CharRange {
471470
core_str::StrExt::char_range_at_reverse(self, start)
472471
}
@@ -482,7 +481,6 @@ impl str {
482481
///
483482
/// ```
484483
/// #![feature(str_char)]
485-
/// #![allow(deprecated)]
486484
///
487485
/// let s = "abπc";
488486
/// assert_eq!(s.char_at(1), 'b');
@@ -497,9 +495,6 @@ impl str {
497495
subslice",
498496
issue = "27754")]
499497
#[inline]
500-
#[allow(deprecated)]
501-
#[rustc_deprecated(reason = "use slicing plus chars()",
502-
since = "1.9.0")]
503498
pub fn char_at(&self, i: usize) -> char {
504499
core_str::StrExt::char_at(self, i)
505500
}
@@ -516,7 +511,6 @@ impl str {
516511
///
517512
/// ```
518513
/// #![feature(str_char)]
519-
/// #![allow(deprecated)]
520514
///
521515
/// let s = "abπc";
522516
/// assert_eq!(s.char_at_reverse(1), 'a');
@@ -529,9 +523,6 @@ impl str {
529523
cases generate panics",
530524
issue = "27754")]
531525
#[inline]
532-
#[rustc_deprecated(reason = "use slicing plus chars().rev()",
533-
since = "1.9.0")]
534-
#[allow(deprecated)]
535526
pub fn char_at_reverse(&self, i: usize) -> char {
536527
core_str::StrExt::char_at_reverse(self, i)
537528
}
@@ -550,7 +541,6 @@ impl str {
550541
///
551542
/// ```
552543
/// #![feature(str_char)]
553-
/// #![allow(deprecated)]
554544
///
555545
/// let s = "Łódź"; // \u{141}o\u{301}dz\u{301}
556546
/// let (c, s1) = s.slice_shift_char().unwrap();
@@ -569,9 +559,6 @@ impl str {
569559
and/or char_indices iterators",
570560
issue = "27754")]
571561
#[inline]
572-
#[rustc_deprecated(reason = "use chars() plus Chars::as_str",
573-
since = "1.9.0")]
574-
#[allow(deprecated)]
575562
pub fn slice_shift_char(&self) -> Option<(char, &str)> {
576563
core_str::StrExt::slice_shift_char(self)
577564
}

branches/auto/src/libcollections/string.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,13 +1037,14 @@ impl String {
10371037
#[inline]
10381038
#[stable(feature = "rust1", since = "1.0.0")]
10391039
pub fn pop(&mut self) -> Option<char> {
1040-
let ch = match self.chars().rev().next() {
1041-
Some(ch) => ch,
1042-
None => return None,
1043-
};
1044-
let newlen = self.len() - ch.len_utf8();
1040+
let len = self.len();
1041+
if len == 0 {
1042+
return None;
1043+
}
1044+
1045+
let ch = self.char_at_reverse(len);
10451046
unsafe {
1046-
self.vec.set_len(newlen);
1047+
self.vec.set_len(len - ch.len_utf8());
10471048
}
10481049
Some(ch)
10491050
}
@@ -1074,13 +1075,11 @@ impl String {
10741075
#[inline]
10751076
#[stable(feature = "rust1", since = "1.0.0")]
10761077
pub fn remove(&mut self, idx: usize) -> char {
1077-
let ch = match self[idx..].chars().next() {
1078-
Some(ch) => ch,
1079-
None => panic!("cannot remove a char from the end of a string"),
1080-
};
1078+
let len = self.len();
1079+
assert!(idx < len);
10811080

1081+
let ch = self.char_at(idx);
10821082
let next = idx + ch.len_utf8();
1083-
let len = self.len();
10841083
unsafe {
10851084
ptr::copy(self.vec.as_ptr().offset(next as isize),
10861085
self.vec.as_mut_ptr().offset(idx as isize),

branches/auto/src/libcollectionstest/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@
1010

1111
#![deny(warnings)]
1212

13+
#![feature(ascii)]
1314
#![feature(binary_heap_extras)]
1415
#![feature(box_syntax)]
1516
#![feature(btree_range)]
1617
#![feature(collections)]
1718
#![feature(collections_bound)]
19+
#![feature(copy_from_slice)]
1820
#![feature(const_fn)]
1921
#![feature(fn_traits)]
2022
#![feature(enumset)]
@@ -23,6 +25,7 @@
2325
#![feature(map_values_mut)]
2426
#![feature(pattern)]
2527
#![feature(rand)]
28+
#![feature(set_recovery)]
2629
#![feature(step_by)]
2730
#![feature(str_char)]
2831
#![feature(str_escape)]

branches/auto/src/libcollectionstest/str.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -464,14 +464,12 @@ fn test_is_whitespace() {
464464
}
465465

466466
#[test]
467-
#[allow(deprecated)]
468467
fn test_slice_shift_char() {
469468
let data = "ประเทศไทย中";
470469
assert_eq!(data.slice_shift_char(), Some(('ป', "ระเทศไทย中")));
471470
}
472471

473472
#[test]
474-
#[allow(deprecated)]
475473
fn test_slice_shift_char_2() {
476474
let empty = "";
477475
assert_eq!(empty.slice_shift_char(), None);
@@ -659,7 +657,6 @@ fn test_contains_char() {
659657
}
660658

661659
#[test]
662-
#[allow(deprecated)]
663660
fn test_char_at() {
664661
let s = "ศไทย中华Việt Nam";
665662
let v = vec!['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a','m'];
@@ -671,7 +668,6 @@ fn test_char_at() {
671668
}
672669

673670
#[test]
674-
#[allow(deprecated)]
675671
fn test_char_at_reverse() {
676672
let s = "ศไทย中华Việt Nam";
677673
let v = vec!['ศ','ไ','ท','ย','中','华','V','i','ệ','t',' ','N','a','m'];
@@ -749,7 +745,6 @@ fn test_total_ord() {
749745
}
750746

751747
#[test]
752-
#[allow(deprecated)]
753748
fn test_char_range_at() {
754749
let data = "b¢€𤭢𤭢€¢b";
755750
assert_eq!('b', data.char_range_at(0).ch);
@@ -763,7 +758,6 @@ fn test_char_range_at() {
763758
}
764759

765760
#[test]
766-
#[allow(deprecated)]
767761
fn test_char_range_at_reverse_underflow() {
768762
assert_eq!("abc".char_range_at_reverse(0).next, 0);
769763
}

0 commit comments

Comments
 (0)