correct heap_print.rs for null characters being excluded from pstr regions of heap (#2890)

This commit is contained in:
Mark Thom
2025-04-20 17:14:13 -07:00
committed by Mark Thom
parent 6bcbb91e08
commit 41b90c6e46

View File

@@ -1252,7 +1252,6 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
HeapCellValueTag::PStrLoc => { HeapCellValueTag::PStrLoc => {
self.iter.pop_stack(); self.iter.pop_stack();
} }
// HeapCellValueTag::CStr => {}
_ => { _ => {
unreachable!(); unreachable!();
} }
@@ -1572,10 +1571,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
let c = self.iter.heap.char_at(pstr_loc); let c = self.iter.heap.char_at(pstr_loc);
if c != '\u{0}' || pstr_loc % std::mem::size_of::<HeapCellValue>() == 0 { if c != '\u{0}' {
// if a null character in a pstr has location aligned
// to a cell boundary, the string is ['\\x0\\'].
if !self.max_depth_exhausted(max_depth) { if !self.max_depth_exhausted(max_depth) {
self.state_stack self.state_stack
.push(TokenOrRedirect::CommaSeparatedCharList( .push(TokenOrRedirect::CommaSeparatedCharList(
@@ -1724,7 +1720,7 @@ impl<'a, Outputter: HCValueOutputter> HCPrinter<'a, Outputter> {
(HeapCellValueTag::F64, f) => { (HeapCellValueTag::F64, f) => {
self.print_number(max_depth, NumberFocus::Unfocused(Number::Float(*f)), &op); self.print_number(max_depth, NumberFocus::Unfocused(Number::Float(*f)), &op);
} }
(HeapCellValueTag::PStrLoc) => { // HeapCellValueTag::CStr | HeapCellValueTag::PStr | HeapCellValueTag::PStrOffset) => { (HeapCellValueTag::PStrLoc) => {
self.print_list_like(max_depth); self.print_list_like(max_depth);
} }
(HeapCellValueTag::Lis) => { (HeapCellValueTag::Lis) => {