diff options
| author | bors <bors@rust-lang.org> | 2016-09-14 08:28:05 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-14 08:28:05 -0700 |
| commit | 5a5736db916ac30ca67945bbf0aee41ced1fcf05 (patch) | |
| tree | d681ded3fcaea851b72f01b8e1d0b08bba9597bf /src/libstd | |
| parent | 97b561a0944141a02a0cebe577c3c69e436abcf4 (diff) | |
| parent | e368cdd2d5fc2ceff4c4745600fda29dba9fd81f (diff) | |
| download | rust-5a5736db916ac30ca67945bbf0aee41ced1fcf05.tar.gz rust-5a5736db916ac30ca67945bbf0aee41ced1fcf05.zip | |
Auto merge of #36472 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 5 pull requests - Successful merges: #36334, #36335, #36363, #36374, #36467 - Failed merges:
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/collections/hash/map.rs | 2 | ||||
| -rw-r--r-- | src/libstd/collections/hash/set.rs | 1 | ||||
| -rw-r--r-- | src/libstd/ffi/c_str.rs | 1 | ||||
| -rw-r--r-- | src/libstd/ffi/os_str.rs | 2 | ||||
| -rw-r--r-- | src/libstd/net/ip.rs | 18 | ||||
| -rw-r--r-- | src/libstd/sync/condvar.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/mutex.rs | 1 | ||||
| -rw-r--r-- | src/libstd/sync/rwlock.rs | 1 |
8 files changed, 27 insertions, 0 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 4eb2c8f0644..eb1653f18cb 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -1218,6 +1218,7 @@ impl<K, V, S> Default for HashMap<K, V, S> where K: Eq + Hash, S: BuildHasher + Default, { + /// Creates an empty `HashMap<K, V, S>`, with the `Default` value for the hasher. fn default() -> HashMap<K, V, S> { HashMap::with_hasher(Default::default()) } @@ -2026,6 +2027,7 @@ impl Hasher for DefaultHasher { #[stable(feature = "rust1", since = "1.0.0")] impl Default for RandomState { + /// Constructs a new `RandomState`. #[inline] fn default() -> RandomState { RandomState::new() diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index ca5137e9573..ff56747fee6 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -665,6 +665,7 @@ impl<T, S> Default for HashSet<T, S> where T: Eq + Hash, S: BuildHasher + Default, { + /// Creates an empty `HashSet<T, S>` with the `Default` value for the hasher. fn default() -> HashSet<T, S> { HashSet::with_hasher(Default::default()) } diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index 2d5e8c04194..1c449712e1f 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -361,6 +361,7 @@ impl<'a> Default for &'a CStr { #[stable(feature = "cstr_default", since = "1.10.0")] impl Default for CString { + /// Creates an empty `CString`. fn default() -> CString { let a: &CStr = Default::default(); a.to_owned() diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs index 36cf4ef758d..d93d3c73622 100644 --- a/src/libstd/ffi/os_str.rs +++ b/src/libstd/ffi/os_str.rs @@ -170,6 +170,7 @@ impl ops::Deref for OsString { #[stable(feature = "osstring_default", since = "1.9.0")] impl Default for OsString { + /// Constructs an empty `OsString`. #[inline] fn default() -> OsString { OsString::new() @@ -342,6 +343,7 @@ impl OsStr { #[stable(feature = "osstring_default", since = "1.9.0")] impl<'a> Default for &'a OsStr { + /// Creates an empty `OsStr`. #[inline] fn default() -> &'a OsStr { OsStr::new("") diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index c6a7a77e68a..05ef559422f 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -22,6 +22,24 @@ use sys::net::netc as c; use sys_common::{AsInner, FromInner}; /// An IP address, either an IPv4 or IPv6 address. +/// +/// # Examples +/// +/// Constructing an IPv4 address: +/// +/// ``` +/// use std::net::{IpAddr, Ipv4Addr}; +/// +/// IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)); +/// ``` +/// +/// Constructing an IPv6 address: +/// +/// ``` +/// use std::net::{IpAddr, Ipv6Addr}; +/// +/// IpAddr::V6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); +/// ``` #[stable(feature = "ip_addr", since = "1.7.0")] #[derive(Copy, Clone, Eq, PartialEq, Debug, Hash, PartialOrd, Ord)] pub enum IpAddr { diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 4c946e613ea..3db8b05b954 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -241,6 +241,7 @@ impl Condvar { #[stable(feature = "condvar_default", since = "1.9.0")] impl Default for Condvar { + /// Creates a `Condvar` which is ready to be waited on and notified. fn default() -> Condvar { Condvar::new() } diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index c8ae88c2331..098a3e44258 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -287,6 +287,7 @@ impl<T: ?Sized> Drop for Mutex<T> { #[stable(feature = "mutex_default", since = "1.9.0")] impl<T: ?Sized + Default> Default for Mutex<T> { + /// Creates a `Mutex<T>`, with the `Default` value for T. fn default() -> Mutex<T> { Mutex::new(Default::default()) } diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 4801bcffd08..7f053c6704b 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -311,6 +311,7 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> { #[stable(feature = "rw_lock_default", since = "1.9.0")] impl<T: Default> Default for RwLock<T> { + /// Creates a new `RwLock<T>`, with the `Default` value for T. fn default() -> RwLock<T> { RwLock::new(Default::default()) } |
