about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-09-14 07:18:25 +0000
committerbors <bors@rust-lang.org>2018-09-14 07:18:25 +0000
commitfccde0018a618eb6f45d2a3c97f629809994dff6 (patch)
treed4c725cd7dfd72336822e39f899c27dbf13a6d99 /src/libcore
parent6ff0b2ed163dab4389d88b14b5729514c11c682e (diff)
parentdd4f5a2d48d986e0bf23b7cc690d3c2422d4391a (diff)
downloadrust-fccde0018a618eb6f45d2a3c97f629809994dff6.tar.gz
rust-fccde0018a618eb6f45d2a3c97f629809994dff6.zip
Auto merge of #54215 - kennytm:rollup, r=kennytm
Rollup of 8 pull requests

Successful merges:

 - #53218 (Add a implementation of `From` for converting `&'a Option<T>` into `Option<&'a T>`)
 - #54024 (Fix compiling some rustc crates to wasm)
 - #54095 (Rename all mentions of `nil` to `unit`)
 - #54173 (Suggest valid crate type if invalid crate type is found)
 - #54194 (Remove println!() statement from HashMap unit test)
 - #54203 (Fix the stable release of os_str_str_ref_eq)
 - #54207 (re-mark the never docs as unstable)
 - #54210 (Update Cargo)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/option.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 53cf626bb1c..dfdc375765d 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -1062,6 +1062,20 @@ impl<T> From<T> for Option<T> {
     }
 }
 
+#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
+impl<'a, T> From<&'a Option<T>> for Option<&'a T> {
+    fn from(o: &'a Option<T>) -> Option<&'a T> {
+        o.as_ref()
+    }
+}
+
+#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")]
+impl<'a, T> From<&'a mut Option<T>> for Option<&'a mut T> {
+    fn from(o: &'a mut Option<T>) -> Option<&'a mut T> {
+        o.as_mut()
+    }
+}
+
 /////////////////////////////////////////////////////////////////////////////
 // The Option Iterators
 /////////////////////////////////////////////////////////////////////////////