@@ -735,8 +735,11 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
735
735
( CastTy :: Ptr ( _) , CastTy :: Int ( _) ) |
736
736
( CastTy :: FnPtr , CastTy :: Int ( _) ) => {
737
737
if let Mode :: Fn = self . mode {
738
+ // in normal functions, mark such casts as not promotable
738
739
self . add ( Qualif :: NOT_CONST ) ;
739
740
} 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
740
743
emit_feature_err (
741
744
& self . tcx . sess . parse_sess , "const_raw_ptr_to_usize_cast" ,
742
745
self . span , GateIssue :: Language ,
@@ -759,8 +762,11 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
759
762
op == BinOp :: Offset ) ;
760
763
761
764
if let Mode :: Fn = self . mode {
765
+ // raw pointer operations are not allowed inside promoteds
762
766
self . add ( Qualif :: NOT_CONST ) ;
763
767
} 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
764
770
emit_feature_err (
765
771
& self . tcx . sess . parse_sess ,
766
772
"const_compare_raw_pointers" ,
0 commit comments