@@ -278,9 +278,10 @@ impl<T, E> Result<T, E> {
278
278
/// assert_eq!(x.is_ok(), false);
279
279
/// ```
280
280
#[ must_use = "if you intended to assert that this is ok, consider `.unwrap()` instead" ]
281
+ #[ rustc_const_unstable( feature = "const_result" , issue = "67520" ) ]
281
282
#[ inline]
282
283
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
283
- pub fn is_ok ( & self ) -> bool {
284
+ pub const fn is_ok ( & self ) -> bool {
284
285
match * self {
285
286
Ok ( _) => true ,
286
287
Err ( _) => false ,
@@ -303,9 +304,10 @@ impl<T, E> Result<T, E> {
303
304
/// assert_eq!(x.is_err(), true);
304
305
/// ```
305
306
#[ must_use = "if you intended to assert that this is err, consider `.unwrap_err()` instead" ]
307
+ #[ rustc_const_unstable( feature = "const_result" , issue = "67520" ) ]
306
308
#[ inline]
307
309
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
308
- pub fn is_err ( & self ) -> bool {
310
+ pub const fn is_err ( & self ) -> bool {
309
311
!self . is_ok ( )
310
312
}
311
313
@@ -446,8 +448,9 @@ impl<T, E> Result<T, E> {
446
448
/// assert_eq!(x.as_ref(), Err(&"Error"));
447
449
/// ```
448
450
#[ inline]
451
+ #[ rustc_const_unstable( feature = "const_result" , issue = "67520" ) ]
449
452
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
450
- pub fn as_ref ( & self ) -> Result < & T , & E > {
453
+ pub const fn as_ref ( & self ) -> Result < & T , & E > {
451
454
match * self {
452
455
Ok ( ref x) => Ok ( x) ,
453
456
Err ( ref x) => Err ( x) ,
0 commit comments