On 12/3/25 11:35 AM, Timur Tabi wrote:
On Tue, 2025-12-02 at 21:58 -0800, John Hubbard wrote:+impl fmt::Debug for FbRange { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let size_mb = (self.0.end - self.0.start) >> 20; + f.write_fmt(fmt!( + "{:#x}..{:#x} ({} MB)", + self.0.start, + self.0.end, + size_mb + )) + } +} +How about printing size_kb if size_mb == 0 or if it's not an even multiple of MB?
Good idea, I'll do that.
Also, why not just add this function to Range<> instead of creating a new type?
Rust's orphan rules prevent implementing a foreign trait (Debug) on a foreign type (Range<u64>). Both are defined in core, not in nova-core, so the compiler won't allow it. The newtype pattern is the standard Rust workaround for this: by wrapping Range<u64> in a local type FbRange, we can implement whatever traits we need. thanks, -- John Hubbard
