rustc_middle::mir::pretty

Function display_allocation

source
pub fn display_allocation<'a, 'tcx, Prov: Provenance, Extra, Bytes: AllocBytes>(
    tcx: TyCtxt<'tcx>,
    alloc: &'a Allocation<Prov, Extra, Bytes>,
) -> RenderAllocation<'a, 'tcx, Prov, Extra, Bytes>
Expand description

Dumps the size and metadata and content of an allocation to the given writer. The expectation is that the caller first prints other relevant metadata, so the exact format of this function is (without leading or trailing newline):

size: {}, align: {}) {
    <bytes>
}

The byte format is similar to how hex editors print bytes. Each line starts with the address of the start of the line, followed by all bytes in hex format (space separated). If the allocation is small enough to fit into a single line, no start address is given. After the hex dump, an ascii dump follows, replacing all unprintable characters (control characters or characters whose value is larger than 127) with a . This also prints provenance adequately.