Hi there
Is there any way Rust compiler could print the value of a const at compile time? In a note
perhaps?
This might be an XY problem, so here's the whole story:
I'm currently in the process of creating my own kernel in Rust for RPi 4B. I find it somewhat tedious to check the data structures I initialize with const fn
s. It's difficult to use #[test]
, because the binary is being cross-compiled for ARMv8, and asm!
macros make it close to impossible to test anything on x86, without adding a buttload of #[cfg(not(test))]
lines.
I'm looking for a way to find the value of const without having to resort to memory dumps from jtag / readelf
/ hexdumps.
I find this is similar to A macro to print into log of the compiler during compile time?, albeit I doubt whether the solution proposed there fits my needs.