Skip to content

Commit 0043135

Browse files
committed
---
yaml --- r: 178815 b: refs/heads/tmp c: d30f225 h: refs/heads/master i: 178813: 4397a19 178811: 099d03a 178807: 1f47072 178799: d0b67ef 178783: dfc878b 178751: 29eb3d2 178687: 17ab0db v: v3
1 parent d0b3956 commit 0043135

File tree

90 files changed

+352
-5787
lines changed

Some content is hidden

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

90 files changed

+352
-5787
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
3434
refs/heads/beta: 44a287e6eb22ec3c2a687fc156813577464017f7
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
37-
refs/heads/tmp: 74f7e0693909a45f9159c6d2ef72b42fcb4f1bac
37+
refs/heads/tmp: d30f225b492163b14005d5069b7924f3fecf868c

branches/tmp/src/liballoc/boxed.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,18 @@
4545
4646
#![stable(feature = "rust1", since = "1.0.0")]
4747

48+
use core::prelude::*;
49+
4850
use core::any::Any;
49-
use core::clone::Clone;
50-
use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
51+
use core::cmp::Ordering;
5152
use core::default::Default;
5253
use core::error::{Error, FromError};
5354
use core::fmt;
5455
use core::hash::{self, Hash};
55-
use core::iter::Iterator;
56-
use core::marker::Sized;
5756
use core::mem;
5857
use core::ops::{Deref, DerefMut};
59-
use core::option::Option;
6058
use core::ptr::Unique;
6159
use core::raw::TraitObject;
62-
use core::result::Result::{Ok, Err};
63-
use core::result::Result;
6460

6561
/// A value that represents the heap. This is the default place that the `box` keyword allocates
6662
/// into when no place is supplied.
@@ -296,18 +292,20 @@ impl<T: ?Sized> DerefMut for Box<T> {
296292
fn deref_mut(&mut self) -> &mut T { &mut **self }
297293
}
298294

299-
impl<'a, T> Iterator for Box<Iterator<Item=T> + 'a> {
300-
type Item = T;
301-
302-
fn next(&mut self) -> Option<T> {
303-
(**self).next()
304-
}
305-
306-
fn size_hint(&self) -> (usize, Option<usize>) {
307-
(**self).size_hint()
308-
}
295+
#[stable(feature = "rust1", since = "1.0.0")]
296+
impl<I: Iterator + ?Sized> Iterator for Box<I> {
297+
type Item = I::Item;
298+
fn next(&mut self) -> Option<I::Item> { (**self).next() }
299+
fn size_hint(&self) -> (usize, Option<usize>) { (**self).size_hint() }
300+
}
301+
#[stable(feature = "rust1", since = "1.0.0")]
302+
impl<I: DoubleEndedIterator + ?Sized> DoubleEndedIterator for Box<I> {
303+
fn next_back(&mut self) -> Option<I::Item> { (**self).next_back() }
309304
}
305+
#[stable(feature = "rust1", since = "1.0.0")]
306+
impl<I: ExactSizeIterator + ?Sized> ExactSizeIterator for Box<I> {}
310307

308+
#[stable(feature = "rust1", since = "1.0.0")]
311309
impl<'a, E: Error + 'a> FromError<E> for Box<Error + 'a> {
312310
fn from_error(err: E) -> Box<Error + 'a> {
313311
Box::new(err)

branches/tmp/src/libcollections/vec_map.rs

Lines changed: 1 addition & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
1414
#![allow(missing_docs)]
1515

16-
pub use self::Entry::*;
17-
1816
use core::prelude::*;
1917

2018
use core::cmp::Ordering;
@@ -68,32 +66,6 @@ pub struct VecMap<V> {
6866
v: Vec<Option<V>>,
6967
}
7068

71-
/// A view into a single entry in a map, which may either be vacant or occupied.
72-
#[unstable(feature = "collections",
73-
reason = "precise API still under development")]
74-
pub enum Entry<'a, V:'a> {
75-
/// A vacant Entry
76-
Vacant(VacantEntry<'a, V>),
77-
/// An occupied Entry
78-
Occupied(OccupiedEntry<'a, V>),
79-
}
80-
81-
/// A vacant Entry.
82-
#[unstable(feature = "collections",
83-
reason = "precise API still under development")]
84-
pub struct VacantEntry<'a, V:'a> {
85-
map: &'a mut VecMap<V>,
86-
index: usize,
87-
}
88-
89-
/// An occupied Entry.
90-
#[unstable(feature = "collections",
91-
reason = "precise API still under development")]
92-
pub struct OccupiedEntry<'a, V:'a> {
93-
map: &'a mut VecMap<V>,
94-
index: usize,
95-
}
96-
9769
#[stable(feature = "rust1", since = "1.0.0")]
9870
impl<V> Default for VecMap<V> {
9971
#[stable(feature = "rust1", since = "1.0.0")]
@@ -513,119 +485,6 @@ impl<V> VecMap<V> {
513485
let result = &mut self.v[*key];
514486
result.take()
515487
}
516-
517-
/// Gets the given key's corresponding entry in the map for in-place manipulation.
518-
///
519-
/// # Examples
520-
///
521-
/// ```
522-
/// use std::collections::VecMap;
523-
/// use std::collections::vec_map::Entry;
524-
///
525-
/// let mut count: VecMap<u32> = VecMap::new();
526-
///
527-
/// // count the number of occurrences of numbers in the vec
528-
/// for x in vec![1, 2, 1, 2, 3, 4, 1, 2, 4].iter() {
529-
/// match count.entry(*x) {
530-
/// Entry::Vacant(view) => {
531-
/// view.insert(1);
532-
/// },
533-
/// Entry::Occupied(mut view) => {
534-
/// let v = view.get_mut();
535-
/// *v += 1;
536-
/// },
537-
/// }
538-
/// }
539-
///
540-
/// assert_eq!(count[1], 3);
541-
/// ```
542-
#[unstable(feature = "collections",
543-
reason = "precise API still under development")]
544-
pub fn entry(&mut self, key: usize) -> Entry<V> {
545-
// FIXME(Gankro): this is basically the dumbest implementation of
546-
// entry possible, because weird non-lexical borrows issues make it
547-
// completely insane to do any other way. That said, Entry is a border-line
548-
// useless construct on VecMap, so it's hardly a big loss.
549-
if self.contains_key(&key) {
550-
Occupied(OccupiedEntry {
551-
map: self,
552-
index: key,
553-
})
554-
} else {
555-
Vacant(VacantEntry {
556-
map: self,
557-
index: key,
558-
})
559-
}
560-
}
561-
}
562-
563-
564-
impl<'a, V> Entry<'a, V> {
565-
#[unstable(feature = "collections",
566-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
567-
/// Returns a mutable reference to the entry if occupied, or the VacantEntry if vacant
568-
pub fn get(self) -> Result<&'a mut V, VacantEntry<'a, V>> {
569-
match self {
570-
Occupied(entry) => Ok(entry.into_mut()),
571-
Vacant(entry) => Err(entry),
572-
}
573-
}
574-
}
575-
576-
impl<'a, V> VacantEntry<'a, V> {
577-
/// Sets the value of the entry with the VacantEntry's key,
578-
/// and returns a mutable reference to it.
579-
#[unstable(feature = "collections",
580-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
581-
pub fn insert(self, value: V) -> &'a mut V {
582-
let index = self.index;
583-
self.map.insert(index, value);
584-
&mut self.map[index]
585-
}
586-
}
587-
588-
impl<'a, V> OccupiedEntry<'a, V> {
589-
/// Gets a reference to the value in the entry.
590-
#[unstable(feature = "collections",
591-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
592-
pub fn get(&self) -> &V {
593-
let index = self.index;
594-
&self.map[index]
595-
}
596-
597-
/// Gets a mutable reference to the value in the entry.
598-
#[unstable(feature = "collections",
599-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
600-
pub fn get_mut(&mut self) -> &mut V {
601-
let index = self.index;
602-
&mut self.map[index]
603-
}
604-
605-
/// Converts the entry into a mutable reference to its value.
606-
#[unstable(feature = "collections",
607-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
608-
pub fn into_mut(self) -> &'a mut V {
609-
let index = self.index;
610-
&mut self.map[index]
611-
}
612-
613-
/// Sets the value of the entry with the OccupiedEntry's key,
614-
/// and returns the entry's old value.
615-
#[unstable(feature = "collections",
616-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
617-
pub fn insert(&mut self, value: V) -> V {
618-
let index = self.index;
619-
self.map.insert(index, value).unwrap()
620-
}
621-
622-
/// Takes the value of the entry out of the map, and returns it.
623-
#[unstable(feature = "collections",
624-
reason = "matches collection reform v2 specification, waiting for dust to settle")]
625-
pub fn remove(self) -> V {
626-
let index = self.index;
627-
self.map.remove(&index).unwrap()
628-
}
629488
}
630489

631490
#[stable(feature = "rust1", since = "1.0.0")]
@@ -924,7 +783,7 @@ mod test_map {
924783
use prelude::*;
925784
use core::hash::{hash, SipHasher};
926785

927-
use super::{VecMap, Occupied, Vacant};
786+
use super::VecMap;
928787

929788
#[test]
930789
fn test_get_mut() {
@@ -1276,57 +1135,6 @@ mod test_map {
12761135

12771136
map[4];
12781137
}
1279-
1280-
#[test]
1281-
fn test_entry(){
1282-
let xs = [(1, 10), (2, 20), (3, 30), (4, 40), (5, 50), (6, 60)];
1283-
1284-
let mut map: VecMap<i32> = xs.iter().map(|&x| x).collect();
1285-
1286-
// Existing key (insert)
1287-
match map.entry(1) {
1288-
Vacant(_) => unreachable!(),
1289-
Occupied(mut view) => {
1290-
assert_eq!(view.get(), &10);
1291-
assert_eq!(view.insert(100), 10);
1292-
}
1293-
}
1294-
assert_eq!(map.get(&1).unwrap(), &100);
1295-
assert_eq!(map.len(), 6);
1296-
1297-
1298-
// Existing key (update)
1299-
match map.entry(2) {
1300-
Vacant(_) => unreachable!(),
1301-
Occupied(mut view) => {
1302-
let v = view.get_mut();
1303-
*v *= 10;
1304-
}
1305-
}
1306-
assert_eq!(map.get(&2).unwrap(), &200);
1307-
assert_eq!(map.len(), 6);
1308-
1309-
// Existing key (take)
1310-
match map.entry(3) {
1311-
Vacant(_) => unreachable!(),
1312-
Occupied(view) => {
1313-
assert_eq!(view.remove(), 30);
1314-
}
1315-
}
1316-
assert_eq!(map.get(&3), None);
1317-
assert_eq!(map.len(), 5);
1318-
1319-
1320-
// Inexistent key (insert)
1321-
match map.entry(10) {
1322-
Occupied(_) => unreachable!(),
1323-
Vacant(view) => {
1324-
assert_eq!(*view.insert(1000), 1000);
1325-
}
1326-
}
1327-
assert_eq!(map.get(&10).unwrap(), &1000);
1328-
assert_eq!(map.len(), 6);
1329-
}
13301138
}
13311139

13321140
#[cfg(test)]

branches/tmp/src/libcore/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
//! use std::error::FromError;
5252
//! use std::old_io::{File, IoError};
5353
//! use std::os::{MemoryMap, MapError};
54-
//! use std::old_path::Path;
54+
//! use std::path::Path;
5555
//!
5656
//! enum MyError {
5757
//! Io(IoError),

branches/tmp/src/libcore/fmt/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ pub trait Show {
264264
#[lang = "debug_trait"]
265265
pub trait Debug {
266266
/// Formats the value using the given formatter.
267-
#[stable(feature = "rust1", since = "1.0.0")]
268267
fn fmt(&self, &mut Formatter) -> Result;
269268
}
270269

@@ -291,7 +290,6 @@ pub trait String {
291290
#[stable(feature = "rust1", since = "1.0.0")]
292291
pub trait Display {
293292
/// Formats the value using the given formatter.
294-
#[stable(feature = "rust1", since = "1.0.0")]
295293
fn fmt(&self, &mut Formatter) -> Result;
296294
}
297295

0 commit comments

Comments
 (0)