@@ -364,15 +364,7 @@ impl<'tcx> Validator<'_, 'tcx> {
364364 // In theory, any zero-sized value could be borrowed
365365 // mutably without consequences. However, only &mut []
366366 // is allowed right now, and only in functions.
367- if self . const_kind
368- == Some ( hir:: ConstContext :: Static ( hir:: Mutability :: Mut ) )
369- {
370- // Inside a `static mut`, &mut [...] is also allowed.
371- match ty. kind ( ) {
372- ty:: Array ( ..) | ty:: Slice ( _) => { }
373- _ => return Err ( Unpromotable ) ,
374- }
375- } else if let ty:: Array ( _, len) = ty. kind ( ) {
367+ if let ty:: Array ( _, len) = ty. kind ( ) {
376368 // FIXME(eddyb) the `self.is_non_const_fn` condition
377369 // seems unnecessary, given that this is merely a ZST.
378370 match len. try_eval_usize ( self . tcx , self . param_env ) {
@@ -673,13 +665,7 @@ impl<'tcx> Validator<'_, 'tcx> {
673665 // In theory, any zero-sized value could be borrowed
674666 // mutably without consequences. However, only &mut []
675667 // is allowed right now, and only in functions.
676- if self . const_kind == Some ( hir:: ConstContext :: Static ( hir:: Mutability :: Mut ) ) {
677- // Inside a `static mut`, &mut [...] is also allowed.
678- match ty. kind ( ) {
679- ty:: Array ( ..) | ty:: Slice ( _) => { }
680- _ => return Err ( Unpromotable ) ,
681- }
682- } else if let ty:: Array ( _, len) = ty. kind ( ) {
668+ if let ty:: Array ( _, len) = ty. kind ( ) {
683669 // FIXME(eddyb): We only return `Unpromotable` for `&mut []` inside a
684670 // const context which seems unnecessary given that this is merely a ZST.
685671 match len. try_eval_usize ( self . tcx , self . param_env ) {
0 commit comments