Hi there, is there a way to dump the contents of a block to stdout? dbg!(block) only seems to print the id of the block.
I don't think there is. There is dbg!(func) to print the entire function though.
And you can manually iterate over the instrunctions in a block and print them individually.
Will do, thank you for the information!
fwiw, factoring out the print-one-block logic from the print-the-whole-function method into its own method would be cool to have, if you have the appetite for that kind of thing
Am I right in saying this hypothetical function would not be an implementation of fmt::Display for block? Since a block doesn't have enough context on its own to display anything useful. What would the method be called.
Correct. Maybe a display_block method on Function which accepts a Block as argument amd returns a type that borrows from Function and implements Display would work?
Last updated: Dec 06 2025 at 06:05 UTC