Skip to content

Commit fa53275

Browse files
authored
Panic message and outdated comments (#1191)
This commit contains some minor fixes. - Added the actual address to the panic message when the assertions about ObjectReference alignment fails. - Removed an outdated comment about the use of Cell.
1 parent 963e9c2 commit fa53275

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/util/address.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ impl ObjectReference {
522522
pub fn from_raw_address(addr: Address) -> Option<ObjectReference> {
523523
debug_assert!(
524524
addr.is_aligned_to(Self::ALIGNMENT),
525-
"ObjectReference is required to be word aligned"
525+
"ObjectReference is required to be word aligned. addr: {addr}"
526526
);
527527
NonZeroUsize::new(addr.0).map(ObjectReference)
528528
}
@@ -539,7 +539,7 @@ impl ObjectReference {
539539
debug_assert!(!addr.is_zero());
540540
debug_assert!(
541541
addr.is_aligned_to(Self::ALIGNMENT),
542-
"ObjectReference is required to be word aligned"
542+
"ObjectReference is required to be word aligned. addr: {addr}"
543543
);
544544
ObjectReference(NonZeroUsize::new_unchecked(addr.0))
545545
}
@@ -582,7 +582,7 @@ impl ObjectReference {
582582
debug_assert!(!VM::VMObjectModel::UNIFIED_OBJECT_REFERENCE_ADDRESS || addr == obj.to_raw_address(), "The binding claims unified object reference address, but for address {}, the object reference is {}", addr, obj);
583583
debug_assert!(
584584
obj.to_raw_address().is_aligned_to(Self::ALIGNMENT),
585-
"ObjectReference is required to be word aligned"
585+
"ObjectReference is required to be word aligned. addr: {addr}, obj: {obj}"
586586
);
587587
obj
588588
}

src/util/metadata/side_metadata/global.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,6 @@ impl SideMetadataSpec {
10711071
let end_meta_addr = address_to_contiguous_meta_address(self, end_addr);
10721072
let end_meta_shift = meta_byte_lshift(self, end_addr);
10731073

1074-
// The result will be set by one of the following closures.
1075-
// Use Cell so it doesn't need to be mutably borrowed by the two closures which Rust will complain.
10761074
let mut res = None;
10771075

10781076
let mut visitor = |range: BitByteRange| {

0 commit comments

Comments
 (0)