@@ -179,8 +179,9 @@ impl<T> Option<T> {
179179 /// [`Some`]: #variant.Some
180180 #[ must_use = "if you intended to assert that this has a value, consider `.unwrap()` instead" ]
181181 #[ inline]
182+ #[ rustc_const_unstable( feature = "const_option" , issue = "67441" ) ]
182183 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
183- pub fn is_some ( & self ) -> bool {
184+ pub const fn is_some ( & self ) -> bool {
184185 matches ! ( * self , Some ( _) )
185186 }
186187
@@ -200,8 +201,9 @@ impl<T> Option<T> {
200201 #[ must_use = "if you intended to assert that this doesn't have a value, consider \
201202 `.and_then(|| panic!(\" `Option` had a value when expected `None`\" ))` instead"]
202203 #[ inline]
204+ #[ rustc_const_unstable( feature = "const_option" , issue = "67441" ) ]
203205 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
204- pub fn is_none ( & self ) -> bool {
206+ pub const fn is_none ( & self ) -> bool {
205207 !self . is_some ( )
206208 }
207209
@@ -259,8 +261,9 @@ impl<T> Option<T> {
259261 /// println!("still can print text: {:?}", text);
260262 /// ```
261263 #[ inline]
264+ #[ rustc_const_unstable( feature = "const_option" , issue = "67441" ) ]
262265 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
263- pub fn as_ref ( & self ) -> Option < & T > {
266+ pub const fn as_ref ( & self ) -> Option < & T > {
264267 match * self {
265268 Some ( ref x) => Some ( x) ,
266269 None => None ,
@@ -580,8 +583,9 @@ impl<T> Option<T> {
580583 /// assert_eq!(x.iter().next(), None);
581584 /// ```
582585 #[ inline]
586+ #[ rustc_const_unstable( feature = "const_option" , issue = "67441" ) ]
583587 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
584- pub fn iter ( & self ) -> Iter < ' _ , T > {
588+ pub const fn iter ( & self ) -> Iter < ' _ , T > {
585589 Iter { inner : Item { opt : self . as_ref ( ) } }
586590 }
587591
0 commit comments