File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
src/librustc_mir/interpret Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -207,12 +207,18 @@ for
207207 self . ecx . tcx . struct_tail_erasing_lifetimes (
208208 referenced_ty, self . ecx . param_env ) . kind
209209 {
210- // Validation has already errored on an invalid vtable pointer so this `assert_ptr`
211- // will never panic.
212- let vtable = mplace. meta . unwrap ( ) . assert_ptr ( ) ;
213- // explitly choose `Immutable` here, since vtables are immutable, even
214- // if the reference of the fat pointer is mutable
215- self . intern_shallow ( vtable. alloc_id , Mutability :: Immutable , None ) ?;
210+ // Validation has already errored on an invalid vtable pointer so we can safely not
211+ // do anything if this is not a real pointer
212+ if let Scalar :: Ptr ( vtable) = mplace. meta . unwrap ( ) {
213+ // explitly choose `Immutable` here, since vtables are immutable, even
214+ // if the reference of the fat pointer is mutable
215+ self . intern_shallow ( vtable. alloc_id , Mutability :: Immutable , None ) ?;
216+ } else {
217+ self . ecx ( ) . tcx . sess . delay_span_bug (
218+ syntax_pos:: DUMMY_SP ,
219+ "vtables pointers cannot be integer pointers" ,
220+ ) ;
221+ }
216222 }
217223 // Check if we have encountered this pointer+layout combination before.
218224 // Only recurse for allocation-backed pointers.
You can’t perform that action at this time.
0 commit comments