File tree 2 files changed +6
-4
lines changed
compiler/rustc_const_eval/src/interpret
2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ impl<Prov: Provenance> Immediate<Prov> {
118
118
( Immediate :: Scalar ( scalar) , Abi :: Scalar ( s) ) => {
119
119
assert_eq ! ( scalar. size( ) , s. size( cx) ) ;
120
120
if !matches ! ( s. primitive( ) , abi:: Pointer ( ..) ) {
121
+ // This is not a pointer, it should not carry provenance.
121
122
assert ! ( matches!( scalar, Scalar :: Int ( ..) ) ) ;
122
123
}
123
124
}
Original file line number Diff line number Diff line change @@ -651,10 +651,10 @@ where
651
651
if !self . validation_in_progress ( ) {
652
652
M :: after_local_write ( self , local, /*storage_live*/ false ) ?;
653
653
}
654
- // Double-check that the value we are storing and the local fit to each other.
655
- if cfg ! ( debug_assertions ) {
656
- src . assert_matches_abi ( local_layout . abi , self ) ;
657
- }
654
+ // Double-check that the value we are storing and the local fit to each other. We do
655
+ // this even with debug assertions as interpreter behavior can get really strange
656
+ // when this is violated.
657
+ src . assert_matches_abi ( local_layout . abi , self ) ;
658
658
}
659
659
Left ( mplace) => {
660
660
self . write_immediate_to_mplace_no_validate ( src, mplace. layout , mplace. mplace ) ?;
@@ -672,6 +672,7 @@ where
672
672
layout : TyAndLayout < ' tcx > ,
673
673
dest : MemPlace < M :: Provenance > ,
674
674
) -> InterpResult < ' tcx > {
675
+ // Ensure the value matches the type of the place it is written to.
675
676
if cfg ! ( debug_assertions) {
676
677
value. assert_matches_abi ( layout. abi , self ) ;
677
678
}
You can’t perform that action at this time.
0 commit comments