File tree Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Expand file tree Collapse file tree 4 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -157,7 +157,7 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
157157 this. get_alloc_bytes_unchecked_raw ( alloc_id) ?
158158 }
159159 }
160- AllocKind :: Function | AllocKind :: VTable => {
160+ AllocKind :: Function | AllocKind :: Virtual => {
161161 // Allocate some dummy memory to get a unique address for this function/vtable.
162162 let alloc_bytes = MiriAllocBytes :: from_bytes (
163163 & [ 0u8 ; 1 ] ,
Original file line number Diff line number Diff line change @@ -650,7 +650,7 @@ trait EvalContextPrivExt<'tcx, 'ecx>: crate::MiriInterpCxExt<'tcx> {
650650 dcx. log_protector ( ) ;
651651 }
652652 } ,
653- AllocKind :: Function | AllocKind :: VTable | AllocKind :: Dead => {
653+ AllocKind :: Function | AllocKind :: Virtual | AllocKind :: Dead => {
654654 // No stacked borrows on these allocations.
655655 }
656656 }
@@ -1021,7 +1021,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
10211021 trace ! ( "Stacked Borrows tag {tag:?} exposed in {alloc_id:?}" ) ;
10221022 alloc_extra. borrow_tracker_sb ( ) . borrow_mut ( ) . exposed_tags . insert ( tag) ;
10231023 }
1024- AllocKind :: Function | AllocKind :: VTable | AllocKind :: Dead => {
1024+ AllocKind :: Function | AllocKind :: Virtual | AllocKind :: Dead => {
10251025 // No stacked borrows on these allocations.
10261026 }
10271027 }
Original file line number Diff line number Diff line change @@ -673,7 +673,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
673673 trace ! ( "Tree Borrows tag {tag:?} exposed in {alloc_id:?}" ) ;
674674 alloc_extra. borrow_tracker_tb ( ) . borrow_mut ( ) . expose_tag ( tag) ;
675675 }
676- AllocKind :: Function | AllocKind :: VTable | AllocKind :: Dead => {
676+ AllocKind :: Function | AllocKind :: Virtual | AllocKind :: Dead => {
677677 // No tree borrows on these allocations.
678678 }
679679 }
Original file line number Diff line number Diff line change 1+ use std:: any:: { Any , TypeId } ;
2+
3+ fn main ( ) {
4+ let t1 = TypeId :: of :: < u64 > ( ) ;
5+ let t2 = TypeId :: of :: < u64 > ( ) ;
6+ assert_eq ! ( t1, t2) ;
7+ let t3 = TypeId :: of :: < usize > ( ) ;
8+ assert_ne ! ( t1, t3) ;
9+
10+ let _ = format ! ( "{t1:?}" ) ; // test that we can debug-print
11+
12+ let b = Box :: new ( 0u64 ) as Box < dyn Any > ;
13+ assert_eq ! ( * b. downcast_ref:: <u64 >( ) . unwrap( ) , 0 ) ;
14+ assert ! ( b. downcast_ref:: <usize >( ) . is_none( ) ) ;
15+
16+ // Get the first pointer chunk and try to make it a ZST ref.
17+ // This used to trigger an error because TypeId allocs got misclassified as "LiveData".
18+ let _raw_chunk = unsafe { ( & raw const t1) . cast :: < & ( ) > ( ) . read ( ) } ;
19+ }
You can’t perform that action at this time.
0 commit comments