diff options
| author | bors <bors@rust-lang.org> | 2020-06-15 11:39:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-06-15 11:39:23 +0000 |
| commit | ff4a2533a0720f9cdd86e02eafa3725f07aa7752 (patch) | |
| tree | 3c45460d9f8f3c6f63bd2807bf0cc154e615db7f /src/libcore | |
| parent | d4ecf31efc2309fb6df8c2a8af9aaf8176ab1c8d (diff) | |
| parent | 54bd077cd6dc66456fdbaf7e455fb5259b4fc05e (diff) | |
Auto merge of #73369 - RalfJung:rollup-hl8g9zf, r=RalfJung
Rollup of 10 pull requests Successful merges: - #72707 (Use min_specialization in the remaining rustc crates) - #72740 (On recursive ADT, provide indirection structured suggestion) - #72879 (Miri: avoid tracking current location three times) - #72938 (Stabilize Option::zip) - #73086 (Rename "cyclone" to "apple-a7" per changes in upstream LLVM) - #73104 (Example about explicit mutex dropping) - #73139 (Add methods to go from a nul-terminated Vec<u8> to a CString) - #73296 (Remove vestigial CI job msvc-aux.) - #73304 (Revert heterogeneous SocketAddr PartialEq impls) - #73331 (extend network support for HermitCore) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/lib.rs | 1 | ||||
| -rw-r--r-- | src/libcore/option.rs | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 7d21f9a9a66..fe05e914e6d 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -145,7 +145,6 @@ #![feature(associated_type_bounds)] #![feature(const_type_id)] #![feature(const_caller_location)] -#![feature(option_zip)] #![feature(no_niche)] // rust-lang/rust#68303 #[prelude_import] diff --git a/src/libcore/option.rs b/src/libcore/option.rs index e8483875c97..5f0a12678ff 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -926,7 +926,6 @@ impl<T> Option<T> { /// # Examples /// /// ``` - /// #![feature(option_zip)] /// let x = Some(1); /// let y = Some("hi"); /// let z = None::<u8>; @@ -934,9 +933,12 @@ impl<T> Option<T> { /// assert_eq!(x.zip(y), Some((1, "hi"))); /// assert_eq!(x.zip(z), None); /// ``` - #[unstable(feature = "option_zip", issue = "70086")] + #[stable(feature = "option_zip_option", since = "1.46.0")] pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)> { - self.zip_with(other, |a, b| (a, b)) + match (self, other) { + (Some(a), Some(b)) => Some((a, b)), + _ => None, + } } /// Zips `self` and another `Option` with function `f`. |
