@@ -374,7 +374,7 @@ impl<'tcx> Validator<'_, 'tcx> {
374374
375375 // In theory, any zero-sized value could be borrowed
376376 // mutably without consequences. However, only &mut []
377- // is allowed right now, and only in functions .
377+ // is allowed right now.
378378 if let ty:: Array ( _, len) = ty. kind ( ) {
379379 match len. try_eval_usize ( self . tcx , self . param_env ) {
380380 Some ( 0 ) => { }
@@ -524,7 +524,7 @@ impl<'tcx> Validator<'_, 'tcx> {
524524 if let Some ( did) = c. check_static_ptr ( self . tcx ) {
525525 // Evaluating a promoted may not read statics except if it got
526526 // promoted from a static (this is a CTFE check). So we
527- // can only promoted static accesses inside statics.
527+ // can only promote static accesses inside statics.
528528 if let Some ( hir:: ConstContext :: Static ( ..) ) = self . const_kind {
529529 // The `is_empty` predicate is introduced to exclude the case
530530 // where the projection operations are [ .field, * ].
@@ -586,9 +586,10 @@ impl<'tcx> Validator<'_, 'tcx> {
586586 if let Some ( def_id) = c. check_static_ptr ( self . tcx ) {
587587 // Only allow statics (not consts) to refer to other statics.
588588 // FIXME(eddyb) does this matter at all for promotion?
589- // FIXME(RalfJung) it makes little sense to not promote this in `fn/`const fn`,
590- // and in `const` this cannot occur anyway. The concern is that we might promote
591- // even `let x = &STATIC` which would be useless.
589+ // FIXME(RalfJung) it makes little sense to not promote this in `fn`/`const fn`,
590+ // and in `const` this cannot occur anyway. The only concern is that we might
591+ // promote even `let x = &STATIC` which would be useless, but this applies to
592+ // promotion inside statics as well.
592593 let is_static = matches ! ( self . const_kind, Some ( hir:: ConstContext :: Static ( _) ) ) ;
593594 if !is_static {
594595 return Err ( Unpromotable ) ;
@@ -681,7 +682,7 @@ impl<'tcx> Validator<'_, 'tcx> {
681682
682683 // In theory, any zero-sized value could be borrowed
683684 // mutably without consequences. However, only &mut []
684- // is allowed right now, and only in functions .
685+ // is allowed right now.
685686 if let ty:: Array ( _, len) = ty. kind ( ) {
686687 match len. try_eval_usize ( self . tcx , self . param_env ) {
687688 Some ( 0 ) => { }
0 commit comments