diff options
| author | bors <bors@rust-lang.org> | 2015-02-17 05:57:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-02-17 05:57:55 +0000 |
| commit | f1bb6c2f46f08c1d7b6d695f5b3cf93142cb8860 (patch) | |
| tree | 98ca2711a34754a09d5eedaa32770aed248a7dce /src/libstd | |
| parent | 22224ca4499247e99e18fba8a18a4259f0e4d08b (diff) | |
| parent | 35ee89599cb50be74270e6475f4bbe182e769892 (diff) | |
| download | rust-f1bb6c2f46f08c1d7b6d695f5b3cf93142cb8860.tar.gz rust-f1bb6c2f46f08c1d7b6d695f5b3cf93142cb8860.zip | |
Auto merge of #22397 - Manishearth:rollup, r=huonw
None
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 48 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 32 | ||||
| -rw-r--r-- | src/libstd/fs.rs | 6 | ||||
| -rw-r--r-- | src/libstd/os.rs | 8 | ||||
| -rw-r--r-- | src/libstd/rt/unwind.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sys/unix/fs.rs | 5 |
6 files changed, 91 insertions, 9 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 18dd122891d..241e409910f 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1372,6 +1372,8 @@ enum VacantEntryState<K, V, M> { NoElem(EmptyBucket<K, V, M>), } +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S> where K: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -1384,6 +1386,22 @@ impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S> } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +impl<'a, K, V, S, H> IntoIterator for &'a HashMap<K, V, S> + where K: Eq + Hash<H>, + S: HashState<Hasher=H>, + H: hash::Hasher<Output=u64> +{ + type Item = (&'a K, &'a V); + type IntoIter = Iter<'a, K, V>; + + fn into_iter(self) -> Iter<'a, K, V> { + self.iter() + } +} + +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S> where K: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -1396,6 +1414,22 @@ impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S> } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +impl<'a, K, V, S, H> IntoIterator for &'a mut HashMap<K, V, S> + where K: Eq + Hash<H>, + S: HashState<Hasher=H>, + H: hash::Hasher<Output=u64> +{ + type Item = (&'a K, &'a mut V); + type IntoIter = IterMut<'a, K, V>; + + fn into_iter(mut self) -> IterMut<'a, K, V> { + self.iter_mut() + } +} + +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] impl<K, V, S, H> IntoIterator for HashMap<K, V, S> where K: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -1408,6 +1442,20 @@ impl<K, V, S, H> IntoIterator for HashMap<K, V, S> } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +impl<K, V, S, H> IntoIterator for HashMap<K, V, S> + where K: Eq + Hash<H>, + S: HashState<Hasher=H>, + H: hash::Hasher<Output=u64> +{ + type Item = (K, V); + type IntoIter = IntoIter<K, V>; + + fn into_iter(self) -> IntoIter<K, V> { + self.into_iter() + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, K, V> Iterator for Iter<'a, K, V> { type Item = (&'a K, &'a V); diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index 96af556dbcc..300e2089317 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -835,6 +835,8 @@ pub struct Union<'a, T: 'a, S: 'a> { iter: Chain<Iter<'a, T>, Difference<'a, T, S>> } +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, @@ -847,11 +849,41 @@ impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S> } } +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot +impl<'a, T, S, H> IntoIterator for &'a HashSet<T, S> + where T: Eq + Hash<H>, + S: HashState<Hasher=H>, + H: hash::Hasher<Output=u64> +{ + type Item = &'a T; + type IntoIter = Iter<'a, T>; + + fn into_iter(self) -> Iter<'a, T> { + self.iter() + } +} + +// NOTE(stage0): remove impl after a snapshot +#[cfg(stage0)] +impl<T, S, H> IntoIterator for HashSet<T, S> + where T: Eq + Hash<H>, + S: HashState<Hasher=H>, + H: hash::Hasher<Output=u64> +{ + type IntoIter = IntoIter<T>; + + fn into_iter(self) -> IntoIter<T> { + self.into_iter() + } +} + +#[cfg(not(stage0))] // NOTE(stage0): remove cfg after a snapshot impl<T, S, H> IntoIterator for HashSet<T, S> where T: Eq + Hash<H>, S: HashState<Hasher=H>, H: hash::Hasher<Output=u64> { + type Item = T; type IntoIter = IntoIter<T>; fn into_iter(self) -> IntoIter<T> { diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 45de67865a6..5f91d173ed2 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -112,10 +112,10 @@ impl File { OpenOptions::new().read(true).open(path) } - /// Creates a open a file in write-only mode. + /// Open a file in write-only mode. /// - /// This method will attempt to open a new file, truncating it if it already - /// exists. + /// This function will create a file it it does not exist, + /// and will truncate it if it does. /// /// See the `OpenOptions::open` function for more details. pub fn create<P: AsPath + ?Sized>(path: &P) -> io::Result<File> { diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 3851e799713..740a45feb3d 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -132,7 +132,7 @@ pub fn env() -> Vec<(String,String)> { /// Returns a vector of (variable, value) byte-vector pairs for all the /// environment variables of the current process. -#[deprecated(since = "1.0.0", reason = "use env::vars instead")] +#[deprecated(since = "1.0.0", reason = "use env::vars_os instead")] #[unstable(feature = "os")] pub fn env_as_bytes() -> Vec<(Vec<u8>, Vec<u8>)> { env::vars_os().map(|(k, v)| (byteify(k), byteify(v))).collect() @@ -159,7 +159,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>, Vec<u8>)> { /// None => println!("{} is not defined in the environment.", key) /// } /// ``` -#[deprecated(since = "1.0.0", reason = "use env::var or env::var_os instead")] +#[deprecated(since = "1.0.0", reason = "use env::var instead")] #[unstable(feature = "os")] pub fn getenv(n: &str) -> Option<String> { env::var(n).ok() @@ -171,7 +171,7 @@ pub fn getenv(n: &str) -> Option<String> { /// # Panics /// /// Panics if `n` has any interior NULs. -#[deprecated(since = "1.0.0", reason = "use env::var instead")] +#[deprecated(since = "1.0.0", reason = "use env::var_os instead")] #[unstable(feature = "os")] pub fn getenv_as_bytes(n: &str) -> Option<Vec<u8>> { env::var_os(n).map(byteify) @@ -732,7 +732,7 @@ pub fn args() -> Vec<String> { /// Returns the arguments which this program was started with (normally passed /// via the command line) as byte vectors. -#[deprecated(since = "1.0.0", reason = "use env::args_raw instead")] +#[deprecated(since = "1.0.0", reason = "use env::args_os instead")] #[unstable(feature = "os")] pub fn args_as_bytes() -> Vec<Vec<u8>> { real_args_as_bytes() diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs index 464adadde62..b45878584e0 100644 --- a/src/libstd/rt/unwind.rs +++ b/src/libstd/rt/unwind.rs @@ -292,7 +292,6 @@ pub mod eabi { #[lang="eh_personality"] #[no_mangle] // referenced from rust_try.ll - #[allow(private_no_mangle_fns)] pub extern "C" fn rust_eh_personality( version: c_int, actions: uw::_Unwind_Action, diff --git a/src/libstd/sys/unix/fs.rs b/src/libstd/sys/unix/fs.rs index 66ae018cb36..0ee2b5b6809 100644 --- a/src/libstd/sys/unix/fs.rs +++ b/src/libstd/sys/unix/fs.rs @@ -364,7 +364,10 @@ mod tests { use os; use prelude::v1::*; - #[cfg_attr(target_os = "freebsd", ignore)] // hmm, maybe pipes have a tiny buffer + #[cfg_attr(any(target_os = "freebsd", + target_os = "openbsd"), + ignore)] + // under some system, pipe(2) will return a bidrectionnal pipe #[test] fn test_file_desc() { // Run this test with some pipes so we don't have to mess around with |
