File tree 3 files changed +11
-1
lines changed
3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -646,7 +646,8 @@ impl<T> Option<T> {
646
646
/// ```
647
647
#[ inline]
648
648
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
649
- pub fn as_mut ( & mut self ) -> Option < & mut T > {
649
+ #[ rustc_const_unstable( feature = "const_option" , issue = "67441" ) ]
650
+ pub const fn as_mut ( & mut self ) -> Option < & mut T > {
650
651
match * self {
651
652
Some ( ref mut x) => Some ( x) ,
652
653
None => None ,
Original file line number Diff line number Diff line change 10
10
#![ feature( const_assume) ]
11
11
#![ feature( const_cell_into_inner) ]
12
12
#![ feature( const_maybe_uninit_assume_init) ]
13
+ #![ cfg_attr( bootstrap, feature( const_panic) ) ]
13
14
#![ feature( const_ptr_read) ]
14
15
#![ feature( const_ptr_write) ]
15
16
#![ feature( const_ptr_offset) ]
Original file line number Diff line number Diff line change @@ -380,6 +380,14 @@ const fn option_const_mut() {
380
380
381
381
let _take = option. take ( ) ;
382
382
let _replace = option. replace ( 42 ) ;
383
+
384
+ {
385
+ let as_mut = option. as_mut ( ) ;
386
+ match as_mut {
387
+ Some ( v) => * v = 32 ,
388
+ None => unreachable ! ( ) ,
389
+ }
390
+ }
383
391
}
384
392
385
393
#[ test]
You can’t perform that action at this time.
0 commit comments