Skip to content

Commit bc32ee0

Browse files
committed
Auto merge of #144208 - matthiaskrgr:rollup-wrli87h, r=matthiaskrgr
Rollup of 11 pull requests Successful merges: - rust-lang/rust#141260 (Allow volatile access to non-Rust memory, including address 0) - rust-lang/rust#143604 (Stabilize `const_float_round_methods`) - rust-lang/rust#143988 ([rustdoc] Make aliases search support partial matching) - rust-lang/rust#144078 (Fix debuginfo-lto-alloc.rs test) - rust-lang/rust#144111 (Remove deprecated `MaybeUninit` slice methods) - rust-lang/rust#144116 (Fixes for LLVM 21) - rust-lang/rust#144134 (Cleanup unicode table gen) - rust-lang/rust#144142 (Add implicit sized bound to trait ascription types) - rust-lang/rust#144148 (Remove pretty print hack for async blocks) - rust-lang/rust#144169 (interpret: fix TypeId pointers being considered data pointers) - rust-lang/rust#144196 (Initialize mingw for the runner's user) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1065d1b + 15f3a9d commit bc32ee0

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

src/alloc_addresses/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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],

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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
}

src/borrow_tracker/tree_borrows/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

tests/pass/intrinsics/type-id.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
}

0 commit comments

Comments
 (0)