about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/option.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 045c1f9feaf..fe508adb713 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -142,6 +142,7 @@
 use self::Option::*;
 
 use clone::Clone;
+use convert::From;
 use default::Default;
 use iter::ExactSizeIterator;
 use iter::{Iterator, DoubleEndedIterator, FromIterator, IntoIterator};
@@ -754,6 +755,13 @@ impl<'a, T> IntoIterator for &'a mut Option<T> {
     }
 }
 
+#[stable(since = "1.12.0", feature = "option_from")]
+impl<T> From<T> for Option<T> {
+    fn from(val: T) -> Option<T> {
+        Some(val)
+    }
+}
+
 /////////////////////////////////////////////////////////////////////////////
 // The Option Iterators
 /////////////////////////////////////////////////////////////////////////////