@@ -681,8 +681,8 @@ impl<'de> Visitor<'de> for CStringVisitor {
681681 where
682682 A : SeqAccess < ' de > ,
683683 {
684- let len = size_hint:: cautious ( seq. size_hint ( ) ) ;
685- let mut values = Vec :: with_capacity ( len ) ;
684+ let capacity = size_hint:: cautious :: < u8 > ( seq. size_hint ( ) ) ;
685+ let mut values = Vec :: < u8 > :: with_capacity ( capacity ) ;
686686
687687 while let Some ( value) = try!( seq. next_element ( ) ) {
688688 values. push ( value) ;
@@ -936,7 +936,7 @@ macro_rules! seq_impl {
936936 A : SeqAccess <' de>,
937937 {
938938 $clear( & mut self . 0 ) ;
939- $reserve( & mut self . 0 , size_hint:: cautious( $access. size_hint( ) ) ) ;
939+ $reserve( & mut self . 0 , size_hint:: cautious:: < T > ( $access. size_hint( ) ) ) ;
940940
941941 // FIXME: try to overwrite old values here? (Vec, VecDeque, LinkedList)
942942 while let Some ( value) = try!( $access. next_element( ) ) {
@@ -962,7 +962,7 @@ seq_impl!(
962962 BinaryHeap <T : Ord >,
963963 seq,
964964 BinaryHeap :: clear,
965- BinaryHeap :: with_capacity( size_hint:: cautious( seq. size_hint( ) ) ) ,
965+ BinaryHeap :: with_capacity( size_hint:: cautious:: < T > ( seq. size_hint( ) ) ) ,
966966 BinaryHeap :: reserve,
967967 BinaryHeap :: push
968968) ;
@@ -992,7 +992,7 @@ seq_impl!(
992992 HashSet <T : Eq + Hash , S : BuildHasher + Default >,
993993 seq,
994994 HashSet :: clear,
995- HashSet :: with_capacity_and_hasher( size_hint:: cautious( seq. size_hint( ) ) , S :: default ( ) ) ,
995+ HashSet :: with_capacity_and_hasher( size_hint:: cautious:: < T > ( seq. size_hint( ) ) , S :: default ( ) ) ,
996996 HashSet :: reserve,
997997 HashSet :: insert
998998) ;
@@ -1002,7 +1002,7 @@ seq_impl!(
10021002 VecDeque <T >,
10031003 seq,
10041004 VecDeque :: clear,
1005- VecDeque :: with_capacity( size_hint:: cautious( seq. size_hint( ) ) ) ,
1005+ VecDeque :: with_capacity( size_hint:: cautious:: < T > ( seq. size_hint( ) ) ) ,
10061006 VecDeque :: reserve,
10071007 VecDeque :: push_back
10081008) ;
@@ -1036,7 +1036,8 @@ where
10361036 where
10371037 A : SeqAccess < ' de > ,
10381038 {
1039- let mut values = Vec :: with_capacity ( size_hint:: cautious ( seq. size_hint ( ) ) ) ;
1039+ let capacity = size_hint:: cautious :: < T > ( seq. size_hint ( ) ) ;
1040+ let mut values = Vec :: < T > :: with_capacity ( capacity) ;
10401041
10411042 while let Some ( value) = try!( seq. next_element ( ) ) {
10421043 values. push ( value) ;
@@ -1072,7 +1073,7 @@ where
10721073 where
10731074 A : SeqAccess < ' de > ,
10741075 {
1075- let hint = size_hint:: cautious ( seq. size_hint ( ) ) ;
1076+ let hint = size_hint:: cautious :: < T > ( seq. size_hint ( ) ) ;
10761077 if let Some ( additional) = hint. checked_sub ( self . 0 . len ( ) ) {
10771078 self . 0 . reserve ( additional) ;
10781079 }
@@ -1416,7 +1417,7 @@ map_impl!(BTreeMap<K: Ord, V>, map, BTreeMap::new());
14161417map_impl ! (
14171418 HashMap <K : Eq + Hash , V , S : BuildHasher + Default >,
14181419 map,
1419- HashMap :: with_capacity_and_hasher( size_hint:: cautious( map. size_hint( ) ) , S :: default ( ) )
1420+ HashMap :: with_capacity_and_hasher( size_hint:: cautious:: < ( K , V ) > ( map. size_hint( ) ) , S :: default ( ) )
14201421) ;
14211422
14221423////////////////////////////////////////////////////////////////////////////////
0 commit comments