Skip to content

Commit 4d9b4a6

Browse files
committed
---
yaml --- r: 160895 b: refs/heads/auto c: 97495da h: refs/heads/master i: 160893: 0515a0a 160891: 91450d5 160887: 49ef35d 160879: d4d0a26 160863: 5e7205f 160831: 2c10440 160767: 3bba453 v: v3
1 parent 49f62ab commit 4d9b4a6

Some content is hidden

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

77 files changed

+615
-194
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: ce238d752b1e04d4aea21c0fadf420a270ed6ff9
13+
refs/heads/auto: 97495da163c017da34ce2bc8ba31388524216ba1
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/Makefile.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,8 @@ include $(CFG_SRC_DIR)mk/rustllvm.mk
198198
include $(CFG_SRC_DIR)mk/docs.mk
199199
# LLVM
200200
include $(CFG_SRC_DIR)mk/llvm.mk
201+
# Rules for installing debugger scripts
202+
include $(CFG_SRC_DIR)mk/debuggers.mk
201203

202204
######################################################################
203205
# Secondary makefiles, conditionalized for speed

branches/auto/mk/clean.mk

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ clean-generic-$(2)-$(1):
6363
-name '*.lib' -o \
6464
-name '*.dll' -o \
6565
-name '*.def' -o \
66+
-name '*.py' -o \
6667
-name '*.bc' \
6768
\) \
6869
| xargs rm -f
@@ -78,7 +79,7 @@ define CLEAN_HOST_STAGE_N
7879

7980
clean$(1)_H_$(2): \
8081
$$(foreach crate,$$(CRATES),clean$(1)_H_$(2)-lib-$$(crate)) \
81-
$$(foreach tool,$$(TOOLS),clean$(1)_H_$(2)-tool-$$(tool))
82+
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS),clean$(1)_H_$(2)-tool-$$(tool))
8283
$$(Q)rm -fr $(2)/rt/libbacktrace
8384

8485
clean$(1)_H_$(2)-tool-%:
@@ -98,7 +99,7 @@ define CLEAN_TARGET_STAGE_N
9899

99100
clean$(1)_T_$(2)_H_$(3): \
100101
$$(foreach crate,$$(CRATES),clean$(1)_T_$(2)_H_$(3)-lib-$$(crate)) \
101-
$$(foreach tool,$$(TOOLS),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
102+
$$(foreach tool,$$(TOOLS) $$(DEBUGGER_BIN_SCRIPTS),clean$(1)_T_$(2)_H_$(3)-tool-$$(tool))
102103
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libmorestack.a
103104
$$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/libcompiler-rt.a
104105
$(Q)rm -f $$(TLIB$(1)_T_$(2)_H_$(3))/librun_pass_stage* # For unix

branches/auto/mk/debuggers.mk

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
# file at the top-level directory of this distribution and at
3+
# http://rust-lang.org/COPYRIGHT.
4+
#
5+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
# option. This file may not be copied, modified, or distributed
9+
# except according to those terms.
10+
11+
######################################################################
12+
# Copy debugger related scripts
13+
######################################################################
14+
15+
DEBUGGER_RUSTLIB_ETC_SCRIPTS=lldb_rust_formatters.py
16+
DEBUGGER_BIN_SCRIPTS=rust-lldb
17+
18+
DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_RUSTLIB_ETC_SCRIPTS), \
19+
$(CFG_SRC_DIR)src/etc/$(script))
20+
DEBUGGER_BIN_SCRIPTS_ABS=$(foreach script,$(DEBUGGER_BIN_SCRIPTS), \
21+
$(CFG_SRC_DIR)src/etc/$(script))
22+
23+
DEBUGGER_SCRIPTS_ALL=$(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $(DEBUGGER_BIN_SCRIPTS_ABS)
24+
25+
# $(1) - the stage to copy to
26+
# $(2) - the host triple
27+
define DEF_INSTALL_DEBUGGER_SCRIPTS_HOST
28+
29+
tmp/install-debugger-scripts$(1)_H_$(2).done: $$(DEBUGGER_SCRIPTS_ALL)
30+
$(Q)mkdir -p $$(HBIN$(1)_H_$(2))
31+
$(Q)mkdir -p $$(HLIB$(1)_H_$(2))/rustlib/etc
32+
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ABS) $$(HBIN$(1)_H_$(2))
33+
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(HLIB$(1)_H_$(2))/rustlib/etc
34+
$(Q)touch $$@
35+
endef
36+
37+
# Expand host make-targets for all stages
38+
$(foreach stage,$(STAGES), \
39+
$(foreach host,$(CFG_HOST), \
40+
$(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_HOST,$(stage),$(host)))))
41+
42+
# $(1) is the stage number
43+
# $(2) is the target triple
44+
# $(3) is the host triple
45+
define DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET
46+
47+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3).done: $$(DEBUGGER_SCRIPTS_ALL)
48+
$(Q)mkdir -p $$(TBIN$(1)_T_$(2)_H_$(3))
49+
$(Q)mkdir -p $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
50+
$(Q)install $(DEBUGGER_BIN_SCRIPTS_ABS) $$(TBIN$(1)_T_$(2)_H_$(3))
51+
$(Q)install $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(TLIB$(1)_T_$(2)_H_$(3))/rustlib/etc
52+
$(Q)touch $$@
53+
endef
54+
55+
# Expand target make-targets for all stages
56+
$(foreach stage,$(STAGES), \
57+
$(foreach target,$(CFG_TARGET), \
58+
$(foreach host,$(CFG_HOST), \
59+
$(eval $(call DEF_INSTALL_DEBUGGER_SCRIPTS_TARGET,$(stage),$(target),$(host))))))

branches/auto/mk/main.mk

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ HSREQ$(1)_H_$(3) = $$(HBIN$(1)_H_$(3))/rustc$$(X_$(3))
356356
else
357357
HSREQ$(1)_H_$(3) = \
358358
$$(HBIN$(1)_H_$(3))/rustc$$(X_$(3)) \
359-
$$(MKFILE_DEPS)
359+
$$(MKFILE_DEPS) \
360+
tmp/install-debugger-scripts$(1)_H_$(3).done
360361
endif
361362

362363
# Prerequisites for using the stageN compiler to build target artifacts
@@ -370,7 +371,8 @@ TSREQ$(1)_T_$(2)_H_$(3) = \
370371
SREQ$(1)_T_$(2)_H_$(3) = \
371372
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
372373
$$(foreach dep,$$(TARGET_CRATES), \
373-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep))
374+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(dep)) \
375+
tmp/install-debugger-scripts$(1)_T_$(2)_H_$(3).done
374376

375377
# Prerequisites for a working stageN compiler and complete set of target
376378
# libraries

branches/auto/mk/prepare.mk

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ prepare-base-$(1): PREPARE_DEST_LIB_DIR=$$(PREPARE_DEST_DIR)/$$(CFG_LIBDIR_RELAT
155155
prepare-base-$(1): PREPARE_DEST_MAN_DIR=$$(PREPARE_DEST_DIR)/share/man/man1
156156
prepare-base-$(1): prepare-everything-$(1)
157157

158-
prepare-everything-$(1): prepare-host-$(1) prepare-targets-$(1)
158+
prepare-everything-$(1): prepare-host-$(1) prepare-targets-$(1) prepare-debugger-scripts-$(1)
159159

160160
prepare-host-$(1): prepare-host-tools-$(1)
161161

@@ -167,8 +167,13 @@ prepare-host-tools-$(1): \
167167
prepare-host-dirs-$(1): prepare-maybe-clean-$(1)
168168
$$(call PREPARE_DIR,$$(PREPARE_DEST_BIN_DIR))
169169
$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR))
170+
$$(call PREPARE_DIR,$$(PREPARE_DEST_LIB_DIR)/rustlib/etc)
170171
$$(call PREPARE_DIR,$$(PREPARE_DEST_MAN_DIR))
171172

173+
prepare-debugger-scripts-$(1): prepare-host-dirs-$(1) $(DEBUGGER_SCRIPTS_ALL)
174+
$$(Q)$$(PREPARE_BIN_CMD) $(DEBUGGER_BIN_SCRIPTS_ABS) $$(PREPARE_DEST_BIN_DIR)
175+
$$(Q)$$(PREPARE_LIB_CMD) $(DEBUGGER_RUSTLIB_ETC_SCRIPTS_ABS) $$(PREPARE_DEST_LIB_DIR)/rustlib/etc
176+
172177
$$(foreach tool,$$(PREPARE_TOOLS), \
173178
$$(foreach host,$$(CFG_HOST), \
174179
$$(eval $$(call DEF_PREPARE_HOST_TOOL,$$(tool),$$(PREPARE_STAGE),$$(host),$(1)))))

branches/auto/src/etc/lldb_rust_formatters.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,14 @@ def print_struct_val_starting_from(field_start_index, val, internal_dict):
6969
assert val.GetType().GetTypeClass() == lldb.eTypeClassStruct
7070

7171
t = val.GetType()
72-
has_field_names = type_has_field_names(t)
7372
type_name = extract_type_name(t.GetName())
73+
num_children = val.num_children
74+
75+
if (num_children - field_start_index) == 0:
76+
# The only field of this struct is the enum discriminant
77+
return type_name
78+
79+
has_field_names = type_has_field_names(t)
7480

7581
if has_field_names:
7682
template = "%(type_name)s {\n%(body)s\n}"
@@ -83,8 +89,6 @@ def print_struct_val_starting_from(field_start_index, val, internal_dict):
8389
# this is a tuple, so don't print the type name
8490
type_name = ""
8591

86-
num_children = val.num_children
87-
8892
def render_child(child_index):
8993
this = ""
9094
if has_field_names:
@@ -105,7 +109,6 @@ def print_enum_val(val, internal_dict):
105109

106110
assert val.GetType().GetTypeClass() == lldb.eTypeClassUnion
107111

108-
109112
if val.num_children == 1:
110113
# This is either an enum with just one variant, or it is an Option-like enum
111114
# where the discriminant is encoded in a non-nullable pointer field. We find

branches/auto/src/etc/rust-lldb

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/sh
2+
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
# Exit if anything fails
13+
set -e
14+
15+
# Create a tempfile containing the LLDB script we want to execute on startup
16+
TMPFILE=`mktemp /tmp/rust-lldb-commands.XXXXXX`
17+
18+
# Make sure to delete the tempfile no matter what
19+
trap "rm -f $TMPFILE; exit" INT TERM EXIT
20+
21+
# Find out where to look for the pretty printer Python module
22+
RUSTC_SYSROOT=`rustc -Zprint-sysroot`
23+
24+
# Write the LLDB script to the tempfile
25+
echo "command script import \"$RUSTC_SYSROOT/lib/rustlib/etc/lldb_rust_formatters.py\"" >> $TMPFILE
26+
echo "type summary add --no-value --python-function lldb_rust_formatters.print_val -x \".*\" --category Rust" >> $TMPFILE
27+
echo "type category enable Rust" >> $TMPFILE
28+
29+
# Call LLDB with the script added to the argument list
30+
lldb --source-before-file="$TMPFILE" "$@"

branches/auto/src/libcollections/binary_heap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,10 +585,10 @@ impl<T> DoubleEndedIterator<T> for MoveItems<T> {
585585
fn next_back(&mut self) -> Option<T> { self.iter.next_back() }
586586
}
587587

588-
impl<T> ExactSize<T> for MoveItems<T> {}
588+
impl<T> ExactSizeIterator<T> for MoveItems<T> {}
589589

590590
impl<T: Ord> FromIterator<T> for BinaryHeap<T> {
591-
fn from_iter<Iter: Iterator<T>>(mut iter: Iter) -> BinaryHeap<T> {
591+
fn from_iter<Iter: Iterator<T>>(iter: Iter) -> BinaryHeap<T> {
592592
let vec: Vec<T> = iter.collect();
593593
BinaryHeap::from_vec(vec)
594594
}

branches/auto/src/libcollections/bit.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ use core::prelude::*;
6868
use core::cmp;
6969
use core::default::Default;
7070
use core::fmt;
71-
use core::iter::{Chain, Enumerate, Repeat, Skip, Take};
71+
use core::iter::{Chain, Enumerate, Repeat, Skip, Take, repeat};
7272
use core::iter;
7373
use core::num::Int;
7474
use core::slice;
@@ -88,11 +88,11 @@ fn match_words <'a,'b>(a: &'a Bitv, b: &'b Bitv) -> (MatchWords<'a>, MatchWords<
8888

8989
// have to uselessly pretend to pad the longer one for type matching
9090
if a_len < b_len {
91-
(a.mask_words(0).chain(Repeat::new(0u32).enumerate().take(b_len).skip(a_len)),
92-
b.mask_words(0).chain(Repeat::new(0u32).enumerate().take(0).skip(0)))
91+
(a.mask_words(0).chain(repeat(0u32).enumerate().take(b_len).skip(a_len)),
92+
b.mask_words(0).chain(repeat(0u32).enumerate().take(0).skip(0)))
9393
} else {
94-
(a.mask_words(0).chain(Repeat::new(0u32).enumerate().take(0).skip(0)),
95-
b.mask_words(0).chain(Repeat::new(0u32).enumerate().take(a_len).skip(b_len)))
94+
(a.mask_words(0).chain(repeat(0u32).enumerate().take(0).skip(0)),
95+
b.mask_words(0).chain(repeat(0u32).enumerate().take(a_len).skip(b_len)))
9696
}
9797
}
9898

@@ -943,7 +943,7 @@ impl<'a> DoubleEndedIterator<bool> for Bits<'a> {
943943
}
944944
}
945945

946-
impl<'a> ExactSize<bool> for Bits<'a> {}
946+
impl<'a> ExactSizeIterator<bool> for Bits<'a> {}
947947

948948
impl<'a> RandomAccessIterator<bool> for Bits<'a> {
949949
#[inline]

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ impl<K, V, E, T: Traverse<E> + DoubleEndedIterator<TraversalItem<K, V, E>>>
863863
// Note that the design of these iterators permits an *arbitrary* initial pair of min and max,
864864
// making these arbitrary sub-range iterators. However the logic to construct these paths
865865
// efficiently is fairly involved, so this is a FIXME. The sub-range iterators also wouldn't be
866-
// able to accurately predict size, so those iterators can't implement ExactSize.
866+
// able to accurately predict size, so those iterators can't implement ExactSizeIterator.
867867
fn next(&mut self) -> Option<(K, V)> {
868868
loop {
869869
// We want the smallest element, so try to get the top of the left stack
@@ -963,7 +963,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
963963
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a V)> for Entries<'a, K, V> {
964964
fn next_back(&mut self) -> Option<(&'a K, &'a V)> { self.inner.next_back() }
965965
}
966-
impl<'a, K, V> ExactSize<(&'a K, &'a V)> for Entries<'a, K, V> {}
966+
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a V)> for Entries<'a, K, V> {}
967967

968968

969969
impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
@@ -973,7 +973,7 @@ impl<'a, K, V> Iterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
973973
impl<'a, K, V> DoubleEndedIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {
974974
fn next_back(&mut self) -> Option<(&'a K, &'a mut V)> { self.inner.next_back() }
975975
}
976-
impl<'a, K, V> ExactSize<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {}
976+
impl<'a, K, V> ExactSizeIterator<(&'a K, &'a mut V)> for MutEntries<'a, K, V> {}
977977

978978

979979
impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
@@ -983,7 +983,7 @@ impl<K, V> Iterator<(K, V)> for MoveEntries<K, V> {
983983
impl<K, V> DoubleEndedIterator<(K, V)> for MoveEntries<K, V> {
984984
fn next_back(&mut self) -> Option<(K, V)> { self.inner.next_back() }
985985
}
986-
impl<K, V> ExactSize<(K, V)> for MoveEntries<K, V> {}
986+
impl<K, V> ExactSizeIterator<(K, V)> for MoveEntries<K, V> {}
987987

988988

989989

branches/auto/src/libcollections/dlist.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ impl<'a, A> DoubleEndedIterator<&'a A> for Items<'a, A> {
607607
}
608608
}
609609

610-
impl<'a, A> ExactSize<&'a A> for Items<'a, A> {}
610+
impl<'a, A> ExactSizeIterator<&'a A> for Items<'a, A> {}
611611

612612
impl<'a, A> Iterator<&'a mut A> for MutItems<'a, A> {
613613
#[inline]
@@ -645,7 +645,7 @@ impl<'a, A> DoubleEndedIterator<&'a mut A> for MutItems<'a, A> {
645645
}
646646
}
647647

648-
impl<'a, A> ExactSize<&'a mut A> for MutItems<'a, A> {}
648+
impl<'a, A> ExactSizeIterator<&'a mut A> for MutItems<'a, A> {}
649649

650650
/// Allows mutating a `DList` while iterating.
651651
pub trait ListInsertion<A> {

branches/auto/src/libcollections/ring_buf.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,7 @@ impl<'a, T> DoubleEndedIterator<&'a T> for Items<'a, T> {
695695
}
696696
}
697697

698-
699-
impl<'a, T> ExactSize<&'a T> for Items<'a, T> {}
698+
impl<'a, T> ExactSizeIterator<&'a T> for Items<'a, T> {}
700699

701700
impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
702701
#[inline]
@@ -763,7 +762,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut T> for MutItems<'a, T> {
763762
}
764763
}
765764

766-
impl<'a, T> ExactSize<&'a mut T> for MutItems<'a, T> {}
765+
impl<'a, T> ExactSizeIterator<&'a mut T> for MutItems<'a, T> {}
767766

768767
impl<A: PartialEq> PartialEq for RingBuf<A> {
769768
fn eq(&self, other: &RingBuf<A>) -> bool {
@@ -1322,7 +1321,7 @@ mod tests {
13221321
let u: Vec<int> = deq.iter().map(|&x| x).collect();
13231322
assert_eq!(u, v);
13241323

1325-
let mut seq = iter::count(0u, 2).take(256);
1324+
let seq = iter::count(0u, 2).take(256);
13261325
let deq: RingBuf<uint> = seq.collect();
13271326
for (i, &x) in deq.iter().enumerate() {
13281327
assert_eq!(2*i, x);

branches/auto/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ use core::cmp;
9494
use core::kinds::Sized;
9595
use core::mem::size_of;
9696
use core::mem;
97-
use core::prelude::{Clone, Greater, Iterator, Less, None, Option};
97+
use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option};
9898
use core::prelude::{Ord, Ordering, RawPtr, Some, range};
9999
use core::ptr;
100100
use core::iter::{range_step, MultiplicativeIterator};

branches/auto/src/libcollections/str.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ use core::cmp;
6161
use core::iter::AdditiveIterator;
6262
use core::kinds::Sized;
6363
use core::prelude::{Char, Clone, Eq, Equiv};
64-
use core::prelude::{Iterator, SlicePrelude, None, Option, Ord, Ordering};
64+
use core::prelude::{Iterator, IteratorExt, SlicePrelude, None, Option, Ord, Ordering};
6565
use core::prelude::{PartialEq, PartialOrd, Result, AsSlice, Some, Tuple2};
6666
use core::prelude::{range};
6767

@@ -828,7 +828,7 @@ mod tests {
828828
use std::cmp::{Equal, Greater, Less, Ord, PartialOrd, Equiv};
829829
use std::option::{Some, None};
830830
use std::ptr::RawPtr;
831-
use std::iter::{Iterator, DoubleEndedIterator};
831+
use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt};
832832

833833
use super::*;
834834
use std::slice::{AsSlice, SlicePrelude};
@@ -2177,12 +2177,15 @@ mod tests {
21772177
let gr_inds = s.grapheme_indices(true).rev().collect::<Vec<(uint, &str)>>();
21782178
let b: &[_] = &[(11, "\r\n"), (6, "ö̲"), (3, "é"), (0u, "a̐")];
21792179
assert_eq!(gr_inds.as_slice(), b);
2180-
let mut gr_inds = s.grapheme_indices(true);
2181-
let e1 = gr_inds.size_hint();
2182-
assert_eq!(e1, (1, Some(13)));
2183-
let c = gr_inds.count();
2184-
assert_eq!(c, 4);
2185-
let e2 = gr_inds.size_hint();
2180+
let mut gr_inds_iter = s.grapheme_indices(true);
2181+
{
2182+
let gr_inds = gr_inds_iter.by_ref();
2183+
let e1 = gr_inds.size_hint();
2184+
assert_eq!(e1, (1, Some(13)));
2185+
let c = gr_inds.count();
2186+
assert_eq!(c, 4);
2187+
}
2188+
let e2 = gr_inds_iter.size_hint();
21862189
assert_eq!(e2, (0, Some(0)));
21872190

21882191
// make sure the reverse iterator does the right thing with "\n" at beginning of string
@@ -2319,7 +2322,7 @@ mod bench {
23192322
use test::Bencher;
23202323
use test::black_box;
23212324
use super::*;
2322-
use std::iter::{Iterator, DoubleEndedIterator};
2325+
use std::iter::{IteratorExt, DoubleEndedIteratorExt};
23232326
use std::str::StrPrelude;
23242327
use std::slice::SlicePrelude;
23252328

0 commit comments

Comments
 (0)