@@ -735,8 +735,11 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
735735 ( CastTy :: Ptr ( _) , CastTy :: Int ( _) ) |
736736 ( CastTy :: FnPtr , CastTy :: Int ( _) ) => {
737737 if let Mode :: Fn = self . mode {
738+ // in normal functions, mark such casts as not promotable
738739 self . add ( Qualif :: NOT_CONST ) ;
739740 } else if !self . tcx . sess . features_untracked ( ) . const_raw_ptr_to_usize_cast {
741+ // in const fn and constants require the feature gate
742+ // FIXME: make it unsafe inside const fn and constants
740743 emit_feature_err (
741744 & self . tcx . sess . parse_sess , "const_raw_ptr_to_usize_cast" ,
742745 self . span , GateIssue :: Language ,
@@ -759,8 +762,11 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
759762 op == BinOp :: Offset ) ;
760763
761764 if let Mode :: Fn = self . mode {
765+ // raw pointer operations are not allowed inside promoteds
762766 self . add ( Qualif :: NOT_CONST ) ;
763767 } else if !self . tcx . sess . features_untracked ( ) . const_compare_raw_pointers {
768+ // require the feature gate inside constants and const fn
769+ // FIXME: make it unsafe to use these operations
764770 emit_feature_err (
765771 & self . tcx . sess . parse_sess ,
766772 "const_compare_raw_pointers" ,
0 commit comments