diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 2b6c376f8a71c..32a0a8b3c5106 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -1064,6 +1064,20 @@ impl From for Option { } } +#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")] +impl<'a, T> From<&'a Option> for Option<&'a T> { + fn from(o: &'a Option) -> Option<&'a T> { + o.as_ref() + } +} + +#[stable(feature = "option_ref_from_ref_option", since = "1.30.0")] +impl<'a, T> From<&'a mut Option> for Option<&'a mut T> { + fn from(o: &'a mut Option) -> Option<&'a mut T> { + o.as_mut() + } +} + ///////////////////////////////////////////////////////////////////////////// // The Option Iterators /////////////////////////////////////////////////////////////////////////////