@@ -364,15 +364,7 @@ impl<'tcx> Validator<'_, 'tcx> {
364
364
// In theory, any zero-sized value could be borrowed
365
365
// mutably without consequences. However, only &mut []
366
366
// 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 ( ) {
376
368
// FIXME(eddyb) the `self.is_non_const_fn` condition
377
369
// seems unnecessary, given that this is merely a ZST.
378
370
match len. try_eval_usize ( self . tcx , self . param_env ) {
@@ -673,13 +665,7 @@ impl<'tcx> Validator<'_, 'tcx> {
673
665
// In theory, any zero-sized value could be borrowed
674
666
// mutably without consequences. However, only &mut []
675
667
// 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 ( ) {
683
669
// FIXME(eddyb): We only return `Unpromotable` for `&mut []` inside a
684
670
// const context which seems unnecessary given that this is merely a ZST.
685
671
match len. try_eval_usize ( self . tcx , self . param_env ) {
0 commit comments